资源简介

机器学习实战支持向量机代码,分为简易SMO,完整SMO,引入核函数SMO,以及实战利用其做手写字体的识别。 完整的代码需要数学理论作为依托,请关注我的学习文档,有完整的理论证明,供大家参考。

资源截图

代码片段和文件信息

# -*- coding: utf-8 -*-
“““
Created on Fri Sep 14 18:53:24 2018

@author: zhe

E-mail:1194585271@qq.com
“““

import svmMLiA
import time

start=time.clock()

dataArrlabelArr = svmMLiA.loadDataSet(‘testSet.txt‘)

balpha = svmMLiA.smoSimple(dataArrlabelArr0.60.00180)

print (b)

print (alpha[alpha>0])

for i in range(100):
if alpha[i]>0.0:
print (idataArr[i]labelArr[i])



end=time.clock()
total_time=end-start
print(“Time For Run SMO:“+str(total_time))

w = svmMLiA.calculateW(dataArrlabelArralpha)
#drawing
svmMLiA.drawing(dataArrlabelArralphawb)




 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-10-12 10:24  Chapter6\__pycache__\
     文件        2714  2018-09-15 14:36  Chapter6\__pycache__\svmMLiA.cpython-36.pyc
     目录           0  2018-10-12 10:24  Chapter6\1.SimpleSMO\
     目录           0  2018-10-12 10:24  Chapter6\1.SimpleSMO\__pycache__\
     文件        4137  2018-09-28 11:18  Chapter6\1.SimpleSMO\__pycache__\svmMLiA.cpython-36.pyc
     文件         611  2018-09-17 16:33  Chapter6\1.SimpleSMO\do_smoSimple.py
     文件       21521  2018-10-11 17:39  Chapter6\1.SimpleSMO\SMOSimple.eps
     文件        5109  2018-09-28 11:18  Chapter6\1.SimpleSMO\svmMLiA.py
     文件        2208  2010-11-04 14:13  Chapter6\1.SimpleSMO\testSet.txt
     目录           0  2018-10-12 10:24  Chapter6\2.CompleteSMO\
     目录           0  2018-10-12 10:24  Chapter6\2.CompleteSMO\__pycache__\
     文件        5748  2018-10-11 18:06  Chapter6\2.CompleteSMO\__pycache__\svmMLiA.cpython-36.pyc
     文件         622  2018-09-20 16:23  Chapter6\2.CompleteSMO\do_CompleteSMO.py
     文件       22186  2018-10-11 18:06  Chapter6\2.CompleteSMO\SMOComplete.eps
     文件        6830  2018-10-11 18:06  Chapter6\2.CompleteSMO\svmMLiA.py
     文件        2208  2010-11-04 14:13  Chapter6\2.CompleteSMO\testSet.txt
     目录           0  2018-10-12 10:24  Chapter6\3.CompleteSMOWithKernel\
     目录           0  2018-10-12 10:24  Chapter6\3.CompleteSMOWithKernel\__pycache__\
     文件        7142  2018-09-25 16:33  Chapter6\3.CompleteSMOWithKernel\__pycache__\svmMLiA.cpython-36.pyc
     文件        1497  2018-09-25 16:30  Chapter6\3.CompleteSMOWithKernel\do_CompleteSMOWithKernel.py
     文件        8732  2018-09-25 16:33  Chapter6\3.CompleteSMOWithKernel\svmMLiA.py
     文件        2945  2010-11-26 18:16  Chapter6\3.CompleteSMOWithKernel\testSetRBF.txt
     文件        2951  2010-11-26 18:17  Chapter6\3.CompleteSMOWithKernel\testSetRBF2.txt
     目录           0  2018-10-12 10:24  Chapter6\4.HandwritingRecognition\
     目录           0  2018-10-12 10:24  Chapter6\4.HandwritingRecognition\__pycache__\
     文件        8541  2018-10-11 21:35  Chapter6\4.HandwritingRecognition\__pycache__\svmMLiA.cpython-36.pyc
     文件        1463  2018-10-08 10:19  Chapter6\4.HandwritingRecognition\do_HandwritongRecognition.py
     文件       10950  2018-10-11 21:35  Chapter6\4.HandwritingRecognition\svmMLiA.py
     目录           0  2018-10-12 10:24  Chapter6\4.HandwritingRecognition\testDigits\
     文件        1088  2010-10-07 05:35  Chapter6\4.HandwritingRecognition\testDigits\1_0.txt
     文件        1088  2010-10-07 05:35  Chapter6\4.HandwritingRecognition\testDigits\1_1.txt
............此处省略587个文件信息

评论

共有 条评论