auto sklearn安装(mac版)

需要python3的环境

安装swig3

ruby -e "$(curl --insecure -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

brew install swig3

给指定的文件夹赋予写权限:sudo chmode 777 文件夹

brew link swig

 

安装xgboost:

cd ~ git clone --recursive https://github.com/dmlc/xgboost

brew install gcc --without-multilib

cd xgboost; cp make/minimum.mk ./config.mk; make -j4

cd python-package; sudo python setup.py install

安装auto-sklearn

pip install auto-sklearn

如果报错如下:

XGBoostLibraryNotFound: Cannot find XGBoost Library in the candidate path, did you install compilers and run build.sh in root path?

List of candidates:

/private/var/folders/xw/cvs2qk9d77vc8fgn7zyvp84sqjlg4_/T/pip-install-25jfq24s/xgboost/xgboost/libxgboost.dylib

/private/var/folders/xw/cvs2qk9d77vc8fgn7zyvp84sqjlg4_/T/pip-install-25jfq24s/xgboost/xgboost/../../lib/libxgboost.dylib

/private/var/folders/xw/cvs2qk9d77vc8fgn7zyvp84sqjlg4_/T/pip-install-25jfq24s/xgboost/xgboost/./lib/libxgboost.dylib

/Users/..../.conda/envs/untitled/xgboost/libxgboost.dylib

然后将xgboost下面的libxgboost.dylib 放入提示的默认目录下:

cp libxgboost.dylib /Users/...../.conda/envs/untitled/xgboost/

 

pip install auto-sklearn

如果报错:

手动安装pyrfr

安装pyrfr注意事项:

pyrfr == 0.6.1, 下载地址https://pypi.python.org/pypi/pyrfr/0.6.1

将上述的包下载下来后解压,解压后修改安装文件setup.py

extra_compile_args = ['-O2', '-std=c++11']

extra_compile_args = ['-O2', '-std=c++11', '-stdlib=libc++', '-mmacosx-version-min=10.7']

 

cd pyrfr-0.6.1/

python setup.py install

brew link pcre

最后再:

pip install auto-sklearn

import sklearn.model_selection
import sklearn.datasets
import sklearn.metrics

import autosklearn.classification


def main():
    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)

    automl = autosklearn.classification.AutoSklearnClassifier(
        time_left_for_this_task=120,
        per_run_time_limit=30,
        tmp_folder='/tmp/autosklearn_holdout_example_tmp',
        output_folder='/tmp/autosklearn_holdout_example_out',
        disable_evaluator_output=False,
        # 'holdout' with 'train_size'=0.67 is the default argument setting
        # for AutoSklearnClassifier. It is explicitly specified in this example
        # for demonstrational purpose.
        resampling_strategy='holdout',
        resampling_strategy_arguments={'train_size': 0.67}
    )
    automl.fit(X_train, y_train, dataset_name='digits')

    # Print the final ensemble constructed by auto-sklearn.
    print(automl.show_models())
    predictions = automl.predict(X_test)
    # Print statistics about the auto-sklearn run such as number of
    # iterations, number of models failed with a time out.
    print(automl.sprint_statistics())
    print("Accuracy score", sklearn.metrics.accuracy_score(y_test, predictions))


if __name__ == '__main__':
    main()

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值