public final class TransformTrainer<T extends Output<T>> extends Object implements Trainer<T>
Trainer
which encapsulates another trainer plus a TransformationMap
object
to apply to each Dataset
before training each Model
.
By default transformations only operate on explicit feature values. To include implicit zeros
in transformation fitting set includeImplicitZeroFeatures
. To convert implicit
zeros to explicit zeros before applying the transformations set densify
.
See org.tribuo.transform
for a more detailed discussion of these parameters.
DEFAULT_SEED
Constructor and Description |
---|
TransformTrainer(Trainer<T> innerTrainer,
TransformationMap transformations)
Creates a trainer which transforms the data before training, and stores
the transformers along with the trained model in a
TransformedModel . |
TransformTrainer(Trainer<T> innerTrainer,
TransformationMap transformations,
boolean densify)
Creates a trainer which transforms the data before training, and stores
the transformers along with the trained model in a
TransformedModel . |
TransformTrainer(Trainer<T> innerTrainer,
TransformationMap transformations,
boolean densify,
boolean includeImplicitZeroFeatures)
Creates a trainer which transforms the data before training, and stores
the transformers along with the trained model in a
TransformedModel . |
Modifier and Type | Method and Description |
---|---|
int |
getInvocationCount()
The number of times this trainer instance has had it's train method invoked.
|
TrainerProvenance |
getProvenance() |
TransformedModel<T> |
train(Dataset<T> examples,
Map<String,com.oracle.labs.mlrg.olcut.provenance.Provenance> instanceProvenance)
Trains a predictive model using the examples in the given data set.
|
public TransformTrainer(Trainer<T> innerTrainer, TransformationMap transformations)
TransformedModel
.
Sets observeSparse
to false and so this constructor makes a trainer
which keeps the data sparse, and does not use the implicit zeros to construct
the transformations. Models produced by this trainer will not convert implicit
zeros in the feature space to explicit zeros (i.e., densify is false).
innerTrainer
- The trainer to use.transformations
- The transformations to apply to the data first.public TransformTrainer(Trainer<T> innerTrainer, TransformationMap transformations, boolean densify)
TransformedModel
.
Sets observeSparse
to false and so this constructor makes a trainer
which keeps the data sparse, and does not use the implicit zeros to construct
the transformations.
innerTrainer
- The trainer to use.transformations
- The transformations to apply to the data first.densify
- Convert the implicit zeros in each training and prediction example
to explicit zeros before training/prediction.public TransformTrainer(Trainer<T> innerTrainer, TransformationMap transformations, boolean densify, boolean includeImplicitZeroFeatures)
TransformedModel
.innerTrainer
- The trainer to use.transformations
- The transformations to apply to the data first.densify
- Convert the implicit zeros in each training and prediction example
to explicit zeros before training/prediction.includeImplicitZeroFeatures
- Use the implicit zero feature values to construct the transformations.public TransformedModel<T> train(Dataset<T> examples, Map<String,com.oracle.labs.mlrg.olcut.provenance.Provenance> instanceProvenance)
Trainer
public int getInvocationCount()
Trainer
This is used to determine how many times the trainer's RNG has been accessed to ensure replicability in the random number stream.
getInvocationCount
in interface Trainer<T extends Output<T>>
public TrainerProvenance getProvenance()
getProvenance
in interface com.oracle.labs.mlrg.olcut.provenance.Provenancable<TrainerProvenance>
Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.