-
外部系统调用AWS ML服务的接口 - Python
- Amazon Machine Learning
https://aws.amazon.com/machine-learning/
- Step 1: Prepare Your Data
- Step 2: Create a Training Datasource
- Step 3: Create an ML Model
- Step 4: Review the ML Model's Predictive Performance
- Step 5: Use the ML Model to Generate Predictions
- Step 6: Clean Up
准备数据(清洗,转换...)→选模型→检查结果→预测新数据→清理
1. 登录 EC2
2. 下载
cd /home/ML
wget https://github.com/awslabs/machine-learning-samples/archive/master.zip
unzip master.zip
3. 进入
cd machine-learning-samples-master
[root@ip-172-30-0-89 machine-learning-samples-master]# ls k-fold-cross-validation ml-tools-python mobile-ios social-media targeted-marketing-python LICENSE mobile-android README.md targeted-marketing-java targeted-marketing-scala |
4. 测试 K-fold Cross-validation
[root@ip-172-30-0-89 k-fold-cross-validation]# ls banking.csv.schema build_folds.py collect_perf.py config.py fold.py README.md recipe.json setup.sh |
5. 安装 python 依赖
版本 Python 2.7.10
在 apt-get 环境下
sudo apt-get update sudo apt-get install python-pip python-virtualenv |
在yum 环境下
yum install -y python27-pip python27-virtualenv |
安装的版本
[root@ip-172-30-0-89 k-fold-cross-validation]# /usr/bin/virtualenv --version
12.0.7
[root@ip-172-30-0-89 k-fold-cross-validation]# pip --version
pip 6.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)
6. 执行setup.sh 脚本,安装 boto
boto的主页在 http://boto.readthedocs.io/en/latest/getting_started.html#getting-started-with-boto
[root@ip-172-30-0-89 k-fold-cross-validation]# source setup.sh Not deleting local-python/bin New python executable in local-python/bin/python2.7 Also creating executable in local-python/bin/python Installing setuptools, pip...done. You are using pip version 6.0.8, however version 9.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. Collecting pip from https://pypi.python.org/packages/b6/ac/7015eb97dc749283ffdec1c3a88ddb8ae03b8fad0f0e611408f196358da3/pip-9.0.1-py2.py3-none-any.whl#md5=297dbd16ef53bcef0447d245815f5144 Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB) 100% |################################| 1.3MB 380kB/s Installing collected packages: pip Found existing installation: pip 6.0.8 Uninstalling pip-6.0.8: Successfully uninstalled pip-6.0.8 Successfully installed pip-9.0.1 Collecting boto Downloading boto-2.45.0-py2.py3-none-any.whl (1.3MB) 100% |████████████████████████████████| 1.4MB 877kB/s Installing collected packages: boto Successfully installed boto-2.45.0 |
说明: 退出, 使用 deactivate 命令
To exit the virtual environment, type deactivate. To clean up the dependent libraries after exiting, remove the ./local-python directory.
7. 缺少 Credentials
(后续补充)