|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpt.tumba.ngram.svm.SVMCategorizer
public class SVMCategorizer
Simple, easy-to-use, and efficient software for SVM classification and regression, based on the LIBSVM implementation of Chin-Chung Chang and Chin-Jen Lin. It can solve C-SVM classification, nu-SVM classification, one-class-SVM, epsilon-SVM regression, and nu-SVM regression. It also provides an automatic model selection tool for C-SVM classification, and multiclass classification through a "one-against-one" approach .
The original implementation was much less "object-oriented", and didn't follow the usual conventions for Java programs. Besides major code refactoring, additional functionalities were also added:
| Field Summary | |
|---|---|
private boolean |
crossValidation
|
private java.lang.String |
errorMsg
|
private java.lang.String |
inputFileName
|
protected SVMModel |
model
Description of the Field |
private java.lang.String |
modelFileName
|
protected java.lang.String[] |
names
|
private int |
nrFold
|
protected SVMParameter |
param
|
protected SVMProblem |
prob
|
protected java.util.List |
sortedGrams
|
| Constructor Summary | |
|---|---|
SVMCategorizer()
Construct an uninitialized Cathegorizer. |
|
SVMCategorizer(java.lang.String dirName)
Construct an Cathegorizer from a whole Directory of resources. |
|
SVMCategorizer(java.lang.String[] fileNames)
Construct an Cathegorizer from a List of resource file names. |
|
| Method Summary | |
|---|---|
private void |
doCrossValidation()
|
private static java.util.List |
exchangePos(java.util.List v,
int p1,
int p2)
Exchange two values in a list |
private static void |
exitWithHelp()
|
private void |
init(java.io.File fi,
java.lang.String[] names)
Fetch the set of file resources. |
static void |
main(java.lang.String[] argv)
Sample application, like the text_cat main mode. |
java.lang.String |
match(java.io.File f)
|
private static void |
predict(java.io.BufferedReader input,
java.io.DataOutputStream output,
SVMModel model,
int predict_probability)
|
private void |
readProblem()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected SVMModel model
protected SVMParameter param
protected SVMProblem prob
protected java.lang.String[] names
protected java.util.List sortedGrams
private java.lang.String inputFileName
private java.lang.String modelFileName
private java.lang.String errorMsg
private boolean crossValidation
private int nrFold
| Constructor Detail |
|---|
public SVMCategorizer()
public SVMCategorizer(java.lang.String dirName)
throws TCatNGException,
java.io.FileNotFoundException
dirName - Description of the Parameter
NGramException - Description of the Exception
java.io.FileNotFoundException - Description of the Exception
TCatNGException
public SVMCategorizer(java.lang.String[] fileNames)
throws TCatNGException,
java.io.FileNotFoundException
fileNames - Description of the Parameter
NGramException - Description of the Exception
java.io.FileNotFoundException - Description of the Exception
TCatNGException| Method Detail |
|---|
private final void init(java.io.File fi,
java.lang.String[] names)
throws TCatNGException,
java.io.FileNotFoundException
fi - Description of the Parameternames - Description of the Parameter
NGramException - Description of the Exception
java.io.FileNotFoundException - Description of the Exception
TCatNGException
private static java.util.List exchangePos(java.util.List v,
int p1,
int p2)
v - The original listp1 - The index of the first elementp2 - The index of the second element
public java.lang.String match(java.io.File f)
public static void main(java.lang.String[] argv)
args - The command line arguments
private static void predict(java.io.BufferedReader input,
java.io.DataOutputStream output,
SVMModel model,
int predict_probability)
throws java.io.IOException
java.io.IOExceptionprivate static void exitWithHelp()
private void doCrossValidation()
private void readProblem()
throws java.io.IOException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||