MATLAB LIBSVM support Vector Machine Toolbox installation and use

Source: Internet
Author: User

http://download.csdn.net/my here can download support Vector machine Toolbox, I maltab r2012b and 3.1 matching use, others do not, we look at the tutorial after the problem, if this article does not mention, first search errors, if not explicitly given the answer, try different versions may be used, I am the same tutorial for 4 of the Toolbox before you can use (version problem).

The first is to download a good installation of compressed package, I download here is libsvm-3.1.zip, download, unzip , and then put it in the MATLAB installation folder Toolbox folder, here is a point: do not have to go to this folder, just to standardize , the Toolbox is all in the Toolbox folder when it's applied. Easy to manage and operate.

Take My computer as an example, my MATLAB is installed in the D Disk Program Files folder, then I need to put the extracted libsvm-3.1 folder in D:\Program files\matlab\r2012b\toolbox folder under

Then we need to set this path in.

Click file-set Path

Will pop up the following interface, here to note , many tutorials are said to click Add folders-, but in many cases, there will be errors, this is because if your Toolbox folder contains subfolders, so long can not be added to the path, Then the application will definitely be wrong.

Add the method correctly (for example): Click-add with subfolders, locate the libsvm-3.1 folder, OK, and then save it last.

Description

Not to this step, on behalf of the Toolbox import success, to see the description of the toolbox, such as the Toolbox LIBSVM, the Toolbox is not available, but also need to compile, make and other operations.

First, concrete steps (c++6.0)

In the MATLAB main window, enter

Mex-setup Enter, note here-there are spaces in front

Y Enter

Then, in the options that appear, select the ordinal of the option that contains c++6.0, for example, mine is 2, then enter 2 to return the car, if it is vs2012 refer to the mex-setup below

Y Enter

Make Enter

Wait for automatic execution, import complete, can be used.

Ii. concrete Steps (vs2012)

In the MATLAB main window, enter

>> Mex-setup
MEX is configured to use ' Microsoft Visual C + + (c) ' for C language compilation.
Warning: the MATLAB C and Fortran APIs have changed and can now support MATLAB variables that contain more than 2^32-1 elements. Soon, you'll need to update your code to take advantage of the new API. You can find more information at the following URL:
To select a different language, select a command from the following options:
Mex-setup C + +
Mex-setup FORTRANlater, according to the most primitive method provided by LIBSVM: Make solves theThe steps are as follows:1, download LIBSVM, I downloaded the libsvm-3.1 version2, after decompression put to the installation directory of MATLAB, I personally like to put directly in the Toolbox under MATLAB, after all, this is one of the tools. 3, in the main interface of MATLAB find "set path", add folder and its sub-files, simply put the whole libsvm-3.1 to add all, anyway may be used. 4, switch the MATLAB running directory to: C:\Program Files\matlab\r2014b\toolbox\libsvm-3.1\matlab, enter make in the command line, that is, the make file under the directory. This time, like before the installation of LIBSVM, will automatically make a lot of files, no tube, mainly will see make out with the mexm64 suffix name of the file, this success. 5. Copy all make files under Matlab folder in 4 steps, to Libsvm-3.1\windows folder, replace replace replacement ..., replace. 6, over, take a breath, relax, the distance between success is only the seventh step behind7. Verify success: Use data LIBSVM test data downloadYou can copy the downloaded heart_scale.mat data to the directory you just had (it doesn't really matter). Then enter the statement that is specific to the LIBSVM Toolbox to verify success or not: >> Load Heart_scale.mat
>> model = Svmtrain (Heart_scale_label, Heart_scale_inst, '-C 1-g 0.07 ');
>> [Predict_label, accuracy, dec_values] = Svmpredict (Heart_scale_label, heart_scale_inst, model);

Output:*
Optimization finished, #iter = 134
Nu = 0.433785
obj = -101.855060, rho = 0.426412
NSV = NBSV = 107
Total NSV = 130

accuracy = 86.6667% (234/270) (classification)

The classification accuracy is obtained, which proves that the LIBSVM installation is successful!


MATLAB LIBSVM support Vector Machine Toolbox installation and use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.