2nusvm
所属分类:图形图像处理
开发工具:Visual C++
文件大小:113KB
下载次数:17
上传日期:2007-08-13 10:23:12
上 传 者:
bommy
说明: 用于图像处理的2类分类问题的程序,有较强的应用性。
(For image processing Category 2 classification procedures, have a strong application.)
文件列表:
COPYRIGHT (1497, 2005-03-22)
make_lin.m (171, 2005-11-07)
make_win.m (187, 2005-11-07)
svm.cpp (63649, 2005-11-03)
svm.h (2897, 2005-10-05)
svmpredict.c (6516, 2005-10-05)
svmpredict.dll (15872, 2005-08-09)
svmpredict.mexglx (57121, 2005-10-05)
svmtrain.c (9475, 2005-10-05)
svmtrain.dll (57344, 2005-08-09)
svmtrain.mexglx (61894, 2005-10-05)
svm_model_matlab.c (6967, 2005-10-05)
svm_model_matlab.h (192, 2005-04-25)
-----------------------------------------------------------------
--- Document for MATLAB interface of LIBSVM supporting 2NU-SVM---
-----------------------------------------------------------------
Introduction
============
This tool is a modification of a simple interface to LIBSVM, a library for
support vector machines (http://www.csie.ntu.edu.tw/~cjlin/libsvm). It is
very easy to use as the usage and the way of specifying parameters is the
same as that of LIBSVM. For more information regarding the 2NU-SVM, see
http://www.ece.rice.edu/~md/np_svm.html.
Installation
============
We have included pre-compiled versions of our code for Windows and Linux.
These mex files are intended for use with MATLAB 7. Instructions for
recompiling follow: (in case you want to make any changes, or if you need
to recompile for your OS / MATLAB version)
On Linux systems, we recommend using gcc as your compiler.
Note that LIBSVM contains C++ code, so a standard C compiler will not suffice.
We have provided a MATLAB script, make_lin.m for use on Linux.
Example:
Start MATLAB
>> mex -setup
(This allows you to select the default compiler used by mex - select a
C++ compatible compiler of your choice, we reccomend gcc)
>> make_sol
This should create the files svmtrain.mexglx and svmpredict.mexglx.
On Windows systems, we have provided an additional MATLAB script, make_win.m.
Example:
Start MATLAB
>> mex -setup
(Below is an example of how to set the default compiler)
Please choose your compiler for building external interface (MEX) files:
Would you like mex to locate installed compilers [y]/n? y
Select a compiler:
[1] Lcc C version 2.4 in C:\MATLAB\sys\lcc
[2] Microsoft Visual C/C++ version 7.1 in C:\Program Files\Microsoft Visual Studio .NET 2003
[0] None
Compiler: 2
Please verify your choices:
Compiler: Microsoft Visual C/C++ 7.1
Location: C:\Program Files\Microsoft Visual Studio .NET 2003
Are these correct?([y]/n): y
>> make_win
This should create the files svmtrain.dll and svmpredict.dll.
Usage
=====
matlab> model = svmtrain(training_label_vector, training_instance_matrix, [,'libsvm_options']);
-training_label_vector:
An m by 1 vector of training labels.
-training_instance_matrix:
An m by n matrix of m training instances with n features.
It can be dense or sparse.
-libsvm_option:
A string of training options in the same format as that of LIBSVM.
matlab> [predicted_label, accuracy] = svmpredict(testing_label_vector, testing_instance_matrix, model [,'libsvm_option']);
-testing_label_vector:
An m by 1 vector of prediction labels. If labels of test
data are unknown, simply use any random values.
-testing_instance_matrix:
An m by n matrix of m testing instances with n features.
It can be dense or sparse.
-model:
The output of svmtrain.
-libsvm_option:
A string of testing options in the same format as that of LIBSVM.
Returned Model Structure
========================
The 'svmtrain' function returns a model which can be used for future
prediction. It is a structure and is organized as [Parameters, nr_class,
totalSV, rho, Label, ProbA, ProbB, nSV, sv_coef, SVs]:
-Parameters: parameters
-nr_class: number of classes; = 2 for regression/one-class svm
-totalSV: total #SV
-rho: -b of the decision function(s) wx+b
-Label: label of each class; empty for regression/one-class SVM
-ProbA: pairwise probability information; empty if -b 0 or in one-class SVM
-ProbB: pairwise probability information; empty if -b 0 or in one-class SVM
-nSV: number of SVs for each class; empty for regression/one-class SVM
-sv_coef: coefficients for SVs in decision functions
-SVs: support vectors
If you do not use the option '-b 1', ProbA and ProbB are empty
matrices. If the '-v' option is specified, cross validation is
conducted and the returned model is just two numbers: cross-validation
estimates of the false alarm and miss probabilities.
More details about this model can be found in LIBSVM FAQ
(http://www.csie.ntu.edu.tw/~cjlin/libsvm/faq.html) and LIBSVM
implementation document
(http://www.csie.ntu.edu.tw/~cjlin/papers/libsvm.pdf).
See http://www.ece.rice.edu/~md/np_svm.html for more details on how this
implementation differs from the standard LIBSVM package.
Result of Prediction
====================
The function 'svmpredict' has two outputs. The first one,
predicted_label, is in general a vector of predicted labels. If '-b 1'
is specified as an option of 'svmpredict' and the input model
possesses probability information, it is a matrix where additional
elements in each row are probabilities that the test data is in each
class. Note that the order of classes is the same as Label in the
model structure. The second output, accuracy, is a vector including
accuracy (for classification), mean squared error, and squared
correlation coefficient (for regression).
Examples
========
matlab> load heart_scale.mat
matlab> model = svmtrain(heart_scale_label, heart_scale_inst, '-c 1 -g 2');
matlab> [predict_label, accuracy] = svmpredict(heart_scale_label, heart_scale_inst, model); % test the training data
For probability estimates, you need '-b 1' for training and testing:
matlab> load heart_scale.mat
matlab> model = svmtrain(heart_scale_label, heart_scale_inst, '-c 1 -g 2 -b 1');
matlab> load heart_scale.mat
matlab> [predict_label, accuracy] = svmpredict(heart_scale_label, heart_scale_inst, model, '-b 1');
In order to utilize the 2NU functionality, simply set the parameters as
you normally would to train a NU-SVM, and then set weights (summing to
one) on the two classes. For example:
matlab> model = svmtrain(heart_scale_label, heart_scale_inst, '-s 1 -n 0.25 -w1 .25 -w-1 0.75');
For more information on the 2NU-SVM, see
http://www.ece.rice.edu/~md/np_svm.html.
Other Utilities
===============
Additional Information
======================
For questions regarding the 2NU-SVM functionality, please contact Mark
Davenport
This interface was initially written by Jun-Cheng Chen, Kuan-Jen Peng,
Chih-Yuan Yang and Chih-Huai Cheng from Department of Computer
Science, National Taiwan University. The current version was prepared
by Rong-En Fan. If you find this tool useful, please cite LIBSVM as
follows
Chih-Chung Chang and Chih-Jen Lin, LIBSVM : a library for
support vector machines, 2001. Software available at
http://www.csie.ntu.edu.tw/~cjlin/libsvm
For any question, please contact Chih-Jen Lin .
近期下载者:
相关文件:
收藏者: