#coding=utf-8 from numpy import * def loadSimpleData(): dataMat = matrix([[1. , 2.1], [2. , 1.1], [1.3 , 1.], [1. , 1.], [2. , 1.]]) classLabels = [1.0,1.0,-1.0,-1.0,1.0] return dataMat, classLabels #训练出单个弱分类器,输出预测值 def stumpClassify(dataMatrix,dimen…