以感知机分类为例
1. 拆分数据:将原始数据拆分为训练集和测试集,使用sklearn中cross_validation模块中的train_test_split函数;
2. 标准化处理:将原始数据标准化,使用sklearn中preprocessing模块中的StandardScaler;
3. 建模:使用sklearn中linear_model中的Perceptron,输入超参数,并用训练集fit它;
4. 预测:predict输入的测试集;
5. 评分:使用sklearn的metrics模块的accuracy_score输出分类准确率。