matlab install libsvm-3.22 version

The Libsvm toolbox was developed and designed by Professor Lin Chih-Jen of National Taiwan University, Libsvm official website

Download path

Libsvm toolbox link: click here

I downloaded the Libsvm-3.22 version, because I want to use the SVDD algorithm (the official website uses the SVDD algorithm source code and the recommended version is version 3.22)

SVDD algorithm source code link, please click the red font zip in the official website as shown in the picture to download.

installation steps

Decompress the downloaded Libsvm-3.22 compressed package, and copy the resulting file to the toolbox file under the matlab installation path .

There are java, python, matlab and other language versions under the Libsvm folder, we just use matlab.

Compile

The computer I am using is a windows64-bit system. The Libsvm-3.22/windows folder has provided files that are compiled and used under the 64-bit operating system. You can see four files with the file name suffix of mexw64 (respectively libsvmread .mexw64, libsvmwrite.mexw64, svmtrain.mexw64, svmpredict.mexw64)

If the computer is a 32-bit operating system, you need to recompile the c file in the Matlab folder to generate a mexw32 file that matlab can recognize

Reference link

Compiler installation reference link

Rename function

If necessary, it is best to rename the obtained files. In order to avoid conflicts with the built-in functions of svm, it is best to rename the two files svmtrain.mexw64 and svmpredict.mexw64 to libsvmtrain.mexw64 and libsvmpredict.mexw64.

Add to toolbox

Place the libsvm-3.22 folder in the \MATLAB R2018b\toolboxdirectory, homepage> set path> add folder> select libsvm-3.2,2 folder;

Update toolbox cache

test

load heart_scale
model = libsvmtrain(heart_scale_label, heart_scale_inst, '-c 1 -g 0.07');
[predict_label, accuracy, dec_values] = libsvmpredict(heart_scale_label, heart_scale_inst, model);

The results are as follows, indicating that the installation is correct:

Reference

  1. Reference 1: How to install the libsvm toolbox in MATLAB
  2. Reference 2: The use of LibSVM in Matlab
  3. Reference 3: About the installation instructions of the libsvm toolbox under 64-bit matlab
  4. Reference 4: MATLAB2016B install LIBSVM and MinGW-w64 C/C++ compiler (super detailed) ( strongly recommended )

Guess you like

Origin blog.csdn.net/weixin_44333597/article/details/112363976