A list,

Ii. Source code

clear all; clc ; Sh = xlsread(sh = xlsread('data.xlsx'.'Sheet1'.'B2:B38');
addpath('./libsvm-3.20'); Extract data [m,n] = size(sh); n1 = round(length(sh)*0.7); % ts = sh(1:n1,1); % Training data TSX = sh(n1+1:m,1); % Test data Original = sh(n1+1:end,:); % Raw test data % normalized processing [TS,TSps] = mapMinmax (TS); [TSX,TSXps] = mapminmax(tsx); [TSX_zong,TSXps_zong] = mapminmax(sh); %split the data into trainingand testing

train_label = TS(1:n1,:); % train_data = TS(1:n1,:); Test_label = TSX(test_label = TSX)1:end,:); % test_data = TSX(1:end,:); % test data test_label_ZONG = TSX_zong(1:end,:); % test data tag test_data_ZONG = TSX_zong(1:end,:); % Find the optimize value of C, G paramter % Approximately choose the parameters: % The scale of C is2^ (- 5),2^ (4 -),... .2^ (10)
% the scale of g is 2^ (- 5),2^ (4 -),... .2^ (5)
[bestmse,bestc,bestg] = svmregress(train_label,train_label,- 5.10.- 5.5.3.1.1.0.0005);

% Display the approximate result
disp('Display the approximate result');
str = sprintf( 'Best Cross Validation MSE = %g Best c = %g Best g = %g',bestmse,bestc,bestg);
disp(str);
%Do training by using svmtrain of libsvm
cmd = ['-c ', num2str(bestc), ' -g ', num2str(bestg) , '-s 3 -p 0.01']; model = svmtrain(train_label,train_data,cmd); % training %Do predicting byusingsvmpredict of libsvm clear all; clc ; Sh = xlsread(sh = xlsread('data.xlsx'.'Sheet1'.'B2:B38');
addpath('./libsvm-3.20'); Extract data [m,n] = size(sh); n1 = round(length(sh)*0.7); % ts = sh(1:n1,1); % Training data TSX = sh(n1+1:m,1); % Test data Original = sh(n1+1:end,:); % Raw test data % normalized processing [TS,TSps] = mapMinmax (TS); [TSX,TSXps] = mapminmax(tsx); [TSX_zong,TSXps_zong] = mapminmax(sh); %split the data into trainingand testing

train_label = TS(1:n1,:); % train_data = TS(1:n1,:); Test_label = TSX(test_label = TSX)1:end,:); % test_data = TSX(1:end,:); % test data test_label_ZONG = TSX_zong(1:end,:); % test data tag test_data_ZONG = TSX_zong(1:end,:); % Find the optimize value of C, G paramter % Approximately choose the parameters: % The scale of C is2^ (- 5),2^ (4 -),... .2^ (10)
% the scale of g is 2^ (- 5),2^ (4 -),... .2^ (5)
[bestmse,bestc,bestg] = svmregress(train_label,train_label,- 5.10.- 5.5.3.1.1.0.0005);

% Display the approximate result
disp('Display the approximate result');
str = sprintf( 'Best Cross Validation MSE = %g Best c = %g Best g = %g',bestmse,bestc,bestg);
disp(str);
%Do training by using svmtrain of libsvm
cmd = ['-c ', num2str(bestc), ' -g ', num2str(bestg) , '-s 3 -p 0.01']; model = svmtrain(train_label,train_data,cmd); % training %Do predicting byusing svmpredict of libsvm
Copy the code

3. Operation results

Fourth, note

Version: 2014 a