资源简介
支持向量机的相关经典案例,里面包含线性核函数和非线性核函数,另外还有实例:支持向量机手写数字识别;内含测试集训练集、代码源文件及注释,可直接运行(需安装numpy和matplotlib)

代码片段和文件信息
‘‘‘
Created on Nov 4 2010
Chapter 5 source file for Machine Learing in Action
@author: Peter
‘‘‘
import numpy as np
from numpy import *
import random
import matplotlib.pyplot as plt
from time import sleep
def loadDataSet(fileName):
dataMat = [];
labelMat = []
fr = open(fileName)
for line in fr.readlines():
lineArr = line.strip().split(‘\t‘)
dataMat.append([float(lineArr[0]) float(lineArr[1])])
labelMat.append(float(lineArr[2]))
return dataMat labelMat
def selectJrand(i m):
j = i # we want to select any J not equal to i
while (j == i):
j = int(random.uniform(0 m))
return j
def clipAlpha(aj H L):
if aj > H:
aj = H
if L > aj:
aj = L
return aj
def smoSimple(dataMatIn classLabels C toler maxIter):
dataMatrix = mat(dataMatIn);
labelMat = mat(classLabels).transpose()
b = 0;
m n = shape(dataMatrix)
alphas = mat(zeros((m 1)))
iter = 0
while (iter < maxIter):
alphaPairsChanged = 0
for i in range(m):
fXi = float(multiply(alphas labelMat).T * (dataMatrix * dataMatrix[i :].T)) + b
Ei = fXi - float(labelMat[i]) # if checks if an example violates KKT conditions
if ((labelMat[i] * Ei < -toler) and (alphas[i] < C)) or ((labelMat[i] * Ei > toler) and (alphas[i] > 0)):
j = selectJrand(i m)
fXj = float(multiply(alphas labelMat).T * (dataMatrix * dataMatrix[j :].T)) + b
Ej = fXj - float(labelMat[j])
alphaIold = alphas[i].copy();
alphaJold = alphas[j].copy();
if (labelMat[i] != labelMat[j]):
L = max(0 alphas[j] - alphas[i])
H = min(C C + alphas[j] - alphas[i])
else:
L = max(0 alphas[j] + alphas[i] - C)
H = min(C alphas[j] + alphas[i])
if L == H: print (“L==H“); continue
eta = 2.0 * dataMatrix[i :] * dataMatrix[j :].T - dataMatrix[i :] * dataMatrix[i :].T - dataMatrix[
j
:] * dataMatrix[
j :].T
if eta >= 0: print (“eta>=0“); continue
alphas[j] -= labelMat[j] * (Ei - Ej) / eta
alphas[j] = clipAlpha(alphas[j] H L)
if (abs(alphas[j] - alphaJold) < 0.00001): print (“j not moving enough“); continue
alphas[i] += labelMat[j] * labelMat[i] * (alphaJold - alphas[j]) # update i by the same amount as j
# the update is in the oppostie direction
b1 = b - Ei
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4571 2019-03-25 13:49 支持向量机(线性核函数、非线性核函数、手写数字识别)\IRIS_dataset.txt
文件 17857 2019-03-28 10:39 支持向量机(线性核函数、非线性核函数、手写数字识别)\SVM-01_.py
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_0.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_1.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_10.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_11.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_12.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_13.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_14.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_15.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_16.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_17.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_18.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_19.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_2.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_20.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_21.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_22.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_23.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_24.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_25.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_26.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_27.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_28.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_29.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_3.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_30.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_31.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_32.txt
文件 1088 2010-10-07 05:35 支持向量机(线性核函数、非线性核函数、手写数字识别)\testDigits\1_33.txt
............此处省略571个文件信息
相关资源
- 支持向量机的船舶目标识别
- 果蝇算法融合SVM的开采沉陷预测模型
- 台湾林教授的支持向量机libsvm
- 7种支持向量机SVM工具包
- libSVM的代码详细解析,注释非常详细
- 论文研究 - 基于协同过滤和人工神经
- 新冒落带高度算法FOA-SVM预计模型
- 官方最新版本libsvm-3.23
- 论文研究-基于优化支持向量机的人脸
- opencv自带SVM分类器使用程序
- 遗传算法优化支持向量机算法
- 支持向量机回归算法的研究与应用
- SVM-支持向量机基本原理及应用
- 支持向量机导论PDF 作者:Nello
- 《《数据挖掘中的新方法-支持向量机
- 数据挖掘中的新方法:支持向量机.
- 支持向量机导论英文版
- 浙江大学SVM(支持向量机)经典课件
- 支持向量机导论+中文版-英文版
- 最小二乘支持向量机工具箱使用指南
- 支持向量机导论中文版PDF
- 支持向量机核函数方面外文文献
- 支持向量机 邓乃扬
- 支持向量机导论(中文).pdf
- 支持向量机导论中文版-国外经典教材
- 官方权威最小二乘支持向量机(LS-S
- 小波特征提取与支持向量机识别
- 支持向量机在金融领域的应用
- 支持向量机故障诊断及控制技术 mat
- SVM 支持向量机相关学习资料合集
评论
共有 条评论