文档库 最新最全的文档下载
当前位置:文档库 › 一种基于SVM特征选择的油气预测方法

一种基于SVM特征选择的油气预测方法

一种基于SVM特征选择的油气预测方法
一种基于SVM特征选择的油气预测方法

SVM神经网络的回归预测分析---上证指数开盘指数预测

SVM神经网络的回归预测分析---上证指数开盘指数预测 该案例作者申明: 1:本人长期驻扎在此板块里,对该案例提问,做到有问必答。 2:此案例有配套的教学视频,配套的完整可运行Matlab程序。 3:以下内容为该案例的部分内容(约占该案例完整内容的1/10)。 4:此案例为原创案例,转载请注明出处(Matlab中文论坛,《Matlab神经网络30个案例分析》)。 5:若此案例碰巧与您的研究有关联,我们欢迎您提意见,要求等,我们考虑后可以加在案例里。 6:您看到的以下内容为初稿,书籍的实际内容可能有少许出入,以书籍实际发行内容为准。 7:此书其他常见问题、预定方式等,请点击这里。 Contents ●清空环境变量 ●数据的提取和预处理 ●选择回归预测分析最佳的SVM参数c&g ●利用回归预测分析最佳的参数进行SVM网络训练 ●SVM网络回归预测 ●结果分析 ●子函数 SVMcgForRegress.m 清空环境变量 function chapter14 tic; close all; clear; clc; format compact; 数据的提取和预处理 % 载入测试数据上证指数(1990.12.19-2009.08.19) % 数据是一个4579*6的double型的矩阵,每一行表示每一天的上证指数 % 6列分别表示当天上证指数的开盘指数,指数最高值,指数最低值,收盘指数,当日交易量,当日交易额. load chapter14_sh.mat; % 提取数据 [m,n] = size(sh); ts = sh(2:m,1); tsx = sh(1:m-1,:); % 画出原始上证指数的每日开盘数 figure;

回归预测分析SVM神经网络

回归预测分析S V M神 经网络 Standardization of sany group #QS8QHH-HHGX8Q8-GNHHJ8-HHMHGN#

%%S V M神经网络的回归预测分析---上证指数开盘指数预测 %% 清空环境变量 function chapter14 tic; close all; clear; clc; format compact; %% 数据的提取和预处理 % 数据是一个4579*6的double型的矩阵,每一行表示每一天的上证指数 % 6列分别表示当天上证指数的开盘指数,指数最高值,指数最低值,收盘指数,当日交易量,当日交易额. load ; % 提取数据 [m,n] = size(sh); ts = sh(2:m,1); tsx = sh(1:m-1,:); % 画出原始上证指数的每日开盘数 figure; plot(ts,'LineWidth',2); title(,'FontSize',12); xlabel(,'FontSize',12); ylabel('开盘数','FontSize',12); grid on; % 数据预处理,将原始数据进行归一化 ts = ts'; tsx = tsx'; % mapminmax为matlab自带的映射函数 % 对ts进行归一化 [TS,TSps] = mapminmax(ts,1,2); % 画出原始上证指数的每日开盘数归一化后的图像 figure; plot(TS,'LineWidth',2); title('原始上证指数的每日开盘数归一化后的图像','FontSize',12); xlabel(,'FontSize',12); ylabel('归一化后的开盘数','FontSize',12); grid on; % 对TS进行转置,以符合libsvm工具箱的数据格式要求 TS = TS'; % mapminmax为matlab自带的映射函数 % 对tsx进行归一化 [TSX,TSXps] = mapminmax(tsx,1,2); % 对TSX进行转置,以符合libsvm工具箱的数据格式要求

回归预测分析---SVM神经网络

