auto-sklearn安装配置

官方安装指南:

http://automl.github.io/auto-sklearn/stable/installation.html#installation

系统需求:

auto-sklearn has the following system requirements:

  • Linux operating system (for example Ubuntu),
  • Python (>=3.5).
  • C++ compiler (with C++11 supports) and SWIG (version 3.0 or later)

1)查看python版本:

python3 -V

2) 查看gcc版本(建议4.8以上版本):

gcc -v

3) 查看swig版本:

swig -copyright

安装swig可以参考:

swig:
http://www.swig.org/download.html

installation guide:
http://www.linuxfromscratch.org/blfs/view/cvs/general/swig.html

 

安装执行:

1) curl https://raw.githubusercontent.com/automl/auto-sklearn/master/requirements.txt | xargs -n 1 -L 1 pip3 install

如果需要使用代理,可以执行:

curl -x IP:port https://raw.githubusercontent.com/automl/auto-sklearn/master/requirements.txt | xargs -n 1 -L 1 pip3 --proxy IP:port install

2)  pip3 install auto-sklearn

3)入门例子:

https://automl.github.io/auto-sklearn/stable/index.html#

Example

>>> import autosklearn.classification
>>> 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)
>>> automl = autosklearn.classification.AutoSklearnClassifier()
>>> automl.fit(X_train, y_train)
>>> y_hat = automl.predict(X_test)
>>> print("Accuracy score", sklearn.metrics.accuracy_score(y_test, y_hat))

遇到的问题:

1)xgboost

cc1plus: error: unrecognized command line option "-std=c++11"

......

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-5dx269ux/xgboost/

明显是因为编译器不支持C++11,查看当前的gcc版本:

[lss@localhost etc]$ gcc -v
Target: x86_64-redhat-linux
......
gcc version 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)

解决方法:

升级gcc到4.8.5, 参照https://blog.csdn.net/cffishappy/article/details/80182935

需要注意的是,安装完gcc4.8.5以后需要设置动态库软连接,新安装的.so为:
[root@localhost lss]# ls /usr/local/lib64/libstdc++.so.6*
/usr/local/lib64/libstdc++.so.6  /usr/local/lib64/libstdc++.so.6.0.19  /usr/local/lib64/libstdc++.so.6.0.19-gdb.py

原来老的.so为:
[root@localhost lss]# ll /usr/lib64/libstdc++.so.6
lrwxrwxrwx. 1 root root 19 Apr 25  2017 /usr/lib64/libstdc++.so.6 -> libstdc++.so.6.0.13

替换:
[root@localhost lss]# rm -fr /usr/lib64/libstdc++.so.6

[root@localhost lss]# cp /usr/local/lib64/libstdc++.so.6.0.19 /usr/lib64/

[root@localhost lss]# cd /usr/lib64/
[root@localhost lib64]# ln -s libstdc++.so.6.0.19 libstdc++.so.6
[root@localhost lib64]# ll libstdc++.so.6*
lrwxrwxrwx. 1 root root      19 Oct 19 16:33 libstdc++.so.6 -> libstdc++.so.6.0.19
-rwxr-xr-x. 1 root root  989840 Jul 23  2015 libstdc++.so.6.0.13
-rwxr-xr-x. 1 root root 6486707 Oct 19 16:32 libstdc++.so.6.0.19

你可能感兴趣的:(机器学习&人工智能,python)