A list,
Support Vector Machine (SVM) was first proposed by Cortes and Vapnik in 1995. It shows many unique advantages in solving small sample size, nonlinear and high-dimensional pattern recognition, and can be generalized to other Machine learning problems such as function fitting.
1. Mathematics
1.1 Two-dimensional Space
2 algorithm Part
Ii. Source code
clc;
clear
C = 30;
theta = 2; %C is the regularization parameter of the least squares support vector machine, theta is the kernel function parameter of the Gaussian radial basis, and the two need to be optimized for selection and debugging NumOfPre =1; % Forecast days, in which the forecast for the last seven days of the quarter % is weighted by load1
al = 2; % temperature weighted be =1; % humidity weighted th =1; % week weighted Time =48;
Data = xlsread('input.xls'); % This is the command to read Data from an Excel table, which means to read Data from the table into the Data array, omit the first row of the table, the first column of text can be entered you want to predict the name of the table Data = Data(2:end,:); [M,N] = size(Data); M row N column Data1 = Data;for i = 1:2maxData = max(Data(:,i)); minData = min(Data(:,i)); Data1(:,i) = (Data(:,i) - minData)/(maxData-minData); % To normalize the temperature endfor i = 4:N
Data1(:,i) = log10(Data(:,i)) ; % Load logarithmic processing temperature and load pretreatment can adopt different methods can not stick to end Dim = M -2- NumOfPre; % Number of training samples % Total data with complete feature description M2 -Group!!!!! Input = zeros(M,8,Time); % Preallocates the processed input vector space %8Is the dimension of the feature space! Also the number of elements of x!! y = zeros(Dim,Time);for i = 3:M
for j = 1:Time %% Select the temperature of the previous day, the load at the same Time, the load of the previous two days, and the temperature of the current day as the input characteristics x = [Data1(I- 1.1:3), Data1(i- 1,j+3), Data1(i2 -,j+3),Data1(i,1:3)]; %x is the eigenvector corresponding to each load!! x(1)=al*x(1);
x(6)=al*x(6);
x(2)=be*x(2);
x(7)=be*x(7);
x(3)=th*x(3);
x(8)=th*x(8);
Input(i2 -,:,j) = x; %Input(I, :,k) means: the characteristic vector y(I) corresponding to the load at the JTH moment on day I2 -,j) = Data1(i,j+3); end end Dist = zeros(Dim,Dim,Time); % preallocates distance spacefor i=1:Time
for j=1:Dim
for k=1:Dim
Dist(j,k,i) = (Input(j,:,i) - Input(k,:,i))*(Input(j,:,i) - Input(k,:,i))'; end end endCopy the code
3. Operation results
Fourth, note
Version: 2014 a