资源简介
分类器设计之线性分类器和线性SVM(Matlab代码
具休请参考本人博客:
http://blog.csdn.net/ranchlai/article/details/10303031

代码片段和文件信息
%
% Liscense Notification 2013
%
% Redistributions in source and binary forms with or without
% modification are totally FREE provided that you keep this keep this
% notification
%
% Descritption: This package demonstrates how to use the logistic
% regression for classfication of 2D data.
% Author: Ranch Lai (ranchlai@hotmail.com)
% Release date: Aug 17 2013
%/
%%
clc;
clear;
close all;
%% generate random data
shift = 3;
n = 200;
m=200;
d = 2;
sigma = 1;
x = randn(dn)-shift;
y = randn(dm)*sigma+shift;
%%
%show the data
figure;
plot(x(1:)x(2:)‘rs‘);
hold on;
plot(y(1:)y(2:)‘go‘);
%title(‘2d training data‘);
legend(‘Positive samples‘‘Negative samples‘);
%%
%training..
for i=1:n
A(i:) = [-x(:i)‘-1];
end
for i=1:m
A(i+n:) = [y(:i)‘1];
end
c = ones(n+m1)*(-1);
w = linprog(zeros(d+11)Ac);
hold on;
%% visualize the classification aera
x1 = -shift-2:0.1:shift+2*sigma;
y1 = (-w(3)-w(1)*x1)/w(2);
plot(x1y1‘-‘‘LineWidth‘2);
legend(‘Positive samples‘‘Negative samples‘‘Linear programming‘);
%% svm
H = eye(d+1);
H(d+1d+1) = 0;
w = quadprog(Hzeros(d+11)Ac);
hold on;
x1 = -shift-2:0.1:shift+2*sigma;
y1 = (-w(3)-w(1)*x1)/w(2);
plot(x1y1‘g-‘‘LineWidth‘2);
y1 = (-1-w(3)-w(1)*x1)/w(2);
plot(x1y1‘g-‘‘LineWidth‘2);
y1 = (1-w(3)-w(1)*x1)/w(2);
plot(x1y1‘g-‘‘LineWidth‘2);
legend(‘Positive samples‘‘Negative samples‘‘Linear programming‘‘Linear SVM‘);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-08-25 17:41 linear programming and svm\
文件 1435 2013-08-25 16:03 linear programming and svm\demo_lp_svm.m
目录 0 2013-08-25 14:40 linear programming and svm\figure\
目录 0 2013-08-25 14:47 linear programming and svm\figure\shift=3\
文件 12140 2013-08-25 14:47 linear programming and svm\figure\shift=3\all.png
文件 9077 2013-08-25 14:47 linear programming and svm\figure\shift=3\data.png
文件 10087 2013-08-25 14:47 linear programming and svm\figure\shift=3\lp.png
相关资源
- 非线性SVM算法-matlab实现
- SVM工具箱(matlab中运行)
- matlab版的车牌识别程序
- SVM的回归预测分析——上证指数开盘
- 印章识别matlab代码
- ibsvm-3.21
- 贝叶斯分类器Matlab实现113478
- 果蝇参数寻优FOA-LSSVM的完整程序
- 利用WOA算法优化libsvm中SVDD算法的参数
- svm支持向量机与nbc朴素贝叶斯算法比
- SVM的matlab代码
- 混凝土抗压强度预测_SVM_Matlab_归一_
- 基于SVM的回归预测分析
- libsvm数据格式转换程序
- 基于SVM的matlab车牌识别
- 基于MATLAB的柑橘果实分类图像朴素贝
- hog+svm图像二分类
- matlab求解最优化线性规划问题代码以
- 基于PCA和SVM的人脸识别.zip
- 《MATLAB 神经网络30个案例分析》所有
- SVM分类与回归的matlab代码
- 基于LABVIEW和MATLAB混合编程障碍物识别
- svm 支持向量机 回归 预测
- libsvm - 支持多类别分类的svm工具箱m
- 经典SVM算法的MATLAB程序
- 蚁群优化SVM系数
- bayes分类器完整版代码
- SVM-KM Matlab源程序
- 模式识别课程作业 基于svm的人脸识别
- MATLAB的SVM安装包drtoolbox_libsvm-3.17
评论
共有 条评论