资源简介
机器学习实战数据集

代码片段和文件信息
#-*- coding:utf-8 _*-
“““
@author:KING
@file: adaboost.py
@time: 2018/08/15
“““
import numpy as np
def loadSimpData():
datMat = np.matrix([[1.2.1]
[2.1.1]
[1.31.]
[1.1.]
[2.1.]])
classLabels = [1.01.0-1.0-1.01.0]
return datMatclassLabels
def stumpClassify(dataMatrixdimenthreshValthreshIneq):
retArray = np.ones((np.shape(dataMatrix)[0]1))
if threshIneq == ‘lt‘:
retArray[dataMatrix[:dimen] <= threshVal] = -1.0
else:
retArray[dataMatrix[: dimen] > threshVal] = -1.0
return retArray
def buildStump(dataArrclassLabelsD):
dataMatrix = np.mat(dataArr)
labelMat = np.mat(classLabels).T
mn = np.shape(dataMatrix)
numSteps = 10.0
bestStump = {}
bestClasEst = np.mat(np.zeros((m1)))
minError = np.inf
for i in range(n):#遍历特征
rangeMin = dataMatrix[:i].min()
rangeMax = dataMatrix[:i].max()
stepSize = (rangeMax-rangeMin)/numSteps#阈值增长步长
for j in range(-1int(numSteps)+1):
for inequal in [‘lt‘‘gt‘]:
threshVal = (rangeMin+float(j)*stepSize)
predictedVals = stumpClassify(dataMatrixithreshValinequal)
errArr = np.mat(np.ones((m1)))
errArr[predictedVals==labelMat]=0
weightedError = D.T*errArr
print(“split:dim %dthresh %.2fthresh inequal:%sthe weightedError is :%.3f“ %(
ithreshValinequalweightedError))
if weightedError minError = weightedError
bestClasEst = predictedVals.copy()
bestStump[‘dim‘] = i
bestStump[‘thresh‘]=threshVal
bestStump[‘ineq‘] = inequal
return bestStumpminErrorbestClasEst
def adaBoostTrainDS(dataArrclassLabelsnumIt = 40):
weakClassArr = []
m = np.shape(dataArr)[0]
D = np.mat(np.ones((m1))/m)
aggClassEst = np.mat(np.zeros((m1)))
for i in range(numIt):
bestStumperrorclassEst = buildStump(dataArrclassLabelsD)#第i个弱分类器
print(“D:“D.T)
alpha = float(0.5*np.log((1.0-error)/np.fmax(error1e-16)))
bestStump[‘alpha‘] = alpha
weakClassArr.append(bestStump)
print(“classEst: “classEst.T)#该分类器的分类结果
expon = np.multiply(-1*alpha*np.mat(classLabels).TclassEst)
D = np.multiply(Dnp.exp(expon))
D = D/D.sum()
aggClassEst+=alpha*classEst#与此前的分类器同时工作给出分类结果
print(“aggClassEst: “aggClassEst.T)
aggErrors = np.multiply(np.sign(aggClassEst)!= np.mat(classLabels).Tnp.ones((m1)))
errorRate = aggErrors.sum()/m
print(“total error:“errorRate“\n“)
if errorRate == 0.0:
break
return weakClassArr
def adaClassify(dataToClassclassifierArr):
dataMatrix = np.mat(dataToClass)
m = np.shape(dataMatrix)[0]
aggClassEst = np.mat(np.
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-08-15 07:18 Machine-Learning-in-Action-master\
目录 0 2018-08-15 07:18 Machine-Learning-in-Action-master\AdaBoost\
目录 0 2018-08-15 07:18 Machine-Learning-in-Action-master\AdaBoost\.idea\
文件 455 2018-08-15 07:18 Machine-Learning-in-Action-master\AdaBoost\.idea\AdaBoost.iml
文件 185 2018-08-15 07:18 Machine-Learning-in-Action-master\AdaBoost\.idea\misc.xm
文件 268 2018-08-15 07:18 Machine-Learning-in-Action-master\AdaBoost\.idea\modules.xm
文件 6905 2018-08-15 07:18 Machine-Learning-in-Action-master\AdaBoost\.idea\workspace.xm
目录 0 2018-08-15 07:18 Machine-Learning-in-Action-master\AdaBoost\.ipynb_checkpoints\
文件 6963 2018-08-15 07:18 Machine-Learning-in-Action-master\AdaBoost\.ipynb_checkpoints\AdaBoost-checkpoint.ipynb
文件 8412 2018-08-15 07:18 Machine-Learning-in-Action-master\AdaBoost\AdaBoost.ipynb
文件 3456 2018-08-15 07:18 Machine-Learning-in-Action-master\AdaBoost\adaboost.py
目录 0 2018-08-15 07:18 Machine-Learning-in-Action-master\Logistic回归\
目录 0 2018-08-15 07:18 Machine-Learning-in-Action-master\Logistic回归\.idea\
文件 398 2018-08-15 07:18 Machine-Learning-in-Action-master\Logistic回归\.idea\Logistic回归.iml
文件 185 2018-08-15 07:18 Machine-Learning-in-Action-master\Logistic回归\.idea\misc.xm
文件 280 2018-08-15 07:18 Machine-Learning-in-Action-master\Logistic回归\.idea\modules.xm
文件 9563 2018-08-15 07:18 Machine-Learning-in-Action-master\Logistic回归\.idea\workspace.xm
文件 3722 2018-08-15 07:18 Machine-Learning-in-Action-master\Logistic回归\horseColicTest.txt
文件 60357 2018-08-15 07:18 Machine-Learning-in-Action-master\Logistic回归\horseColicTraining.txt
文件 4007 2018-08-15 07:18 Machine-Learning-in-Action-master\Logistic回归\logRegres.py
文件 4507 2018-08-15 07:18 Machine-Learning-in-Action-master\Logistic回归\logRegres.pyc
文件 2087 2018-08-15 07:18 Machine-Learning-in-Action-master\Logistic回归\testSet.txt
目录 0 2018-08-15 07:18 Machine-Learning-in-Action-master\MLiA_SourceCode\
目录 0 2018-08-15 07:18 Machine-Learning-in-Action-master\MLiA_SourceCode\machinelearninginaction\
文件 31 2018-08-15 07:18 Machine-Learning-in-Action-master\README.txt
目录 0 2018-08-15 07:18 Machine-Learning-in-Action-master\SVM\
目录 0 2018-08-15 07:18 Machine-Learning-in-Action-master\SVM\.idea\
文件 398 2018-08-15 07:18 Machine-Learning-in-Action-master\SVM\.idea\SVM.iml
文件 185 2018-08-15 07:18 Machine-Learning-in-Action-master\SVM\.idea\misc.xm
文件 258 2018-08-15 07:18 Machine-Learning-in-Action-master\SVM\.idea\modules.xm
文件 16956 2018-08-15 07:18 Machine-Learning-in-Action-master\SVM\.idea\workspace.xm
............此处省略3581个文件信息
相关资源
- Iris数据集分类,查看几种分类方法的
- 陈强stata数据集
- ppt 机器学习.ppt
- 基于pytorch的UNet_demo实现及训练自己的
- 多目标跟踪MOT16_Benchmark数据集链接
- Logistic回归总结非常好的机器学习总结
- LCSTS高质量中文短文本摘要数据集
- Convex Analysis and Optimization (Bertsekas
- 机器学习个人笔记完整版v5.2-A4打印版
- JUNIOR:粒子物理学中无监督机器学习
- EMC中国人寿再保险公司数据集中存储
- 语料库.zip
- 银行搜索数据集(bankresearch dataset)
- 中国科学技术大学 研究生课程 机器学
- 遗传算法越野小车unity5.5
- 吴恩达机器学习编程题
- shape_predictor_68_face_landmarks.dat.bz2 68个标
- 机器学习实战高清pdf,中文版+英文版
- 李宏毅-机器学习(视频2017完整)
- 机器学习深度学习 PPT
- 麻省理工:深度学习介绍PPT-1
- 常用数据挖掘数据集
- Wikipedia机器学习迷你电子书之四《D
- Google论文\“Wide & Deep Learning for Recom
- Learning From Data Yaser S. Abu-Mostafa
- 深度学习数据集标注
- WEKA arff 实验数据集---数据挖掘用
- 基于决策树和朴素贝叶斯算法对Adul
- kinetics600.tar.gz
- 北大林宙辰:机器学习一阶算法的优
评论
共有 条评论