%% SVM神经网络的回归预测分析---上证指数开盘指数预测 %% 清空环境变量 function chapter14 tic; close all; clear; clc; format compact; %% 数据的提取和预处理 % 载入测试数据上证指数(1990.12.19-2009.08.19) % 数据是一个4579*6的double型的矩阵,每一行表示每一天的上证指数 % 6列分别表示当天上证指数的开盘指数,指数最高值,指数最低值,收盘指数,当日交易量,当日交易额. load chapter14_sh.mat; % 提取数据 [m,n] = size(sh); ts = sh(2:m,1); tsx = sh(1:m-1,:); % 画出原始上证指数的每日开盘数 figure; plot(ts,'LineWidth',2); title('上证指数的每日开盘数(1990.12.20-2009.08.19)','FontSize',12); xlabel('交易日天数(1990.12.19-2009.08.19)','FontSize',12); ylabel('开盘数','FontSize',12); grid on; % 数据预处理,将原始数据进行归一化 ts = ts'; tsx = tsx'; % mapminmax为matlab自带的映射函数 % 对ts进行归一化 [TS,TSps] = mapminmax(ts,1,2); % 画出原始上证指数的每日开盘数归一化后的图像 figure; plot(TS,'LineWidth',2);

title('原始上证指数的每日开盘数归一化后的图像','FontSize',12); xlabel('交易日天数(1990.12.19-2009.08.19)','FontSize',12); ylabel('归一化后的开盘数','FontSize',12); grid on; % 对TS进行转置,以符合libsvm工具箱的数据格式要求 TS = TS'; % mapminmax为matlab自带的映射函数 % 对tsx进行归一化 [TSX,TSXps] = mapminmax(tsx,1,2); % 对TSX进行转置,以符合libsvm工具箱的数据格式要求 TSX = TSX'; %% 选择回归预测分析最佳的SVM参数c&g % 首先进行粗略选择: [bestmse,bestc,bestg] = SVMcgForRegress(TS,TSX,-8,8,-8,8); % 打印粗略选择结果 disp('打印粗略选择结果'); str = sprintf( 'Best Cross Validation MSE = %g Best c = %g Best g = %g',bestmse,bestc,bestg); disp(str); % 根据粗略选择的结果图再进行精细选择: [bestmse,bestc,bestg] = SVMcgForRegress(TS,TSX,-4,4,-4,4,3,0.5,0.5,0.05); % 打印精细选择结果 disp('打印精细选择结果'); str = sprintf( 'Best Cross Validation MSE = %g Best c = %g Best g = %g',bestmse,bestc,bestg); disp(str); %% 利用回归预测分析最佳的参数进行SVM网络训练 cmd = ['-c ', num2str(bestc), ' -g ', num2str(bestg) , ' -s 3 -p 0.01']; model = svmtrain(TS,TSX,cmd); %% SVM网络回归预测 [predict,mse] = svmpredict(TS,TSX,model); predict = mapminmax('reverse',predict',TSps); predict = predict';

SVM神经网络的数据分类预测--葡萄酒种类识别

%% SVM神经网络的数据分类预测----意大利葡萄酒种类识别 % %% 清空环境变量 close all; clear; clc; format compact; %% 数据提取 % 载入测试数据wine,其中包含的数据为classnumber = 3,wine:178*13的矩阵,wine_labes:178*1的列向量 load chapter12_wine.mat; % 画出测试数据的box可视化图 figure; boxplot(wine,'orientation','horizontal','labels',categories); title('wine数据的box可视化图','FontSize',12); xlabel('属性值','FontSize',12); grid on; % 画出测试数据的分维可视化图 figure subplot(3,5,1); hold on for run = 1:178 plot(run,wine_labels(run),'*'); end xlabel('样本','FontSize',10); ylabel('类别标签','FontSize',10); title('class','FontSize',10); for run = 2:14 subplot(3,5,run); hold on; str = ['attrib ',num2str(run-1)]; for i = 1:178 plot(i,wine(i,run-1),'*'); end xlabel('样本','FontSize',10); ylabel('属性值','FontSize',10);

回归预测分析---SVM神经网络

回归预测分析---SVM神经网络

%% SVM神经网络的回归预测分析上证指数开盘指数预测 %%清空环境变量 fun cti on chapter14 tic; ---------------------------- close all ; clear; clc; format compact ; %%数据的提取和预处理 %载入测试数据上证指数(1990.12.19-2009.08.19) %数据是一个4579*6 的double 型的矩阵,每一行表示每一天的上证指数 %6列分别表示当天上证指数的开盘指数,指数最高值,指数最低值,收盘指数易额. load chapter14_sh.mat ; %提取数据 [m,n] = size(sh); ts = sh(2:m,1); tsx = sh(1:m-1,:); %画岀原始上证指数的每日开盘数figure; plot(ts, 'Li neWidth' ,2); title( '上证指数的每日开盘数(1990.12.20-2009.08.19)' , 'FontSize' xlabel( '交易日天数(1990.12.19-2009.08.19)' , 'FontSize' ,12); ylabel( '开盘数','FontSize' ,12); grid on; %数据预处理,将原始数据进行归一化 ts = ts'; tsx = tsx'; % mapminmax 为matlab 自带的映射函数 %对ts进行归一化 [TS,TSps] = mapmi nm ax(ts,1,2); %画岀原始上证指数的每日开盘数归一化后的图像 figure; plot (TS, 'Li neWidth' ,2);当日交易量,当日交,12);

SVM 价格预测

Application of least squares support vector machine in futures price forecasting TianYuan Luo Ling Tian Econmics and Management School Econmics and Management School WuHan University WuHan University WuHan 430072,China WuHan 430072,China Email: tianyuanluo@https://www.wendangku.net/doc/f46108676.html, Email:ltian@https://www.wendangku.net/doc/f46108676.html, XinHua Tang YingHong Dong Department of Information Science and Technology Management School Shandong University of Political Science and Law South-Central University for Nationalities Jinan 250014,China Wuhan 430074,China Email:461832459@https://www.wendangku.net/doc/f46108676.html, Email:dyh4@https://www.wendangku.net/doc/f46108676.html, Abstract—Futures price forecasting based on least squares support vector machine is presented in the paper. In order to improve the prediction performance of least squares support vector machine,the experimental data can be normalized and appropriate parameters are selected by genetic algorithm. Least squares support vector machine is used to create the prediction model for futures price,and BP neural network is used to compare with least squares support vector machine.The experimental data of futures price are given. The prediction error of futures price by least squares support vector machine and BP neural network respectively are obtained.The analysis results show that futures price forecasting based on least squares support vector machine has excellent prediction results of futures price. Keyworks-futures price; least squares support vector machine;forecasting; regression function ?. INTRODUCTION Futures price forecasting based on least squares support vector machine is presented in the paper. Least squares support vector machine is a novel learning method, which is very suitable for regression. In order to improve the prediction performance of least squares support vector machine,the experimental data can be normalized and appropriate parameters are selected by the optimization algorithm,such as genetic algorithm, ant colony optimization algorithm[1-4].In the study, genetic algorithm is used to select the appropriate parameters of least squares support vector machine. Genetic algorithm can gain the optimal solution through a series of iterative computations[5,6]. Least squares support vector machine is used to create the prediction model for futures price,and BP neural network is used to compare with least squares support vector machine.The experimental data of futures price are given,where the first 6 futures price data are used to create the least squares support vector machine model and others are used to test the least squares support vector machine model.The prediction error of futures price by least squares support vector machine and BP neural network respectively are obtained.The analysis results show that futures price forecasting based on least squares support vector machine has excellent prediction results of futures price. ??. LEAST SQUARES SUPPORT VECTOR MACHINE Given a set of data n i i i y x 1 )} , {( =with the input vector i x and the output value i y.The regression function of least squares support vector machine is shown as followings: b x w x f+ ? =) ( ) (φ(1) where w denotes the weight vector and b denotes the bias. Define the objective function of least squares support vector machine: Minimize ? ? o ? ? a+| = n i i o C w 1 2 2 1 (2) Subject to i i i o b x w y? = + ?′1 ) ) ( (φ where C is the penalization parameter. Lagrangian multipliers are introduce to gain the following optimization function: () | | = = ? + + ?? ? o ? ? a+ =n i i i i i n i i o b x w y a o C w U 1 1 21 ] ) ( [ 2 1φ(3) where i a is the Lagrangian multipliers. Then, gain the optimization conditions of the objective function: ___________________________________ 978-1-4244-8679-3/11/$26.00 ?2011 IEEE

基于matlab的svm分类预测实现

2017年第3期信息通信2017 (总第171 期)INFORMATION & COMMUNICATIONS (Sum. No 171)基于matlab的svm分类预测实现 屈玉涛,邓万宇 (西安邮电大学,陕西西安710061) 摘要:支持向量机(英文简称SVM)可以很好地应用在数据分类及预测上,由于SVM在数据挖掘中具有通用性好、有效 性、计算简单、理论完善等优点,所以得到了广泛的应用,文章利用matlab软件,基于S V M实现了对意大利葡萄酒的分 类和预测。 关键词:SVM;分类;预测 中图分类号:TP393 文献标识码:A文章编号:1673-1131(2017)03-0033-02 〇引言 随着数据种类的增多以及数量的增长,人工处理数据已 经变得不太现实。B P神经网络在过去获得了大量的应用,但 由于其具有收敛速度慢,容易陷入局部最小值得缺点,BP神经 网络并不能很好地处理实际中的问题。支持向量机是一种分 类算法,通过最大化不同数据之间边缘距离来提高学习及其 各种方面的能力,能够构建出更为精确的分类模型,另外,也 能够在统计取样较少的情况下,得出较好的统计规律,即,统 计样本少,统计规律良好。 1阐述支持向量机的具体情况 所谓支持向量机是Vapnik以及Corinna Cortes等人于 1995年首先提出的,它的应用范围广泛,较为突出的应用是在 非线性回归以及模式分类等方面。支持向量机的最本质的作 用就是把一个分类的超平面当作为决策曲面,这样就会让正 例以及反例之间的间隔被其最大边缘化。SV M被广泛地应用 在自然语言处理、计算机视觉和机器学习中。 支持向量机优点很多,最突出的表现在下面五个方面,一 是不需要进行微调整,即鲁棒性;二是具有很强的通用性,可 以在各种函数中来集中构造其函数;三是具有非常明显的有 效性,可以解决各种事迹问题,并且非常有效;四是涉及的理 论较为完善,具备V C推广性的理论构架;五是计算较为简单, 能够利用较为简单的优化计算就能够实现计算。 例如:SV M的目标函数如公式(1)所示: r f{x) = w(x} + /)? r".⑴=> :(〇? —〇l )K(x,,x) +b i=1 其中w*代表的是一个d维的向量,b代表的是偏差。输 入数据X的一个非线性的映射。K为核函数,(a rai*)为拉格 朗日乘子,X为输入,Y为输出。 classnumber=3,记录的是类别数目; wine,178*13的一个double型矩阵,记录178个样本的 13个属性; wine lables,178*1的一个double型矩阵,记录178个样本的类标 2.2数据可视化图 wme数据的box可视化图Proline 00280/00315 of diluted v Hue Color intensitys Proanthocyanms Nonflavanoid phenols Flavanoids Total phenols Magnesium Alcalinity of ash Ash Malic acid Alcohol 图i数据的可视化图 3模型的建立 3.1选定训练集与预测集 在这178个样本中,1?59属于第一类,60?130属于 第二类,131?178属于第三类。现将每个类别分成两组,重 新组合数据,分为训练集(train_wine)和测试集(test_wine)。 第一步:将第一类中的1 ^30样本,第二类中660至95 样本,第三类中的131-153样本当做其训练集 代码表示为: trainwine= [wine(l:30,:);wine(60:95,:);wine(131:153,:)]; 第二对其训练集的标签进行分离 2葡萄酒种类识别相关背景 Wine数据的来源是U CI数据库,记录的是意大利同一区 域上三种不同类型葡萄酒的化学成分分析,数据集里含有178 个样本,每个样本含有13个属性,即化学成分,将每个样本的 类别用标签进行标注,并且已经给出相应标签,,然后将178个 样本的一半看做一个训练集,而另一半当做一个测试集,然后 用这个训练集对SV M进行训练,进而得到其分类模型,再用 得到的模型对测试集进行类标签的预测。 2.1对相关数据进行测试 整体数据存储在wine_data,数据可以从U C I数据库中下 载,数据内容为: 代码表示为: trainwinelabels =[wine_labels(l:30);wine_labels(60:95); wine_labels(131:153)]; ^三步:将第一类中的31至59样本,第二类中的96至 130样本,第三类中的154至178样本当做其测试集 代码表示为: test_wine= [wine(31:59,:);wine(96:130,:);wine(154:178,:)]; 第四步:对其测试集的标签进行分离 代码表示为: test wine labels =[wine_labels (31: 59); wine labels (96: 130);wine_labels(154:178)] 33

相关文档
相关文档 最新文档