我是包操作的新手。
我找到了这个例子:
我测试了一下。我想将每个 automl 试验的输出保存在 Trial 对象 中。我还想获取和设置每个 Trial 的超参数。为了设置 automl 对象的超参数,我使用了以下 python 代码:auto_ml.get_hyperparams()['Pipeline']
这是输出:
HyperparameterSamples([('choice', 'SKLearnWrapper_DecisionTreeClassifier'), ('SKLearnWrapper_DecisionTreeClassifier', HyperparameterSamples([('enabled', True), ('Optional(SKLearnWrapper_DecisionTreeClassifier)', HyperparameterSamples([') , ('class_weight', None), ('criterion', 'gini'), ('max_depth', None), ('max_features', None), ('max_leaf_nodes', None), ('min_impurity_decrease', 0.0) , ('min_impurity_split', None), ('min_samples_leaf', 1), ('min_samples_split', 2), ('min_weight_fraction_leaf', 0.0), ('random_state', None), ('splitter', 'best') ]))])), ('SKLearnWrapper_ExtraTreeClassifier', HyperparameterSamples([('enabled', False), ('Optional(SKLearnWrapper_ExtraTreeClassifier)', HyperparameterSamples([('ccp_alpha', 0.0), ('class_weight', None), ('criterion', 'gini'), ('max_depth', None), ('max_features', 'auto'), ('max_leaf_nodes', None), ('min_impurity_decrease', 0.0), ('min_impurity_split', None) ), ('min_samples_leaf', 1), ('min_samples_split', 2), ('min_weight_frac tion_leaf', 0.0), ('random_state', None), ('splitter', 'random')]))]), ('RidgeClassifier', HyperparameterSamples([('enabled', False), ('Optional( RidgeClassifier)', HyperparameterSamples([('OutputTransformerWrapper', HyperparameterSamples([('NumpyRavel', HyperparameterSamples())])), ('SKLearnWrapper_RidgeClassifier', HyperparameterSamples([('alpha', 1.0), ('class_weight', None) ), ('copy_X', True), ('fit_intercept', True), ('max_iter', None), ('normalize', False), ('random_state', None), ('solver', 'auto' ), ('tol', 0.001)]))])]), ('LogisticRegression', HyperparameterSamples([('enabled', False), ('Optional(LogisticRegression)', HyperparameterSamples([('OutputTransformerWrapper') , HyperparameterSamples([('NumpyRavel', HyperparameterSamples())])), ('SKLearnWrapper_LogisticRegression', HyperparameterSamples([('C', 1.0), ('class_weight', None), ('dual', False), ( 'fit_intercept', True), ('intercept_scaling', 1), ('l1_ratio', None), ('max_iter', 100), ('multi_class', 'auto'), ('n_jobs', None), ('penalty', 'l2'), ('random_state', None), ('solver', 'lbfgs'), ('tol', 0.0001), ('verbose', 0), ('warm_start', False )]))]))])), ('RandomForestClassifier', HyperparameterSamples([('enabled', False), ('Optional(RandomForestClassifier)', HyperparameterSamples([('OutputTransformerWrapper', HyperparameterSamples([('NumpyRavel') , HyperparameterSamples())]), ('SKLearnWrapper_RandomForestClassifier', HyperparameterSamples([('bootstrap', True), ('ccp_alpha', 0.0), ('class_weight', None), ('criterion', 'gini') , ('max_depth', None), ('max_features', 'auto'), ('max_leaf_nodes', None), ('max_samples', None), ('min_impurity_decrease', 0.0), ('min_impurity_split', None) , ('min_samples_leaf', 1), ('min_samples_split', 2), ('min_weight_fraction_leaf', 0.0), ('n_estimators', 100), ('n_jobs', None), ('oob_score', False), ( 'random_state', None), ('verbose', 0), ('warm_start', False)]))]))]), ('joiner', HyperparameterSamples())])
输出是 HyperparameterSamples 对象,我想把它转换成 Trials,这可能吗?