亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? example43_run_a.m

?? 神經網絡VC++代碼 人工神經網絡原理及仿真實例.
?? M
?? 第 1 頁 / 共 5 頁
字號:
%svm3
%%===============
%%===============
%  run_a

function demsvm1()

% 

X = [2 7; 3 6; 2 2; 8 1; 6 4; 4 8; 9 5; 9 9; 9 4; 6 9; 7 4];
Y = [ +1;  +1;  +1;  +1;  +1;  -1;  -1;  -1;  -1;  -1;  -1];
% define a simple artificial data set

x1ran = [0 10];
x2ran = [0 10];
% range for plotting the data set and the decision boundary

% disp(' ');
% disp('This demonstration illustrates the use of a Support Vector Machine');
% disp('(SVM) for classification. The data is a set of 2D points, together');
% disp('with target values (class labels) +1 or -1.');
% disp(' ');
% disp('The data set consists of the points');

ind = [1:length(Y)]';
% fprintf('X%2i = (%2i, %2i) with label Y%2i = %2i\n', [ind, X, ind, Y]');
% disp(' ')
% disp('Press any key to plot the data set');
%  
% pause
% 
% f1 = figure;
% plotdata(X, Y, x1ran, x2ran);
% title('Data from class +1 (squares) and class -1 (crosses)');

% fprintf('\n\n\n\n');
% fprintf('The data is plotted in figure %i, where\n', f1);
% disp('  squares stand for points with label Yi = +1');
% disp('  crosses stand for points with label Yi = -1');
% disp(' ')
% disp(' ');
% disp('Now we train a Support Vector Machine classifier on this data set.');
% disp('We use the most simple kernel function, namely the inner product');
% disp('of points Xi, Xj (linear kernel K(Xi,Xj) = Xi''*Xj )');
% disp(' ');
% disp('Press any key to start training')
%  pause

net = svm(size(X, 2), 'linear', [], 10);
net = svmtrain(net, X, Y);

f1 = figure;
plotboundary(net, x1ran, x2ran);
plotdata(X, Y, x1ran, x2ran);
plotsv(net, X, Y);
title(['SVM with linear kernel: decision boundary (black) plus Support' ...
       ' Vectors (red)']);

% fprintf('\n\n\n\n');
% fprintf('The resulting decision boundary is plotted in figure %i.\n', f2);
% disp('The contour plotted in black separates class +1 from class -1');
% disp('(this is the actual decision boundary)');
% disp('The contour plotted in red are the points at distance +1 from the');
% disp('decision boundary, the blue contour are the points at distance -1.');
% disp(' ');
% disp('All examples plotted in red are found to be Support Vectors.');
% disp('Support Vectors are the examples at distance +1 or -1 from the ');
% disp('decision boundary and all the examples that cannot be classified');
% disp('correctly.');
% disp(' ');
% disp('The data set shown can be correctly classified using a linear');
% disp('kernel. This can be seen from the coefficients alpha associated');
% disp('with each example: The coefficients are');
ind = [1:length(Y)]';
% fprintf('  Example %2i: alpha%2i = %5.2f\n', [ind, ind, net.alpha]');
% disp('The upper bound C for the coefficients has been set to');
% fprintf('C = %5.2f. None of the coefficients are at the bound,\n', ...
% 	net.c(1));
% disp('this means that all examples in the training set can be correctly');
% disp('classified by the SVM.')
% disp(' ');
% disp('Press any key to continue')
%  pause

% X = [X; [4 4]];
% Y = [Y; -1];
% net = svm(size(X, 2), 'linear', [], 10);
% net = svmtrain(net, X, Y);
% 
% f3 = figure;
% plotboundary(net, x1ran, x2ran);
% plotdata(X, Y, x1ran, x2ran);
% plotsv(net, X, Y);
% title(['SVM with linear kernel: decision boundary (black) plus Support' ...
%        ' Vectors (red)']);
% 
% % fprintf('\n\n\n\n');
% % disp('Adding an additional point X12 with label -1 gives a data set');
% % disp('that can not be linearly separated. The SVM handles this case by');
% % disp('allowing training points to be misclassified.');
% % disp(' ');
% % disp('Training the SVM on this modified data set we see that the points');
% % disp('X5, X11 and X12 can not be correctly classified. The decision');
% % fprintf('boundary is shown in figure %i.\n', f3);
% % disp('The coefficients alpha associated with each example are');
% ind = [1:length(Y)]';
% % fprintf('  Example %2i: alpha%2i = %5.2f\n', [ind, ind, net.alpha]');
% % disp('The coefficients of the misclassified points are at the upper');
% % disp('bound C.');
% % disp(' ')
% % disp('Press any key to continue')
%  pause
% 
% 
% % fprintf('\n\n\n\n');
% % disp('Adding the new point X12 has lead to a more difficult data set');
% % disp('that can no longer be separated by a simple linear kernel.');
% % disp('We can now switch to a more powerful kernel function, namely');
% % disp('the Radial Basis Function (RBF) kernel.');
% % disp(' ')
% % disp('The RBF kernel has an associated parameter, the kernel width.');
% % disp('We will now show the decision boundary obtained from a SVM with');
% % disp('RBF kernel for 3 different values of the kernel width.');
% % disp(' ');
% % disp('Press any key to continue')
% pause
% 
% net = svm(size(X, 2), 'rbf', [8], 100);
% net = svmtrain(net, X, Y);
% 
% f4 = figure;
% plotboundary(net, x1ran, x2ran);
% plotdata(X, Y, x1ran, x2ran);
% plotsv(net, X, Y);
% title(['SVM with RBF kernel, width 8: decision boundary (black)' ...
%        ' plus Support Vectors (red)']); 
% 
% % fprintf('\n\n\n\n');
% % fprintf('Figure %i shows the decision boundary obtained from a SVM\n', ...
% % 	f4);
% % disp('with Radial Basis Function kernel, the kernel width has been');
% % disp('set to 8.');
% % disp('The SVM now interprets the new point X12 as evidence for a');
% % disp('cluster of points from class -1, the SVM builds a small ''island''');
% % disp('around X12.');
% % disp(' ')
% % disp('Press any key to continue')
% pause
% 
% 
% net = svm(size(X, 2), 'rbf', [1], 100);
% net = svmtrain(net, X, Y);
% 
% f5 = figure;
% plotboundary(net, x1ran, x2ran);
% plotdata(X, Y, x1ran, x2ran);
% plotsv(net, X, Y);
% title(['SVM with RBF kernel, width 1: decision boundary (black)' ...
%        ' plus Support Vectors (red)']); 
% 
% % fprintf('\n\n\n\n');
% % fprintf('Figure %i shows the decision boundary obtained from a SVM\n', ...
% % 	f5);
% % disp('with radial basis function kernel, kernel width 1.');
% % disp('The decision boundary is now highly shattered, since a smaller');
% % disp('kernel width allows the decision boundary to be more curved.');
% % disp(' ')
% % disp('Press any key to continue')
% pause
% 
% 
% net = svm(size(X, 2), 'rbf', [36], 100);
% net = svmtrain(net, X, Y);
% 
% f6 = figure;
% plotboundary(net, x1ran, x2ran);
% plotdata(X, Y, x1ran, x2ran);
% plotsv(net, X, Y);
% title(['SVM with RBF kernel, width 36: decision boundary (black)' ...
%        ' plus Support Vectors (red)']); 
% 
% % fprintf('\n\n\n\n');
% % fprintf('Figure %i shows the decision boundary obtained from a SVM\n', ...
% % 	f6);
% % disp('with radial basis function kernel, kernel width 36.');
% % disp('This gives a decision boundary similar to the one shown in');
% % fprintf('Figure %i for the SVM with linear kernel.\n', f2);
% % 
% % 
% % fprintf('\n\n\n\n');
% % disp('Press any key to end the demo')
% pause



function plotdata(X, Y, x1ran, x2ran)
% PLOTDATA - Plot 2D data set
% 

hold on;
ind = find(Y>0);
plot(X(ind,1), X(ind,2), 'ks');
ind = find(Y<0);
plot(X(ind,1), X(ind,2), 'kx');
text(X(:,1)+.2,X(:,2), int2str([1:length(Y)]'));
axis([x1ran x2ran]);
axis xy;


function plotsv(net, X, Y)
% PLOTSV - Plot Support Vectors
% 

hold on;
ind = find(Y(net.svind)>0);
plot(X(net.svind(ind),1),X(net.svind(ind),2),'rs');
ind = find(Y(net.svind)<0);
plot(X(net.svind(ind),1),X(net.svind(ind),2),'rx');


function [x11, x22, x1x2out] = plotboundary(net, x1ran, x2ran)
% PLOTBOUNDARY - Plot SVM decision boundary on range X1RAN and X2RAN
% 

hold on;
nbpoints = 100;
x1 = x1ran(1):(x1ran(2)-x1ran(1))/nbpoints:x1ran(2);
x2 = x2ran(1):(x2ran(2)-x2ran(1))/nbpoints:x2ran(2);
[x11, x22] = meshgrid(x1, x2);
[dummy, x1x2out] = svmfwd(net, [x11(:),x22(:)]);
x1x2out = reshape(x1x2out, [length(x1) length(x2)]);
contour(x11, x22, x1x2out, [-0.99 -0.99], 'b-');
contour(x11, x22, x1x2out, [0 0], 'k-');
contour(x11, x22, x1x2out, [0.99 0.99], 'g-');

function net = svmtrain(net, X, Y, alpha0, dodisplay)

% Check arguments for consistency
errstring = consist(net, 'svm', X, Y);
if ~isempty(errstring);
  error(errstring);
end
[N, d] = size(X);
if N==0,
  error('No training examples given');
end
net.nbexamples = N;
if nargin<5,
  dodisplay = 0;
end
if nargin<4,
  alpha0 = [];
elseif (~isempty(alpha0)) & (~all(size(alpha0)==[N 1])),
  error(['Initial values ALPHA0 must be a column vector with the same length' ...
	 ' as X']); 
end

% Find the indices of examples from class +1 and -1
class1 = logical(uint8(Y>=0));
class0 = logical(uint8(Y<0));

if length(net.c(:))==1,
  C = repmat(net.c, [N 1]);
  % The same upper bound for all examples
elseif length(net.c(:))==2,
  C = zeros([N 1]);
  C(class1) = net.c(1);
  C(class0) = net.c(2);
  % Different upper bounds C for the positive and negative examples
else
  C = net.c;
  if ~all(size(C)==[N 1]),
    error(['Upper bound C must be a column vector with the same length' ...
	   ' as X']); 
  end
end
if min(C)<net.alphatol,
  error('NET.C must be positive and larger than NET.alphatol');
end

if ~isfield(net, 'use2norm'),
  net.use2norm = 0;
end

if ~isfield(net, 'qpsolver'),
  net.qpsolver = '';
end
qpsolver = net.qpsolver;
if isempty(qpsolver),
  % QUADPROG is the fastest solver for both 1norm and 2norm SVMs, if
  % qpsize is around 10-70 (loqo is best for large 1norm SVMs)
  checkseq = {'quadprog', 'loqo', 'qp'};
  i = 1;
  while (i <= length(checkseq)),
    e = exist(checkseq{i});
    if (e==2) | (e==3),
      qpsolver = checkseq{i};
      break;
    end
    i = i+1;
  end
  if isempty(qpsolver),
    error('No quadratic programming solver (QUADPROG,LOQO,QP) found.');
  end
end
% Mind that there may occur problems with the QUADPROG solver. At least in
% early versions of Matlab 5.3 there are severe numerical problems somewhere
% deep in QUADPROG

% Turn off all messages coming from quadprog, increase the maximum number
% of iterations from 200 to 500 - good for low-dimensional problems
if strcmp(qpsolver, 'quadprog') & (dodisplay==0),
  quadprogopt = optimset('Display', 'off', 'MaxIter', 500);
else
  quadprogopt = [];
end

% Actual size of quadratic program during training may not be larger than
% the number of examples
QPsize = min(N, net.qpsize);
chsize = net.chunksize;

% SVMout contains the output of the SVM decision function for each
% example. This is updated iteratively during training.
SVMout = zeros(N, 1);

% Make sure there are no other values in Y than +1 and -1
Y(class1) = 1;
Y(class0) = -1;
if dodisplay>0,
  fprintf('Training set: %i examples (%i positive, %i negative)\n', ...
	  length(Y), length(find(class1)), length(find(class0)));
end

% Start with a vector of zeros for the coefficients alpha, or the
% parameter ALPHA0, if it is given. Those values will be used to perform
% an initial working set selection, by assuming they are the true weights
% for the training set at hand.
if ~any(alpha0),
  net.alpha = zeros([N 1]);
  % If starting with a zero vector: randomize the first working set search
  randomWS = 1;
else
  randomWS = 0;
  % for 1norm SVM: make the initial values conform to the upper bounds
  if ~net.use2norm,
    net.alpha = min(C, alpha0);
  end
end
alphaOld = net.alpha;

if length(find(Y>0))==N,
  % only positive examples
  net.bias = 1;
  net.svcoeff = [];
  net.sv = [];
  net.svind = [];
  net.alpha = zeros([N 1]);
  return;
elseif length(find(Y<0))==N,
  % only negative examples
  net.bias = 1;
  net.svcoeff = [];
  net.sv = [];
  net.svind = [];
  net.alpha = zeros([N 1]);
  return;
end

iteration = 0;
workset = logical(uint8(zeros(N, 1)));
sameWS = 0;
net.bias = 0;

while 1,

  if dodisplay>0,
    fprintf('\nIteration %i: ', iteration+1);
  end

  % Step 1: Determine the Support Vectors.
  [net, SVthresh, SV, SVbound, SVnonbound] = findSV(net, C);
  if dodisplay>0,
    fprintf(['Working set of size %i: %i Support Vectors, %i of them at' ...
	     ' bound C\n'], length(find(workset)), length(find(workset & SV)), ...
	    length(find(workset & SVbound))); 
    fprintf(['Whole training set: %i Support Vectors, %i of them at upper' ...
	     ' bound C.\n'], length(net.svind), length(find(SVbound)));
    if dodisplay>1,
      fprintf('The Support Vectors (threshold %g) are the examples\n', ...
	      SVthresh);
      fprintf(' %i', net.svind);
      fprintf('\n');
    end
  end

  
  % Step 2: Find the output of the SVM for all training examples
  if (iteration==0) | (mod(iteration, net.recompute)==0),
    % Every NET.recompute iterations the SVM output is built from
    % scratch. Use all Support Vectors for determining the output.
    changedSV = net.svind;
    changedAlpha = net.alpha(changedSV);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲女子a中天字幕| 久久亚洲一区二区三区明星换脸 | 久久人人爽人人爽| 91在线porny国产在线看| 亚洲aⅴ怡春院| 亚洲欧美在线aaa| 日韩免费视频一区二区| 99热这里都是精品| 九色porny丨国产精品| 亚洲综合丝袜美腿| 国产欧美日韩激情| 精品av综合导航| 4438亚洲最大| 欧美日韩成人在线一区| 99riav一区二区三区| 国产精品99久久久久久似苏梦涵 | 天天射综合影视| 一区二区三区在线影院| 国产精品欧美一区二区三区| 久久综合久久综合久久综合| 777a∨成人精品桃花网| 色婷婷综合久久久| 色播五月激情综合网| jiyouzz国产精品久久| 不卡免费追剧大全电视剧网站| 久久国产综合精品| 国产一区二区三区av电影| 国产一区二区精品在线观看| 七七婷婷婷婷精品国产| 精久久久久久久久久久| 韩国女主播一区| 成人手机在线视频| 91丨九色丨国产丨porny| 欧美影院一区二区| 欧美区视频在线观看| 91精品国产手机| 久久蜜桃av一区精品变态类天堂 | 亚洲自拍欧美精品| 91精品国产综合久久小美女| 亚洲不卡一区二区三区| 亚洲人成网站影音先锋播放| 亚洲乱码国产乱码精品精98午夜| 亚洲欧美日韩一区二区三区在线观看 | 欧美另类高清zo欧美| 日韩欧美一级精品久久| 国产精品久线观看视频| 一卡二卡三卡日韩欧美| 蜜臀精品一区二区三区在线观看 | 日韩制服丝袜av| 国产福利一区二区三区视频| 色呦呦一区二区三区| 51精品视频一区二区三区| 欧美一区二区视频在线观看2022| 国产视频在线观看一区二区三区| 一区二区三区四区国产精品| 日本vs亚洲vs韩国一区三区| 成人av电影在线观看| 日韩一卡二卡三卡| 亚洲激情自拍视频| 不卡电影免费在线播放一区| 日韩一级黄色片| 亚洲国产欧美一区二区三区丁香婷| 黄页视频在线91| 欧美日韩精品二区第二页| 亚洲欧美中日韩| 国产成人午夜精品5599| 日韩一区二区免费在线观看| 亚洲欧美国产三级| 99久久精品国产一区二区三区 | 在线综合视频播放| 午夜精品免费在线| 欧美性大战久久久久久久蜜臀| 国产欧美一区二区在线观看| 精品综合久久久久久8888| 日韩午夜激情免费电影| 日日摸夜夜添夜夜添亚洲女人| 91国偷自产一区二区开放时间| 中文字幕日韩av资源站| 成人激情综合网站| 中文字幕在线观看一区二区| 国产成人免费视| 亚洲精品视频在线看| 日本福利一区二区| 亚洲成av人片在www色猫咪| 91麻豆精品国产91久久久久久| 五月婷婷久久丁香| 欧美刺激午夜性久久久久久久| 美女视频第一区二区三区免费观看网站| 欧美精品乱码久久久久久 | 久久成人免费网| 久久五月婷婷丁香社区| 99视频国产精品| 五月婷婷久久丁香| 国产三级欧美三级日产三级99| 不卡av免费在线观看| 五月婷婷激情综合| 国产女主播在线一区二区| 91国内精品野花午夜精品| 久久精品久久久精品美女| 国产欧美日韩视频一区二区| 色综合久久天天综合网| 蜜臀av一区二区| 亚洲色图欧美在线| 亚洲精品在线观看网站| 欧美在线三级电影| 国产成人综合视频| 日本亚洲免费观看| 亚洲乱码精品一二三四区日韩在线| 777午夜精品视频在线播放| 成年人网站91| 国产乱码精品一区二区三| 亚洲午夜一区二区| 欧美精选午夜久久久乱码6080| 五月婷婷综合激情| 久久精品视频免费| 欧美一三区三区四区免费在线看| aaa亚洲精品一二三区| 麻豆成人在线观看| 日韩精品国产精品| 亚洲不卡av一区二区三区| ●精品国产综合乱码久久久久| 日韩精品一区二区三区中文不卡| 欧美日韩一级黄| 色综合中文字幕| 91欧美激情一区二区三区成人| 岛国av在线一区| 国模一区二区三区白浆| 麻豆国产精品777777在线| 午夜精品久久久| 免费亚洲电影在线| 国产一区二区免费看| 国产一区二区三区av电影| 福利一区二区在线观看| 国产+成+人+亚洲欧洲自线| 成人avav影音| 91国偷自产一区二区开放时间 | 国产精品久久久久久久久快鸭| 欧美国产乱子伦| 亚洲综合色婷婷| 蜜桃精品视频在线观看| 韩国三级电影一区二区| 国产乱码精品一区二区三区忘忧草| 久久99在线观看| 成人av在线资源网站| 91成人在线免费观看| 欧美一区二区观看视频| 久久久久久久综合色一本| 国产精品久久久久9999吃药| 亚洲线精品一区二区三区| 韩国三级电影一区二区| 91啪亚洲精品| 国产欧美一区二区三区在线看蜜臀 | 亚洲一区精品在线| 激情图片小说一区| 欧美亚洲禁片免费| 中文字幕免费观看一区| 日本大胆欧美人术艺术动态| 成人午夜av电影| 欧美成人福利视频| 亚洲韩国精品一区| 丁香婷婷综合五月| 精品国产一区二区国模嫣然| 亚洲精品国产一区二区精华液 | 亚洲综合成人在线视频| 国产精品91一区二区| 91精品视频网| 亚洲黄色片在线观看| 国产精品一线二线三线| 欧美草草影院在线视频| 亚洲chinese男男1069| 91蜜桃免费观看视频| 中文字幕免费不卡| 国产精品自在在线| 欧美精品一区二区三区蜜臀| 琪琪一区二区三区| 日韩欧美国产一区在线观看| 三级久久三级久久| 欧美特级限制片免费在线观看| 亚洲视频在线一区观看| 成人h动漫精品一区二| 国产日产精品一区| gogogo免费视频观看亚洲一| 亚洲国产成人自拍| 成人av免费在线播放| 亚洲精品高清在线| 欧美日本在线看| 久久精品国产精品青草| 国产日韩欧美电影| 成人av影视在线观看| 亚洲三级在线免费| 欧美三级中文字幕在线观看| 日韩高清电影一区| 国产亚洲欧美一区在线观看| 成人国产精品免费网站| 午夜一区二区三区视频| 精品国产露脸精彩对白| 99久久精品一区二区| 午夜a成v人精品| 国产日韩欧美亚洲| 日韩av网站免费在线|