h2o AutoML结果令人困惑

问题描述 投票:1回答:1

我在我的java代码中使用AutoML,并使用AUC作为我的sort_metric。经过20分钟的培训,我得到了以下培训总结:

09-01 09:51:05.872 127.0.0.1:54321       18273  FJ-1-9    INFO: 09:51:05.869 Info  ModelTraining    Built: 1 models for search: DeepLearning hyperparameter search 1
09-01 09:51:05.872 127.0.0.1:54321       18273  FJ-1-9    INFO: 09:51:05.869 Info  ModelTraining    New leader: DeepLearning_grid_0_AutoML_20180901_092939_model_0, AUC: 0.9170303558590623
09-01 09:51:05.872 127.0.0.1:54321       18273  FJ-1-9    INFO: 09:51:05.869 Info  ModelTraining    DeepLearning hyperparameter search 1 complete
09-01 09:51:05.872 127.0.0.1:54321       18273  FJ-1-9    INFO: 09:51:05.869 Info  ModelTraining    AutoML: out of time; skipping DL hyperparameter search
09-01 09:51:05.872 127.0.0.1:54321       18273  FJ-1-9    INFO: 09:51:05.870 Info  ModelTraining    AutoML: out of time; skipping DL hyperparameter search
09-01 09:51:05.872 127.0.0.1:54321       18273  FJ-1-9    INFO: 09:51:05.870 Info  ModelTraining    StackedEnsemble builds skipped due to the exclude_algos option.
09-01 09:51:05.872 127.0.0.1:54321       18273  FJ-1-9    INFO: 09:51:05.870 Info  Workflow         AutoML: build done; built 2 models
09-01 09:51:05.872 127.0.0.1:54321       18273  FJ-1-9    INFO: Leaderboard for project my.proj (models sorted in order of AUC, best first):
09-01 09:51:05.872 127.0.0.1:54321       18273  FJ-1-9    INFO: #                                            model_id       auc   logloss  mean_per_class_error      rmse       mse
09-01 09:51:05.872 127.0.0.1:54321       18273  FJ-1-9    INFO: 0  DeepLearning_grid_0_AutoML_20180901_092939_model_0  0.917030  0.273277              0.147665  0.189239  0.035812
09-01 09:51:05.872 127.0.0.1:54321       18273  FJ-1-9    INFO: 1  DeepLearning_0_AutoML_20180901_092939               0.937039  0.150729              0.214383  0.193596  0.037479
09-01 09:51:05.872 127.0.0.1:54321       18273  FJ-1-9    INFO: 2  DeepLearning_0_AutoML_20180901_092936               0.958391  0.127028              0.181791  0.179389  0.032180

似乎“DeepLearning_0_AutoML_20180901_092936”是最好的,因为它具有最高的AUC值,但实际上“DeepLearning_grid_0_AutoML_20180901_092939_model_0”是第一个,而AtuoML.leader()也返回模型“DeepLearning_grid_0_AutoML_20180901_092939_model_0”。哪一个最好?

以下是运行AutoML的代码:

    AutoMLBuildSpec autoMLBuildSpec = new AutoMLBuildSpec();

    autoMLBuildSpec.input_spec.training_frame = frame._key;
    autoMLBuildSpec.input_spec.response_column = "class";
    autoMLBuildSpec.input_spec.sort_metric = "AUC";

    autoMLBuildSpec.build_control.balance_classes = true;
    autoMLBuildSpec.build_control.class_sampling_factors = new float[2];
    autoMLBuildSpec.build_control.class_sampling_factors[0] = 1.0f;
    autoMLBuildSpec.build_control.class_sampling_factors[1] = 1.0f;
    autoMLBuildSpec.build_control.nfolds = nfolds;
    autoMLBuildSpec.build_control.keep_cross_validation_models = true;
    autoMLBuildSpec.build_control.keep_cross_validation_predictions = true;
    autoMLBuildSpec.build_control.project_name = "my.proj";
    HyperSpaceSearchCriteria.RandomDiscreteValueSearchCriteria randomDiscreteValueSearchCriteria = new HyperSpaceSearchCriteria.RandomDiscreteValueSearchCriteria();
    randomDiscreteValueSearchCriteria.set_max_runtime_secs(Double.parseDouble(autoModelRuntimeSeconds));
    randomDiscreteValueSearchCriteria.set_stopping_metric(ScoreKeeper.StoppingMetric.AUTO);
    randomDiscreteValueSearchCriteria.set_stopping_tolerance(0.0);
    autoMLBuildSpec.build_control.stopping_criteria = randomDiscreteValueSearchCriteria;

    AutoMLBuildSpec.AutoMLBuildModels autoMLBuildModels = new AutoMLBuildSpec.AutoMLBuildModels();
    autoMLBuildModels.exclude_algos = new AutoML.algo[4];
    autoMLBuildModels.exclude_algos[0] = AutoML.algo.DRF;
    autoMLBuildModels.exclude_algos[1] = AutoML.algo.GBM;
    autoMLBuildModels.exclude_algos[2] = AutoML.algo.GLM;
    autoMLBuildModels.exclude_algos[3] = AutoML.algo.StackedEnsemble;

    autoMLBuildSpec.build_models = autoMLBuildModels;

    logger.info("begin training ...");
    AutoML aml = AutoML.makeAutoML(Key.make(), new Date(), autoMLBuildSpec);
    AutoML.startAutoML(aml);
    AutoML.startAutoML(autoMLBuildSpec).get();
    logger.info("training finished.");

    for (Model model: aml.leaderboard().getModels()) {
            logger.info("========================================================================================================");
            logger.info("model key: {}", model._key);
            logger.info("_scoring_history");
            logger.info(model._output._scoring_history.toString(10, true));
            logger.info("model auc: {}", Utils.doubleToString(model.auc(), 6));
            logger.info("========================================================================================================");
    }
    logger.info("leader model scoring history:");
    logger.info(aml.leader()._output._scoring_history.toString(10, true));
metrics h2o automl
1个回答
1
投票

请尝试将度量标准指定为小写,以便在使用“auc”时将排行榜按递减顺序排序(我们似乎没有强制执行此类案例,我已提交JIRA票证来解决此问题):

autoMLBuildSpec.input_spec.sort_metric = "auc";

另外,你也不需要“开始”2次自动启动。基本上

AutoML aml = AutoML.makeAutoML(Key.make(), new Date(), autoMLBuildSpec);
AutoML.startAutoML(aml);
AutoML.startAutoML(autoMLBuildSpec).get();

可以直接替换

AutoML.startAutoML(autoMLBuildSpec).get();

希望这可以帮助!

© www.soinside.com 2019 - 2024. All rights reserved.