机器学习的入门-hello world (python)

本文是对机器学习入门视频hello world的总结。

实验环境
本文的代码是在Windows command测试的。本机已经安装python,版本v3.6.4rc1。安装scikit-learn后,发现还需安装另外两个依赖库。
scikit-learn requires:
- Python (>= 2.7 or >= 3.3)
- NumPy (>= 1.8.2)
- SciPy (>= 0.13.3)
依次在Windows命令行,以完成相关库的安装:
- pip install scikit-learn
- pip install scipy
- pip install numpy

数据
特征(features):身高、胡子
标签(label):性别
有无监督:有
机器学习的入门-hello world (python)_第1张图片
编码
1. 从sklearn库导入决策树tree
2. 创建feature
3. 创建label
4. 创建决策树
5. 将数据交给决策树去训练
对应的代码如下:
这里写图片描述
用两个人进行预测:身高158、没胡子,身高172、有胡子
这里写图片描述

-

你可能感兴趣的:(机器学习)