Esempio n. 1
0
    elif args.ensemble_setting == "normal":
        autonet = AutoNetClassification(config_preset="full_cs",
                                        **autonet_config)

    # Test logging cont.
    autonet.pipeline[LogFunctionsSelector.get_name()].add_log_function(
        name=test_predictions_for_ensemble.__name__,
        log_function=test_predictions_for_ensemble(autonet, X_test, y_test),
        loss_transform=False)
    autonet.pipeline[LogFunctionsSelector.get_name()].add_log_function(
        name=test_result_ens.__name__,
        log_function=test_result_ens(autonet, X_test, y_test))

    autonet.pipeline[BaselineTrainer.get_name()].add_test_data(X_test)

    print(autonet.get_current_autonet_config())

    fit_results = autonet.fit(X_train, y_train,
                              **autonet.get_current_autonet_config())

    score = autonet.score(X_test, y_test) if y_test is not None else None

    print("Test score:", score)

    # Write to json
    results = dict()
    results["run_id"] = int(args.run_id)
    results["test_score"] = score
    results["seed"] = int(seed)

    with open(logdir + "/results_dump.json", "w") as f:
Esempio n. 2
0
        ensemble_config = get_ensemble_config()
        autonet_config = {**autonet_config, **ensemble_config}
        autonet = AutoNetEnsemble(AutoNetClassification, config_preset="full_cs", **autonet_config)
    elif args.ensemble_setting == "normal":
        autonet = AutoNetClassification(config_preset="full_cs", **autonet_config)

    # Test logging cont.
    autonet.pipeline[LogFunctionsSelector.get_name()].add_log_function(name=test_predictions_for_ensemble.__name__,
                                                                       log_function=test_predictions_for_ensemble(autonet, X_test, y_test),
                                                                       loss_transform=False)
    autonet.pipeline[LogFunctionsSelector.get_name()].add_log_function(name=test_result_ens.__name__,
                                                                       log_function=test_result_ens(autonet, X_test, y_test))

    autonet.pipeline[BaselineTrainer.get_name()].add_test_data(X_test)

    print(autonet.get_current_autonet_config())

    # Fit
    fit_results = autonet.fit(X_train, y_train, **autonet.get_current_autonet_config())
    
    # Score
    score = autonet.score(X_test, y_test) if y_test is not None else None

    print("Test score:", score)

    # Write to json
    results = dict()
    results["run_id"] = int(args.run_id)
    results["test_score"] = score
    results["seed"] = int(seed)