AutoML:auto-sklearn,Auto-PyTorch

鲁班大师1年前 ⋅ 1886 阅读

https://github.com/automl/auto-sklearn

https://github.com/automl/Auto-PyTorch

auto-sklearn 是一个自动化机器学习工具包,是scikit-learn估计器的直接替代品。

import autosklearn.classification
cls = autosklearn.classification.AutoSklearnClassifier()
cls.fit(X_train, y_train)
predictions = cls.predict(X_test)

Auto-PyTorch 主要是为了支持表格数据(分类、回归)和时间序列数据(预测)而开发的。

from autoPyTorch.api.tabular_classification import TabularClassificationTask

# data and metric imports
import sklearn.model_selection
import sklearn.datasets
import sklearn.metrics
X, y = sklearn.datasets.load_digits(return_X_y=True)
X_train, X_test, y_train, y_test = \
        sklearn.model_selection.train_test_split(X, y, random_state=1)

# initialise Auto-PyTorch api
api = TabularClassificationTask()

# Search for an ensemble of machine learning algorithms
api.search(
    X_train=X_train,
    y_train=y_train,
    X_test=X_test,
    y_test=y_test,
    optimize_metric='accuracy',
    total_walltime_limit=300,
    func_eval_time_limit_secs=50
)

# Calculate test accuracy
y_pred = api.predict(X_test)
score = api.score(y_pred, y_test)
print("Accuracy score", score)


全部评论: 0

    相关推荐