public class RandomSearch extends ModelSearch
GridSearch
this method does better when lots of values
are to be tested or when 2 or more parameters are to be evaluated. Parameterized
interface. By
default, no parameters are selected for optimizations. This is because
parameters value ranges are often algorithm specific. As such, the user must
specify the parameters and the values to test using the addParameter
methods.
See : Bergstra, J., & Bengio, Y. (2012). Random Search for Hyper-Parameter Optimization. Journal ofMachine Learning Research, 13, 281–305.baseClassifier, baseRegressor, classificationTargetScore, folds, regressionTargetScore, reuseSameCVFolds, searchParams, trainedClassifier, trainedRegressor, trainFinalModel, trainModelsInParallel
Constructor and Description |
---|
RandomSearch(Classifier baseClassifier,
int folds)
Creates a new GridSearch to tune the specified parameters of a
classification model.
|
RandomSearch(RandomSearch toCopy)
Copy constructor
|
RandomSearch(Regressor baseRegressor,
int folds)
Creates a new GridSearch to tune the specified parameters of a regression
model.
|
Modifier and Type | Method and Description |
---|---|
void |
addParameter(DoubleParameter param,
Distribution dist)
Adds a new double parameter to be altered for the model being tuned.
|
void |
addParameter(IntParameter param,
Distribution dist)
Adds a new double parameter to be altered for the model being tuned.
|
void |
addParameter(String name,
Distribution dist)
Adds a new parameter to be altered for the model being tuned.
|
int |
autoAddParameters(DataSet data)
This method will automatically populate the search space with parameters
based on which Parameter objects return non-null distributions.
Note, using this method with Cross Validation has the potential for over-estimating the accuracy of results if the data set is actually used to for parameter guessing. It is possible for this method to return 0, indicating that no default parameters could be found. |
RandomSearch |
clone() |
int |
getTrials() |
void |
setTrials(int trials)
Sets the number of trials or samples that will be taken.
|
void |
train(RegressionDataSet dataSet) |
void |
train(RegressionDataSet dataSet,
ExecutorService threadPool) |
void |
trainC(ClassificationDataSet dataSet)
Trains the classifier and constructs a model for classification using the
given data set.
|
void |
trainC(ClassificationDataSet dataSet,
ExecutorService threadPool)
Trains the classifier and constructs a model for classification using the
given data set.
|
classify, getBaseClassifier, getBaseRegressor, getClassificationTargetScore, getParameterByName, getRegressionTargetScore, getTrainedClassifier, getTrainedRegressor, isReuseSameCVFolds, isTrainFinalModel, isTrainModelsInParallel, regress, setClassificationTargetScore, setRegressionTargetScore, setReuseSameCVFolds, setTrainFinalModel, setTrainModelsInParallel, supportsWeightedData
public RandomSearch(Regressor baseRegressor, int folds)
#addParameter(jsat.parameters.DoubleParameter, double[])
baseRegressor
- the regressor to tune the parameters offolds
- the number of folds of cross-validation to perform to
evaluate each combination of parametersFailedToFitException
- if the base regressor does not implement
Parameterized
public RandomSearch(Classifier baseClassifier, int folds)
#addParameter(jsat.parameters.DoubleParameter, double[])
baseClassifier
- the classifier to tune the parameters offolds
- the number of folds of cross-validation to perform to
evaluate each combination of parametersFailedToFitException
- if the base classifier does not implement
Parameterized
public RandomSearch(RandomSearch toCopy)
toCopy
- the object to copypublic int autoAddParameters(DataSet data)
data
- the data set to get parameter estimates frompublic void setTrials(int trials)
trials
- the number of models to build and evaluatepublic int getTrials()
public void addParameter(DoubleParameter param, Distribution dist)
param
- the model parameterinitialSearchValues
- the distribution to sample from for this parameterpublic void addParameter(IntParameter param, Distribution dist)
param
- the model parameterinitialSearchValues
- the distribution to sample from for this parameterpublic void addParameter(String name, Distribution dist)
name
- the name of the parameterinitialSearchValues
- the values to try for the specified parameterpublic void trainC(ClassificationDataSet dataSet, ExecutorService threadPool)
Classifier
dataSet
- the data set to train onthreadPool
- the source of threads to use.public void trainC(ClassificationDataSet dataSet)
Classifier
dataSet
- the data set to train onpublic void train(RegressionDataSet dataSet, ExecutorService threadPool)
public void train(RegressionDataSet dataSet)
public RandomSearch clone()
clone
in interface Classifier
clone
in interface Regressor
clone
in class ModelSearch
Copyright © 2017. All rights reserved.