|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.cmu.minorthird.classify.BatchClassifierLearner edu.cmu.minorthird.classify.algorithms.svm.SVMLearner
public class SVMLearner
Wraps the svm.svm_train algorithm from libsvm (http://www.csie.ntu.edu.tw/~cjlin/libsvm/)
Parameterization is done via an SVM object (see libsvm docs for examples/info). There are a few setParameterXXX methods to do some changes. Use these after calling new SVMLearner() and before starting training.
Field Summary | |
---|---|
static java.lang.String |
cacheSizeHelp
|
static java.lang.String |
coef0Help
|
static java.lang.String |
cParameterHelp
|
static java.lang.String |
cParameterWeightHelp
|
static java.lang.String |
degreeHelp
|
static java.lang.String |
doProbabilityEstimatesHelp
|
static java.lang.String |
gammaHelp
|
static java.lang.String |
kernelTypeHelp
|
static java.lang.String |
lossFunctionEpsilonHelp
|
static java.lang.String |
nuHelp
|
static java.lang.String |
parameterSVMTypeHelp
|
static java.lang.String |
stoppingCriteriaHelp
|
static java.lang.String |
useShrinkingHeuristicsHelp
|
Fields inherited from class edu.cmu.minorthird.classify.BatchClassifierLearner |
---|
classifier, dataset |
Constructor Summary | |
---|---|
SVMLearner()
default constructor |
|
SVMLearner(libsvm.svm_parameter parameters)
Construct learner using given params |
Method Summary | |
---|---|
Classifier |
batchTrain(Dataset dataset)
Train a classifier using the given dataset. |
double |
getCacheSize()
|
java.lang.String |
getCacheSizeHelp()
|
double |
getCoef0()
|
java.lang.String |
getCoef0Help()
|
double |
getCParameter()
|
java.lang.String |
getCParameterHelp()
|
int |
getCParameterWeight()
|
java.lang.String |
getCParameterWeightHelp()
|
protected static libsvm.svm_parameter |
getDefaultParameters()
sets the default parameters for the svm use the setParameterXXX methods to adjust them |
int |
getDegree()
|
java.lang.String |
getDegreeHelp()
|
boolean |
getDoProbabilityEstimates()
|
java.lang.String |
getDoProbabilityEstimatesHelp()
|
double |
getGamma()
|
java.lang.String |
getGammaHelp()
|
int |
getKernelType()
|
java.lang.String |
getKernelTypeHelp()
|
double |
getLossFunctionEpsilon()
|
java.lang.String |
getLossFunctionEpsilonHelp()
|
double |
getNu()
|
java.lang.String |
getNuHelp()
|
int |
getParameterSVMType()
|
java.lang.String |
getParameterSVMTypeHelp()
|
ExampleSchema |
getSchema()
Returns the ExampleSchema - constraints on what the Examples will be. |
double |
getStoppingCriteria()
|
java.lang.String |
getStoppingCriteriaHelp()
|
boolean |
getUseShrinkingHeuristics()
|
java.lang.String |
getUseShrinkingHeuristicsHelp()
|
void |
setCacheSize(double s)
|
void |
setCoef0(double c)
|
void |
setCParameter(double c)
|
void |
setCParameterWeight(int w)
|
void |
setDegree(int deg)
|
void |
setDoProbabilityEstimates(boolean flag)
Tell the learner to train a classifier capable of computing probability estimates for each class. |
void |
setGamma(double g)
|
void |
setKernelType(int type)
|
void |
setLossFunctionEpsilon(double l)
|
void |
setNu(double n)
|
void |
setParameterC(double c)
|
void |
setParameterGamma(double gamma)
The default for Gamma is 0, which works for a linear kernel, but not for other types of kernels |
void |
setParameterKernelType(int type)
Default kernel type is linear |
void |
setParameterSVMType(int type)
|
void |
setSchema(ExampleSchema schema)
Accept an ExampleSchema - constraints on what the Examples will be. |
void |
setStoppingCriteria(double c)
|
void |
setUseShrinkingHeuristics(boolean flag)
|
Methods inherited from class edu.cmu.minorthird.classify.BatchClassifierLearner |
---|
addExample, completeTraining, copy, getClassifier, hasNextQuery, nextQuery, reset, setInstancePool |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String parameterSVMTypeHelp
public static java.lang.String kernelTypeHelp
public static java.lang.String degreeHelp
public static java.lang.String gammaHelp
public static java.lang.String coef0Help
public static java.lang.String nuHelp
public static java.lang.String cacheSizeHelp
public static java.lang.String cParameterHelp
public static java.lang.String stoppingCriteriaHelp
public static java.lang.String lossFunctionEpsilonHelp
public static java.lang.String useShrinkingHeuristicsHelp
public static java.lang.String cParameterWeightHelp
public static java.lang.String doProbabilityEstimatesHelp
Constructor Detail |
---|
public SVMLearner(libsvm.svm_parameter parameters)
parameters
- parameters to the SVMpublic SVMLearner()
Method Detail |
---|
protected static libsvm.svm_parameter getDefaultParameters()
public void setSchema(ExampleSchema schema)
ClassifierLearner
public ExampleSchema getSchema()
ClassifierLearner
public Classifier batchTrain(Dataset dataset)
batchTrain
in class BatchClassifierLearner
dataset
- Dataset representing all usable training data
public void setParameterSVMType(int type)
public int getParameterSVMType()
public java.lang.String getParameterSVMTypeHelp()
public void setKernelType(int type)
public int getKernelType()
public java.lang.String getKernelTypeHelp()
public void setDegree(int deg)
public int getDegree()
public java.lang.String getDegreeHelp()
public void setGamma(double g)
public double getGamma()
public java.lang.String getGammaHelp()
public void setCoef0(double c)
public double getCoef0()
public java.lang.String getCoef0Help()
public void setNu(double n)
public double getNu()
public java.lang.String getNuHelp()
public void setCacheSize(double s)
public double getCacheSize()
public java.lang.String getCacheSizeHelp()
public void setCParameter(double c)
public double getCParameter()
public java.lang.String getCParameterHelp()
public void setStoppingCriteria(double c)
public double getStoppingCriteria()
public java.lang.String getStoppingCriteriaHelp()
public void setLossFunctionEpsilon(double l)
public double getLossFunctionEpsilon()
public java.lang.String getLossFunctionEpsilonHelp()
public void setUseShrinkingHeuristics(boolean flag)
public boolean getUseShrinkingHeuristics()
public java.lang.String getUseShrinkingHeuristicsHelp()
public void setCParameterWeight(int w)
public int getCParameterWeight()
public java.lang.String getCParameterWeightHelp()
public void setDoProbabilityEstimates(boolean flag)
flag
- Boolean value telling the learner whether or not to compute probability estimatespublic boolean getDoProbabilityEstimates()
public java.lang.String getDoProbabilityEstimatesHelp()
public void setParameterKernelType(int type)
type
- integer from the svm_parameter classpublic void setParameterGamma(double gamma)
gamma
- double to be used as the gamma parameter. Default is 0public void setParameterC(double c)
c
- double to be used as the C parameter. Default is 1
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |