Documentation of 'jsat.parameters.ModelSearch' Java class
ModelSearch
jsat.parameters

Class ModelSearch

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Classifier, Regressor
    Direct Known Subclasses:
    GridSearch, RandomSearch


    public abstract class ModelSearch
    extends java.lang.Object
    implements Classifier, Regressor
    This abstract class provides boilerplate for algorithms that search a model's parameter space to find the parameters that provide the best overall performance.
    See Also:
    Serialized Form
    • Constructor Detail

      • ModelSearch

        public ModelSearch(Regressor baseRegressor,
                           int folds)
      • ModelSearch

        public ModelSearch(Classifier baseClassifier,
                           int folds)
      • ModelSearch

        public ModelSearch(ModelSearch toCopy)
        Copy constructor
        Parameters:
        toCopy - the object to copy
    • Method Detail

      • setTrainModelsInParallel

        public void setTrainModelsInParallel(boolean trainInParallel)
        When set to true (the default) parallelism is obtained by training as many models in parallel as possible. If false, parallelsm will be obtained by training the model using the Classifier#train(jsat.classifiers.ClassificationDataSet, java.util.concurrent.ExecutorService) and Regressor#train(jsat.regression.RegressionDataSet, java.util.concurrent.ExecutorService) methods.

        When a model supports warms starts, parallelism obtained by training the models in parallel is intrinsically reduced, as a model can not be warms started until another model has finished. In the case that one of the parameters is annotated as a warm paramter , that parameter will be the one rained sequential, and for every other parameter combination models will be trained in parallel. If there is no warm parameter, the first parameter added will be used for warm training. If there is only one parameter and warm training is occurring, no parallelism will be obtained.
        Parameters:
        trainInParallel - true to get parallelism from training many models at the same time, false to get parallelism from getting the model's implicit parallelism.
      • isTrainModelsInParallel

        public boolean isTrainModelsInParallel()
        Returns:
        true if parallelism is obtained from training many models at the same time, false if parallelism is obtained from using the model's implicit parallelism.
      • setTrainFinalModel

        public void setTrainFinalModel(boolean trainFinalModel)
        If true (the default) the model that was found to be best is trained on the whole data set at the end. If false, the final model will not be trained. This means that this Object will not be usable for predictoin. This should only be set if you know you will not be using this model but only want to get the information about which parameter combination is best.
        Parameters:
        trainFinalModel - true to train the final model after grid search, false to not do that.
      • isTrainFinalModel

        public boolean isTrainFinalModel()
        Returns:
        true to train the final model after grid search, false to not do that.
      • setReuseSameCVFolds

        public void setReuseSameCVFolds(boolean reuseSameSplit)
        Sets whether or not one set of CV folds is created and re used for every parameter combination (the default), or if a difference set of CV folds will be used for every parameter combination.
        Parameters:
        reuseSameSplit - true if the same split is re-used for every combination, false if a new CV set is used for every parameter combination.
      • isReuseSameCVFolds

        public boolean isReuseSameCVFolds()
        Returns:
        true if the same split is re-used for every combination, false if a new CV set is used for every parameter combination.
      • getBaseClassifier

        public Classifier getBaseClassifier()
        Returns the base classifier that was originally passed in when constructing this GridSearch. If this was not constructed with a classifier, this may return null.
        Returns:
        the original classifier object given
      • getTrainedClassifier

        public Classifier getTrainedClassifier()
        Returns the resultant classifier trained on the whole data set after performing parameter tuning.
        Returns:
        the trained classifier after a call to #train(jsat.regression.RegressionDataSet, java.util.concurrent.ExecutorService) , or null if it has not been trained.
      • getBaseRegressor

        public Regressor getBaseRegressor()
        Returns the base regressor that was originally passed in when constructing this GridSearch. If this was not constructed with a regressor, this may return null.
        Returns:
        the original regressor object given
      • getTrainedRegressor

        public Regressor getTrainedRegressor()
        Returns the resultant regressor trained on the whole data set after performing parameter tuning.
        Returns:
        the trained regressor after a call to #train(jsat.regression.RegressionDataSet, java.util.concurrent.ExecutorService) , or null if it has not been trained.
      • setClassificationTargetScore

        public void setClassificationTargetScore(ClassificationScore classifierTargetScore)
        Sets the score to attempt to optimize when performing grid search on a classification problem.
        Parameters:
        classifierTargetScore - the score to optimize via grid search
      • getClassificationTargetScore

        public ClassificationScore getClassificationTargetScore()
        Returns the classification score that is trying to be optimized via grid search
        Returns:
        the classification score that is trying to be optimized via grid search
      • setRegressionTargetScore

        public void setRegressionTargetScore(RegressionScore regressionTargetScore)
        Sets the score to attempt to optimize when performing grid search on a regression problem.
        Parameters:
        regressionTargetScore -
      • getRegressionTargetScore

        public RegressionScore getRegressionTargetScore()
        Returns the regression score that is trying to be optimized via grid search
        Returns:
        the regression score that is trying to be optimized via grid search
      • classify

        public CategoricalResults classify(DataPoint data)
        Description copied from interface: Classifier
        Performs classification on the given data point.
        Specified by:
        classify in interface Classifier
        Parameters:
        data - the data point to classify
        Returns:
        the results of the classification.
      • supportsWeightedData

        public boolean supportsWeightedData()
        Description copied from interface: Classifier
        Indicates whether the model knows how to train using weighted data points. If it does, the model will train assuming the weights. The values returned by this method may change depending on the parameters set for the model.
        Specified by:
        supportsWeightedData in interface Classifier
        Specified by:
        supportsWeightedData in interface Regressor
        Returns:
        true if the model supports weighted data, false otherwise

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.