机器学习实战-Adaboost算法
相关博客:
http://www.360doc.com/content/14/1109/12/20290918_423780183.shtml
from numpy import *
import matplotlib.pyplot as plt
def loadSimpData():
datMat = 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 datMat, classLabels
#弱分类器分类,返回致函1/-1的numpy数组
def stumpClassify(dataMatrix, dimen, threshVal, threshIneq):
retArray = ones((shape(dataMatrix)[0], 1))
if threshIneq == &
...