svm
所属分类:matlab编程
开发工具:matlab
文件大小:8330KB
下载次数:437
上传日期:2011-03-14 15:18:23
上 传 者:
那一夜
说明: SVM分类器 分类各种图片的类别 分类各种图片的类别 分类各种图片的类别
(SVM classifiers various pictures of various categories of classification of classified images of various image types)
文件列表:
svm\test_SVM.m (2342, 2009-05-24)
svm\train_SVM.m (2012, 2009-05-24)
svm\libsvm-mat-2.82-2\1226.txt (40796, 2006-12-26)
svm\libsvm-mat-2.82-2\COPYRIGHT (1497, 2005-03-22)
svm\libsvm-mat-2.82-2\data_6class270.mat (6767392, 2007-04-26)
svm\libsvm-mat-2.82-2\feature_extr_sig.asv (8394, 2009-05-27)
svm\libsvm-mat-2.82-2\feature_zuhe.asv (2515, 2009-05-30)
svm\libsvm-mat-2.82-2\heart_scale.mat (28904, 2005-03-22)
svm\libsvm-mat-2.82-2\make.m (186, 2005-04-24)
svm\libsvm-mat-2.82-2\Makefile (819, 2006-04-11)
svm\libsvm-mat-2.82-2\model_All_JJ.mat (252, 2007-08-28)
svm\libsvm-mat-2.82-2\model_All_JJ_222.mat (571, 2007-05-18)
svm\libsvm-mat-2.82-2\model_All_JJ_5_29.mat (348, 2008-11-14)
svm\libsvm-mat-2.82-2\model_All_JJ_printer.mat (329, 2007-05-17)
svm\libsvm-mat-2.82-2\model_All_JJ_temp.mat (268, 2007-11-26)
svm\libsvm-mat-2.82-2\read me.txt (8021, 2009-05-11)
svm\libsvm-mat-2.82-2\read_sparse.m (1181, 2006-04-07)
svm\libsvm-mat-2.82-2\svm.cpp (62199, 2006-04-04)
svm\libsvm-mat-2.82-2\svm.h (2871, 2006-04-04)
svm\libsvm-mat-2.82-2\svmpredict.c (8166, 2006-04-11)
svm\libsvm-mat-2.82-2\svmpredict.dll (28672, 2006-04-09)
svm\libsvm-mat-2.82-2\svmpredict.m (0, 2007-01-04)
svm\libsvm-mat-2.82-2\svmtrain.c (10127, 2007-05-17)
svm\libsvm-mat-2.82-2\svmtrain.dll (57344, 2006-04-09)
svm\libsvm-mat-2.82-2\svm_model_matlab.c (7260, 2006-04-04)
svm\libsvm-mat-2.82-2\svm_model_matlab.h (192, 2005-04-25)
svm\libsvm-mat-2.82-2\test_SVM_forBlock.asv (2973, 2006-12-26)
svm\libsvm-mat-2.82-2\train_model.mat (1007212, 2007-04-02)
svm\libsvm-mat-2.82-2\train_modelBlock.mat (51828, 2006-12-26)
svm\libsvm-mat-2.82-2\train_modelBlock2.mat (305503, 2006-12-26)
svm\libsvm-mat-2.82-2\train_modelBlock3.mat (47336, 2006-12-27)
svm\libsvm-mat-2.82-2\train_modelBlock4.mat (49650, 2006-12-29)
svm\libsvm-mat-2.82-2\train_model_34.mat (30454, 2007-01-03)
svm\libsvm-mat-2.82-2\train_model_40.mat (44281, 2007-01-03)
svm\libsvm-mat-2.82-2\train_model_6.mat (22894, 2007-01-03)
svm\libsvm-mat-2.82-2\train_model_73.mat (67148, 2007-01-03)
svm\libsvm-mat-2.82-2\train_model_Ada1.mat (146874, 2007-03-28)
svm\libsvm-mat-2.82-2 (0, 2010-12-23)
svm (0, 2010-12-23)
... ...
-----------------------------------------------
--- Document for MATLAB interface of LIBSVM ---
-----------------------------------------------
Table of Contents
=================
- Introduction
- Installation
- Usage
- Returned Model Structure
- Examples
- Other Utilities
- Additional Information
Introduction
============
This tool provides 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 are the same as that of LIBSVM.
Installation
============
On Unix systems, we recommend using GNU g++ (version < 3.4) as your
compiler and type 'make' to build 'svmtrain.mexglx' and 'svmpredict.mexglx'.
Note that we assume your MATLAB is installed in '/usr/local/matlab',
if not, please change MATLABDIR in Makefile.
Example:
linux> make
On Windows systems, pre-built 'svmtrain.dll' and 'svmpredict.dll' are
included in this package, so no need to conduct installation. If you
have modified the sources and would like to re-build the package, type
'mex -setup' in MATLAB to choose a compiler for mex first. Then type
'make' to start the installation.
Example:
matlab> mex -setup
(ps: MATLAB will show the following messages to setup 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] Microsoft Visual C/C++ version 6.0 in C:\Program Files\Microsoft Visual Studio
[0] None
Compiler: 1
Please verify your choices:
Compiler: Microsoft Visual C/C++ 6.0
Location: C:\Program Files\Microsoft Visual Studio
Are these correct?([y]/n): y
matlab> make
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_options:
A string of training options in the same format as that of LIBSVM.
matlab> [predicted_label, accuracy, decision_values/prob_estimates] = svmpredict(testing_label_vector, testing_instance_matrix, model [,'libsvm_options']);
-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_options:
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 a scalar: cross-validation
accuracy for classification and mean-squared error for regression.
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).
Result of Prediction
====================
The function 'svmpredict' has three outputs. The first one,
predictd_label, is a vector of predicted labels. The second output,
accuracy, is a vector including accuracy (for classification), mean
squared error, and squared correlation coefficient (for regression).
The third is a matrix containing decision values or probability
estimates (if '-b 1' is specified). If k is the number of classes, for decision values,
each row includes results of predicting k(k-1/2) binary-class SVMs. For probabilities,
each row contains k values indicating the probability that the testing instance is in
each class. Note that the order of classes here is the same as 'Label'
field in the model structure.
Examples
========
Train and test on the provided data heart_scale:
matlab> load heart_scale.mat
matlab> model = svmtrain(heart_scale_label, heart_scale_inst, '-c 1 -g 2');
matlab> [predict_label, accuracy, dec_values] = 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, prob_estimates] = svmpredict(heart_scale_label, heart_scale_inst, model, '-b 1');
To use precomputed kernel, you must include sample serial number as
the first column of the training and testing data (assume your kernel
matrix is K, # of instances is n):
matlab> K1 = [(1:n)', K]; % include sample serial number as first column
matlab> model = svmtrain(label_vector, K1, '-t 4');
matlab> [predict_label, accuracy, dec_values] = svmpredict(label_vector, K1, model); % test the training data
Take linear kernel for example, the following precomputed kernel example
gives exactly same training error as libsvm built-in linear kernel
matlab> load heart_scale.mat
matlab> n = size(heart_scale_inst,1);
matlab> K = heart_scale_inst*heart_scale_inst';
matlab> K1 = [(1:n)', K];
matlab> model = svmtrain(heart_scale_label, K1, '-t 4');
matlab> [predict_label, accuracy, dec_values] = svmpredict(heart_scale_label, K1, model);
Note that for testing, you can put anything in the first column. For
details of precomputed kernels, please read the section ``Precomputed
Kernels'' in the README of the LIBSVM package.
Other Utilities
===============
A simple matlab program read_sparse.m reads files in libsvm format:
[svm_lbl, svm_data] = read_sparse(fname);
Two outputs are labels and instances, which can then be used as inputs
of svmtrain or svmpredict. This code was initiated by Hsuan-Tien Lin
from Caltech and rewritten by Rong-En Fan from National Taiwan
University.
Additional Information
======================
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 and Ting-Fan Wu. 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 .
近期下载者:
相关文件:
收藏者: