public class GridSearch
extends weka.classifiers.RandomizableSingleClassifierEnhancer
implements weka.core.AdditionalMeasureProducer, weka.core.Summarizable
-E <CC|RMSE|RRSE|MAE|RAE|COMB|ACC|WAUC|KAP> Determines the parameter used for evaluation: CC = Correlation coefficient RMSE = Root mean squared error RRSE = Root relative squared error MAE = Mean absolute error RAE = Root absolute error COMB = Combined = (1-abs(CC)) + RRSE + RAE ACC = Accuracy WAUC = Weighted AUC KAP = Kappa (default: CC)
-y-property <option> The Y option to test (without leading dash). (default: kernel.gamma)
-y-min <num> The minimum for Y. (default: -3)
-y-max <num> The maximum for Y. (default: +3)
-y-step <num> The step size for Y. (default: 1)
-y-base <num> The base for Y. (default: 10)
-y-expression <expr> The expression for Y. Available parameters: BASE FROM TO STEP I - the current iteration value (from 'FROM' to 'TO' with stepsize 'STEP') (default: 'pow(BASE,I)')
-x-property <option> The X option to test (without leading dash). (default: C)
-x-min <num> The minimum for X. (default: -3)
-x-max <num> The maximum for X. (default: 3)
-x-step <num> The step size for X. (default: 1)
-x-base <num> The base for X. (default: 10)
-x-expression <expr> The expression for the X value. Available parameters: BASE MIN MAX STEP I - the current iteration value (from 'FROM' to 'TO' with stepsize 'STEP') (default: 'pow(BASE,I)')
-extend-grid Whether the grid can be extended. (default: no)
-max-grid-extensions <num> The maximum number of grid extensions (-1 is unlimited). (default: 3)
-sample-size <num> The size (in percent) of the sample to search the inital grid with. (default: 100)
-traversal <ROW-WISE|COLUMN-WISE> The type of traversal for the grid. (default: COLUMN-WISE)
-log-file <filename> The log file to log the messages to. (default: none)
-num-slots <num> Number of execution slots. (default 1 - i.e. no parallelism)
-S <num> Random number seed. (default 1)
-W Full name of base classifier. (default: weka.classifiers.functions.SMOreg with options -K weka.classifiers.functions.supportVector.RBFKernel)
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
Options specific to classifier weka.classifiers.functions.SMOreg:
-C <double> The complexity constant C. (default 1)
-N Whether to 0=normalize/1=standardize/2=neither. (default 0=normalize)
-I <classname and parameters> Optimizer class used for solving quadratic optimization problem (default weka.classifiers.functions.supportVector.RegSMOImproved)
-K <classname and parameters> The Kernel to use. (default: weka.classifiers.functions.supportVector.PolyKernel)
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
Options specific to optimizer ('-I') weka.classifiers.functions.supportVector.RegSMOImproved:
-T <double> The tolerance parameter for checking the stopping criterion. (default 0.001)
-V Use variant 1 of the algorithm when true, otherwise use variant 2. (default true)
-P <double> The epsilon for round-off error. (default 1.0e-12)
-L <double> The epsilon parameter in epsilon-insensitive loss function. (default 1.0e-3)
-W <double> The random number seed. (default 1)
Options specific to kernel ('-K') weka.classifiers.functions.supportVector.RBFKernel:
-G <num> The Gamma parameter. (default: 0.01)
-C <num> The size of the cache (a prime number), 0 for full cache and -1 to turn it off. (default: 250007)
-output-debug-info Enables debugging output (if available) to be printed. (default: off)
-no-checks Turns off all checks - use with caution! (default: checks on)Examples:
weka.classifiers.functions.SMO
as classifier with
weka.classifiers.functions.supportVector.RBFKernel
as kernel.weka.classifiers.meta.FilteredClassifier
.weka.filters.supervised.attribute.PLSFilter
.weka.classifiers.functions.LinearRegression
and use no attribute selection and no elimination of colinear
attributes.Modifier and Type | Field and Description |
---|---|
static int |
EVALUATION_ACC
evaluation via: Accuracy.
|
static int |
EVALUATION_CC
evaluation via: Correlation coefficient.
|
static int |
EVALUATION_COMBINED
evaluation via: Combined = (1-CC) + RRSE + RAE.
|
static int |
EVALUATION_KAPPA
evaluation via: kappa statistic.
|
static int |
EVALUATION_MAE
evaluation via: Mean absolute error.
|
static int |
EVALUATION_RAE
evaluation via: Relative absolute error.
|
static int |
EVALUATION_RMSE
evaluation via: Root mean squared error.
|
static int |
EVALUATION_RRSE
evaluation via: Root relative squared error.
|
static int |
EVALUATION_WAUC
evaluation via: weighted AUC
|
static weka.core.Tag[] |
TAGS_EVALUATION
evaluation.
|
static weka.core.Tag[] |
TAGS_TRAVERSAL
traversal.
|
static int |
TRAVERSAL_BY_COLUMN
column-wise grid traversal.
|
static int |
TRAVERSAL_BY_ROW
row-wise grid traversal.
|
Constructor and Description |
---|
GridSearch()
the default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
buildClassifier(weka.core.Instances data)
builds the classifier.
|
double[] |
distributionForInstance(weka.core.Instance instance)
Computes the distribution for a given instance
|
java.util.Enumeration<java.lang.String> |
enumerateMeasures()
Returns an enumeration of the measure names.
|
java.lang.String |
evaluationTipText()
Returns the tip text for this property.
|
weka.classifiers.Classifier |
getBestClassifier()
returns the best Classifier setup.
|
weka.core.Capabilities |
getCapabilities()
Returns default capabilities of the classifier.
|
weka.core.SelectedTag |
getEvaluation()
Gets the criterion used for evaluating the classifier performance.
|
int |
getGridExtensionsPerformed()
returns the number of grid extensions that took place during the search
(only applicable if the grid was extendable).
|
boolean |
getGridIsExtendable()
Get whether the grid can be extended dynamically.
|
java.io.File |
getLogFile()
Gets current log file.
|
int |
getMaxGridExtensions()
Gets the maximum number of grid extensions, -1 for unlimited.
|
double |
getMeasure(java.lang.String measureName)
Returns the value of the named measure.
|
int |
getNumExecutionSlots()
Get the number of execution slots (threads) to use for finding optimal parameters.
|
java.lang.String[] |
getOptions()
returns the options of the current setup.
|
java.lang.String |
getRevision()
Returns the revision string.
|
double |
getSampleSizePercent()
Gets the sample size for the initial grid search.
|
weka.core.SelectedTag |
getTraversal()
Gets the type of traversal for the grid.
|
weka.classifiers.meta.GridSearch.PointDouble |
getValues()
returns the parameter pair that was found to work best.
|
double |
getXBase()
Get the value of the base for X.
|
java.lang.String |
getXExpression()
Get the expression for the X value.
|
double |
getXMax()
Get the value of the Maximum of X.
|
double |
getXMin()
Get the value of the minimum of X.
|
java.lang.String |
getXProperty()
Get the X property to test.
|
double |
getXStep()
Get the value of the step size for X.
|
double |
getYBase()
Get the value of the base for Y.
|
java.lang.String |
getYExpression()
Get the expression for the Y value.
|
double |
getYMax()
Get the value of the Maximum of Y.
|
double |
getYMin()
Get the value of the minimum of Y.
|
java.lang.String |
getYProperty()
Get the Y property (normally the classifier).
|
double |
getYStep()
Get the value of the step size for Y.
|
java.lang.String |
globalInfo()
Returns a string describing classifier.
|
java.lang.String |
gridIsExtendableTipText()
Returns the tip text for this property.
|
java.util.Enumeration<weka.core.Option> |
listOptions()
Gets an enumeration describing the available options.
|
java.lang.String |
logFileTipText()
Returns the tip text for this property.
|
static void |
main(java.lang.String[] args)
Main method for running this classifier from commandline.
|
java.lang.String |
maxGridExtensionsTipText()
Returns the tip text for this property.
|
java.lang.String |
numExecutionSlotsTipText()
Returns the tip text for this property.
|
java.lang.String |
sampleSizePercentTipText()
Returns the tip text for this property.
|
void |
setClassifier(weka.classifiers.Classifier newClassifier)
Set the base learner.
|
void |
setEvaluation(weka.core.SelectedTag value)
Sets the criterion to use for evaluating the classifier performance.
|
void |
setGridIsExtendable(boolean value)
Set whether the grid can be extended dynamically.
|
void |
setLogFile(java.io.File value)
Sets the log file to use.
|
void |
setMaxGridExtensions(int value)
Sets the maximum number of grid extensions, -1 for unlimited.
|
void |
setNumExecutionSlots(int value)
Set the number of execution slots (threads) to use for finding optimal parameters.
|
void |
setOptions(java.lang.String[] options)
Parses the options for this object.
|
void |
setSampleSizePercent(double value)
Sets the sample size for the initial grid search.
|
void |
setTraversal(weka.core.SelectedTag value)
Sets the type of traversal for the grid.
|
void |
setXBase(double value)
Set the value of the base for X.
|
void |
setXExpression(java.lang.String value)
Set the expression for the X value.
|
void |
setXMax(double value)
Set the value of the Maximum of X.
|
void |
setXMin(double value)
Set the value of the minimum of X.
|
void |
setXProperty(java.lang.String value)
Set the X property.
|
void |
setXStep(double value)
Set the value of the step size for X.
|
void |
setYBase(double value)
Set the value of the base for Y.
|
void |
setYExpression(java.lang.String value)
Set the expression for the Y value.
|
void |
setYMax(double value)
Set the value of the Maximum of Y.
|
void |
setYMin(double value)
Set the value of the minimum of Y.
|
void |
setYProperty(java.lang.String value)
Set the Y property (normally the classifier).
|
void |
setYStep(double value)
Set the value of the step size for Y.
|
java.lang.String |
toString()
returns a string representation of the classifier.
|
java.lang.String |
toSummaryString()
Returns a string that summarizes the object.
|
java.lang.String |
traversalTipText()
Returns the tip text for this property.
|
java.lang.String |
XBaseTipText()
Returns the tip text for this property.
|
java.lang.String |
XExpressionTipText()
Returns the tip text for this property.
|
java.lang.String |
XMaxTipText()
Returns the tip text for this property.
|
java.lang.String |
XMinTipText()
Returns the tip text for this property.
|
java.lang.String |
XPropertyTipText()
Returns the tip text for this property.
|
java.lang.String |
XStepTipText()
Returns the tip text for this property.
|
java.lang.String |
YBaseTipText()
Returns the tip text for this property.
|
java.lang.String |
YExpressionTipText()
Returns the tip text for this property.
|
java.lang.String |
YMaxTipText()
Returns the tip text for this property.
|
java.lang.String |
YMinTipText()
Returns the tip text for this property.
|
java.lang.String |
YPropertyTipText()
Returns the tip text for this property.
|
java.lang.String |
YStepTipText()
Returns the tip text for this property.
|
getSeed, seedTipText, setSeed
classifierTipText, getClassifier, postExecution, preExecution
batchSizeTipText, classifyInstance, debugTipText, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
public static final int EVALUATION_CC
public static final int EVALUATION_RMSE
public static final int EVALUATION_RRSE
public static final int EVALUATION_MAE
public static final int EVALUATION_RAE
public static final int EVALUATION_COMBINED
public static final int EVALUATION_ACC
public static final int EVALUATION_KAPPA
public static final int EVALUATION_WAUC
public static final weka.core.Tag[] TAGS_EVALUATION
public static final int TRAVERSAL_BY_ROW
public static final int TRAVERSAL_BY_COLUMN
public static final weka.core.Tag[] TAGS_TRAVERSAL
public java.lang.String globalInfo()
public java.util.Enumeration<weka.core.Option> listOptions()
listOptions
in interface weka.core.OptionHandler
listOptions
in class weka.classifiers.RandomizableSingleClassifierEnhancer
public java.lang.String[] getOptions()
getOptions
in interface weka.core.OptionHandler
getOptions
in class weka.classifiers.RandomizableSingleClassifierEnhancer
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-E <CC|RMSE|RRSE|MAE|RAE|COMB|ACC|WAUC|KAP> Determines the parameter used for evaluation: CC = Correlation coefficient RMSE = Root mean squared error RRSE = Root relative squared error MAE = Mean absolute error RAE = Root absolute error COMB = Combined = (1-abs(CC)) + RRSE + RAE ACC = Accuracy WAUC = Weighted AUC KAP = Kappa (default: CC)
-y-property <option> The Y option to test (without leading dash). (default: kernel.gamma)
-y-min <num> The minimum for Y. (default: -3)
-y-max <num> The maximum for Y. (default: +3)
-y-step <num> The step size for Y. (default: 1)
-y-base <num> The base for Y. (default: 10)
-y-expression <expr> The expression for Y. Available parameters: BASE FROM TO STEP I - the current iteration value (from 'FROM' to 'TO' with stepsize 'STEP') (default: 'pow(BASE,I)')
-x-property <option> The X option to test (without leading dash). (default: C)
-x-min <num> The minimum for X. (default: -3)
-x-max <num> The maximum for X. (default: 3)
-x-step <num> The step size for X. (default: 1)
-x-base <num> The base for X. (default: 10)
-x-expression <expr> The expression for the X value. Available parameters: BASE MIN MAX STEP I - the current iteration value (from 'FROM' to 'TO' with stepsize 'STEP') (default: 'pow(BASE,I)')
-extend-grid Whether the grid can be extended. (default: no)
-max-grid-extensions <num> The maximum number of grid extensions (-1 is unlimited). (default: 3)
-sample-size <num> The size (in percent) of the sample to search the inital grid with. (default: 100)
-traversal <ROW-WISE|COLUMN-WISE> The type of traversal for the grid. (default: COLUMN-WISE)
-log-file <filename> The log file to log the messages to. (default: none)
-num-slots <num> Number of execution slots. (default 1 - i.e. no parallelism)
-S <num> Random number seed. (default 1)
-W Full name of base classifier. (default: weka.classifiers.functions.SMOreg with options -K weka.classifiers.functions.supportVector.RBFKernel)
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
Options specific to classifier weka.classifiers.functions.SMOreg:
-C <double> The complexity constant C. (default 1)
-N Whether to 0=normalize/1=standardize/2=neither. (default 0=normalize)
-I <classname and parameters> Optimizer class used for solving quadratic optimization problem (default weka.classifiers.functions.supportVector.RegSMOImproved)
-K <classname and parameters> The Kernel to use. (default: weka.classifiers.functions.supportVector.PolyKernel)
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
Options specific to optimizer ('-I') weka.classifiers.functions.supportVector.RegSMOImproved:
-T <double> The tolerance parameter for checking the stopping criterion. (default 0.001)
-V Use variant 1 of the algorithm when true, otherwise use variant 2. (default true)
-P <double> The epsilon for round-off error. (default 1.0e-12)
-L <double> The epsilon parameter in epsilon-insensitive loss function. (default 1.0e-3)
-W <double> The random number seed. (default 1)
Options specific to kernel ('-K') weka.classifiers.functions.supportVector.RBFKernel:
-G <num> The Gamma parameter. (default: 0.01)
-C <num> The size of the cache (a prime number), 0 for full cache and -1 to turn it off. (default: 250007)
-output-debug-info Enables debugging output (if available) to be printed. (default: off)
-no-checks Turns off all checks - use with caution! (default: checks on)
setOptions
in interface weka.core.OptionHandler
setOptions
in class weka.classifiers.RandomizableSingleClassifierEnhancer
options
- the options to usejava.lang.Exception
- if setting of options failspublic void setClassifier(weka.classifiers.Classifier newClassifier)
setClassifier
in class weka.classifiers.SingleClassifierEnhancer
newClassifier
- the classifier to use.public java.lang.String evaluationTipText()
public void setEvaluation(weka.core.SelectedTag value)
value
- the evaluation criterionpublic weka.core.SelectedTag getEvaluation()
public java.lang.String YPropertyTipText()
public java.lang.String getYProperty()
public void setYProperty(java.lang.String value)
value
- the Y property.public java.lang.String YMinTipText()
public double getYMin()
public void setYMin(double value)
value
- Value to use as minimum of Y.public java.lang.String YMaxTipText()
public double getYMax()
public void setYMax(double value)
value
- Value to use as Maximum of Y.public java.lang.String YStepTipText()
public double getYStep()
public void setYStep(double value)
value
- Value to use as the step size for Y.public java.lang.String YBaseTipText()
public double getYBase()
public void setYBase(double value)
value
- Value to use as the base for Y.public java.lang.String YExpressionTipText()
public java.lang.String getYExpression()
public void setYExpression(java.lang.String value)
value
- Expression for the Y value.public java.lang.String XPropertyTipText()
public java.lang.String getXProperty()
public void setXProperty(java.lang.String value)
value
- the X property.public java.lang.String XMinTipText()
public double getXMin()
public void setXMin(double value)
value
- Value to use as minimum of X.public java.lang.String XMaxTipText()
public double getXMax()
public void setXMax(double value)
value
- Value to use as Maximum of X.public java.lang.String XStepTipText()
public double getXStep()
public void setXStep(double value)
value
- Value to use as the step size for X.public java.lang.String XBaseTipText()
public double getXBase()
public void setXBase(double value)
value
- Value to use as the base for X.public java.lang.String XExpressionTipText()
public java.lang.String getXExpression()
public void setXExpression(java.lang.String value)
value
- Expression for the X value.public java.lang.String gridIsExtendableTipText()
public boolean getGridIsExtendable()
public void setGridIsExtendable(boolean value)
value
- whether the grid can be extended dynamically.public java.lang.String maxGridExtensionsTipText()
public int getMaxGridExtensions()
public void setMaxGridExtensions(int value)
value
- the maximum of grid extensions.public java.lang.String sampleSizePercentTipText()
public double getSampleSizePercent()
public void setSampleSizePercent(double value)
value
- the sample size for the initial grid search.public java.lang.String traversalTipText()
public void setTraversal(weka.core.SelectedTag value)
value
- the traversal typepublic weka.core.SelectedTag getTraversal()
public java.lang.String logFileTipText()
public java.io.File getLogFile()
public void setLogFile(java.io.File value)
value
- the log file.public java.lang.String numExecutionSlotsTipText()
public void setNumExecutionSlots(int value)
value
- the number of slots to use.public int getNumExecutionSlots()
public weka.classifiers.Classifier getBestClassifier()
public java.util.Enumeration<java.lang.String> enumerateMeasures()
enumerateMeasures
in interface weka.core.AdditionalMeasureProducer
public double getMeasure(java.lang.String measureName)
getMeasure
in interface weka.core.AdditionalMeasureProducer
measureName
- the name of the measure to query for its valuepublic weka.classifiers.meta.GridSearch.PointDouble getValues()
public int getGridExtensionsPerformed()
getGridIsExtendable()
public weka.core.Capabilities getCapabilities()
getCapabilities
in interface weka.classifiers.Classifier
getCapabilities
in interface weka.core.CapabilitiesHandler
getCapabilities
in class weka.classifiers.SingleClassifierEnhancer
public void buildClassifier(weka.core.Instances data) throws java.lang.Exception
buildClassifier
in interface weka.classifiers.Classifier
data
- the training instancesjava.lang.Exception
- if something goes wrongpublic double[] distributionForInstance(weka.core.Instance instance) throws java.lang.Exception
distributionForInstance
in interface weka.classifiers.Classifier
distributionForInstance
in class weka.classifiers.AbstractClassifier
instance
- the instance for which distribution is computedjava.lang.Exception
- if the distribution can't be computed successfullypublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toSummaryString()
toSummaryString
in interface weka.core.Summarizable
public java.lang.String getRevision()
getRevision
in interface weka.core.RevisionHandler
getRevision
in class weka.classifiers.AbstractClassifier
public static void main(java.lang.String[] args)
args
- the options