コード例 #1
0
def model_index(features: Optional[bool] = True,
                parameters: Optional[bool] = True,
                tests: Optional[bool] = True,
                query: Optional[dict] = Body(...),
                service: ModelService = Depends(ModelService)):
    result = {}
    if features:
        result['features'] = service.clear_features(query)
    if parameters:
        result['parameters'] = service.clear_parameters(query)
    if tests:
        result['tests'] = service.clear_tests(query)
    return result
コード例 #2
0
def main(dataset: str, target: str):
    service = FeatureSelectionService()
    models = ModelService()
    datasets = DatasetService()

    query = {"dataset": dataset, "target": target}
    # Clear feature search results from models
    models.clear_features(query)
    #search_models = models.query_models(query)
    # logging.info("[i] {} models for feature selection".format(len(search_models)))
    # for i, m in enumerate(search_models):
    symbols = datasets.get_dataset_symbols(dataset)
    for i, sym in enumerate(symbols):
        logging.info("==[{}/{}]== Dataset: {} {} {} =====".format(
            i + 1, len(symbols), sym, dataset, target))
        mf = service.create_features_search(target=target,
                                            dataset=dataset,
                                            symbol=sym,
                                            split=0.7,
                                            method='importances')
        logging.info("[{}] Start feature search".format(get_timestamp()))
        mf = service.feature_selection(mf, sync=True)
        logging.info("[{}] End feature search".format(get_timestamp()))