最近在学习SVM,因此需要在matlab上运行代码,下载了一个svm安装包,老是提示找不到svmtrain,后来发现是没有编译器,不能编译,准备装个vs,结果安装到一半总是失败,错误信息是:visual studio核心功能出错,无奈之下一键还原电脑,重新来一遍,以下是过程:
环境:win8.1,64位
1.首先下载visual studio 2015 professional 下载地址https://yunpan.cn/cqD3ARrKxeVFj 访问密码 821d
由于电脑一键还原了,所以这次没有出现什么错误,值得注意的是,有一个步骤要选择安装的功能,要记得选择编程语言。
2.下载matlabr2015b,下载地址https://yunpan.cn/cqDLItUxZQJYf 访问密码 15fb
matlab破解过程:在上述给出的下载文件中,查看Matlab 2015b Win64 Crack中的readme.txt,有完整的介绍:
I offer two modes of installation:
1) standalone:把R2015b下的文件复制到安装目录下把里边的内容覆盖
- Install choosing the option “Use a File Installation Key” and supply the following FIK
09806-07443-53955-64350-21751-41297(1)
- To install Matlab Production Server,using this
40236-45817-26714-51426-39281
- Use license_standalone.lic to activate(2),
or make a “licenses” folder in %installdir% and copy license_standalone.lic to it,and run matlab without activation
- after the installation finishes copy the folders to %installdir% to overwriting the originally installed files(3)
2) floating license (network license server):
- Install choosing the option “Use a File Installation Key” and supply the following FIK
31095-30030-55416-47440-21946-54205
- To install Matlab Production Server,using this
57726-51709-20682-42954-31195
- Use license_server.lic when asked
- after the installation finishes copy the folders to %installdir% to overwriting the originally installed files
把这个翻译一遍吧,就是有两种破解方法,
第一种:按顺序使用密钥09806-07443-53955-64350-21751-41297和40236-45817-26714-51426-39281,接下来有个选择执行文件的步骤,选择Matlab 2015b Win64 Crack中的 license_standalone.lic来激活。
第二种:密钥为31095-30030-55416-47440-21946-54205和57726-51709-20682-42954-31195,选择 license_server.lic
我一开始选择第二种方法,出错了!!!!提示:License checkout failed!
所以还是建议大家选择第一种破解方法。
3.安装好了vs和matlab,接下来就要编译libsvm了:
1)到http://www.csie.ntu.edu.tw/~cjlin/libsvm/下载libsvm包,解压后放在任意目录下,最好放在MATLAB工具箱中,比如 MATLABR2011a oolboxlibsvm,然后添加到matlab中——选择matlab主页中的设置路径
添加并包含子文件libsvm
2)打开 matlab,切换到matlab2015b oolboxlibsvmmatlab目录下
输入以下命令:
mex -setup
make
3)检验是否安装成功,可执行以下步骤:
在路径matlab2015b oolboxlibsvmmatlab目录下,
>> load heart_scale
错误使用 load
ASCII 文件 heart_scale 的第 3 行中的列数必须与前面行中的列数相同。
一开始加载heart_scale错误,然后就重新下载了一份heart_scale.mat,下载地址:https://yunpan.cn/cqDrGp6kkAX5P 访问密码 3787
然后把heart_scale.mat放到matlab2015b oolboxlibsvmmatlab目录下
测试成功。
>> load heart_scale.mat
>> model = svmtrain(heart_scale_label,heart_scale_inst);
*
optimization finished, #iter = 162
nu = 0.431029
obj = -100.877288, rho = 0.424462
nSV = 132, nBSV = 107
Total nSV = 132
>> [predict_label,accuracy] = svmpredict(heart_scale_label,heart_scale_inst,model);
Usage: [predicted_label, accuracy, decision_values/prob_estimates] = svmpredict(testing_label_vector, testing_instance_matrix, model, ‘libsvm_options’)
[predicted_label] = svmpredict(testing_label_vector, testing_instance_matrix, model, ‘libsvm_options’)
Parameters:
model: SVM model structure from svmtrain.
libsvm_options:
-b probability_estimates: whether to predict probability estimates, 0 or 1 (default 0); one-class SVM not supported yet
-q : quiet mode (no outputs)
Returns:
predicted_label: SVM prediction output vector.
accuracy: a vector with accuracy, mean squared error, squared correlation coefficient.
prob_estimates: If selected, probability estimate vector.
注,最好到http://www.csie.ntu.edu.tw/~cjlin/libsvm/下载libsvm包
之前不知道哪里下载的会出现问题: