中的参数'u size'autosklearn.regression.autosklearn回归器好像什么都做不了,怎么正确使用呢?

2024-03-29 12:01:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用autosklearn(版本0.4.1)来获得一个想法,在哪个算法方向上搜索我的回归问题。我用sklearn的boston玩具示例数据进行了尝试,效果很好(见下面的代码)。 它只输出一组算法。这是好的,但我想它也告诉我哪一个算法是最好的。你知道吗

我想我可以通过在中使用参数“ensemble\u size=1”(或零)来实现这一点 autosklearn.regression.autosklearn回归器 但我总是得到一个集合,里面有一些加权算法。另外,如果我设置“集成大小=5”或某个更大的数字1,它会保持集成大小不变,就像我根本不设置参数一样,但不会保持我给定的值。你知道吗

有没有人知道,如果我只是使用了错误的synthax,试图实现autosklearn包不可能实现的东西,或者我是否遗漏了其他东西?你知道吗

非常感谢您的回答和问候, 绿色

import sklearn.datasets
import autosklearn.regression 

x, y = sklearn.datasets.load_boston(return_X_y=True)
feature_types = (['numerical'] * 3) + ['categorical'] + (['numerical'] * 9)
x_train, x_test, y_train, y_test = sklearn.model_selection.train_test_split(x, y, random_state=1)

automl = autosklearn.regression.AutoSklearnRegressor(
         time_left_for_this_task=120,# in seconds
         per_run_time_limit=30, 
         tmp_folder='tmp_Bostondata',
         output_folder='output_Bostondata',
         )

automl.fit(x_train, y_train, dataset_name='Boston dataset',
       feat_type=feature_types)

predictions = automl.predict(x_test)

Tags: testimport算法参数timetrainnumericalsklearn