public class LibLinearRegressionTrainer extends LibLinearTrainer<Regressor>
Trainer
which wraps a liblinear-java regression trainer.
This generates an independent liblinear model for each regression dimension.
Note the train method is synchronized on LibLinearTrainer.class
due to a global RNG in liblinear-java.
This is insufficient to ensure reproducibility if liblinear-java is used directly in the same JVM as Tribuo, but
avoids locking on classes Tribuo does not control.
See:
Fan RE, Chang KW, Hsieh CJ, Wang XR, Lin CJ. "LIBLINEAR: A library for Large Linear Classification" Journal of Machine Learning Research, 2008.and for the original algorithm:
Cortes C, Vapnik V. "Support-Vector Networks" Machine Learning, 1995.
cost, epsilon, libLinearParams, maxIterations, terminationCriterion, trainerType
DEFAULT_SEED
Constructor and Description |
---|
LibLinearRegressionTrainer()
Creates a trainer using the default values (L2R_L2LOSS_SVR, 1, 1000, 0.1, 0.1).
|
LibLinearRegressionTrainer(LinearRegressionType trainerType)
Creates a trainer for a LibLinear regression model.
|
LibLinearRegressionTrainer(LinearRegressionType trainerType,
double cost,
int maxIterations,
double terminationCriterion,
double epsilon)
Creates a trainer for a LibLinear regression model.
|
Modifier and Type | Method and Description |
---|---|
protected LibLinearModel<Regressor> |
createModel(ModelProvenance provenance,
ImmutableFeatureMap featureIDMap,
ImmutableOutputInfo<Regressor> outputIDInfo,
List<de.bwaldvogel.liblinear.Model> models)
Construct the appropriate subtype of LibLinearModel for the prediction task.
|
protected com.oracle.labs.mlrg.olcut.util.Pair<de.bwaldvogel.liblinear.FeatureNode[][],double[][]> |
extractData(Dataset<Regressor> data,
ImmutableOutputInfo<Regressor> outputInfo,
ImmutableFeatureMap featureMap)
Extracts the features and
Output s in LibLinear's format. |
void |
postConfig()
Used by the OLCUT configuration system, and should not be called by external code.
|
protected List<de.bwaldvogel.liblinear.Model> |
trainModels(de.bwaldvogel.liblinear.Parameter curParams,
int numFeatures,
de.bwaldvogel.liblinear.FeatureNode[][] features,
double[][] outputs)
Train all the liblinear instances necessary for this dataset.
|
exampleToNodes, getInvocationCount, getProvenance, setupParameters, toString, train, train
public LibLinearRegressionTrainer()
public LibLinearRegressionTrainer(LinearRegressionType trainerType)
Uses the default values of cost = 1.0, maxIterations = 1000, terminationCriterion = 0.1, epsilon = 0.1.
trainerType
- Loss function and optimisation method.public LibLinearRegressionTrainer(LinearRegressionType trainerType, double cost, int maxIterations, double terminationCriterion, double epsilon)
trainerType
- Loss function and optimisation method combination.cost
- Cost penalty for each incorrectly classified training point.maxIterations
- The maximum number of dataset iterations.terminationCriterion
- How close does the optimisation function need to be before terminating that subproblem (usually set to 0.1).epsilon
- The insensitivity of the regression loss to small differences.public void postConfig()
postConfig
in interface com.oracle.labs.mlrg.olcut.config.Configurable
postConfig
in class LibLinearTrainer<Regressor>
protected List<de.bwaldvogel.liblinear.Model> trainModels(de.bwaldvogel.liblinear.Parameter curParams, int numFeatures, de.bwaldvogel.liblinear.FeatureNode[][] features, double[][] outputs)
LibLinearTrainer
trainModels
in class LibLinearTrainer<Regressor>
curParams
- The LibLinear parameters.numFeatures
- The number of features in this dataset.features
- The features themselves.outputs
- The outputs.protected LibLinearModel<Regressor> createModel(ModelProvenance provenance, ImmutableFeatureMap featureIDMap, ImmutableOutputInfo<Regressor> outputIDInfo, List<de.bwaldvogel.liblinear.Model> models)
LibLinearTrainer
createModel
in class LibLinearTrainer<Regressor>
provenance
- The model provenance.featureIDMap
- The feature id map.outputIDInfo
- The output id info.models
- The list of linear models.protected com.oracle.labs.mlrg.olcut.util.Pair<de.bwaldvogel.liblinear.FeatureNode[][],double[][]> extractData(Dataset<Regressor> data, ImmutableOutputInfo<Regressor> outputInfo, ImmutableFeatureMap featureMap)
LibLinearTrainer
Output
s in LibLinear's format.extractData
in class LibLinearTrainer<Regressor>
data
- The input data.outputInfo
- The output info.featureMap
- The feature info.Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.