I
- Type of trainers inputs.O
- Type of trainers outputs.L
- Type of dataset labels.public class TrainersParallelComposition<I,O,L> extends DatasetTrainer<IgniteModel<I,List<O>>,L>
1. Independently train all trainers on the same dataset and get a list of models.
2. Combine models produced in step (1) into a ModelsParallelComposition
.
Updating is made in a similar fashion. Like in other trainers combinators we avoid to include type of contained
trainers in type parameters because otherwise compositions of compositions would have a relatively complex generic
type which will reduce readability.DatasetTrainer.EmptyDatasetException
envBuilder, environment
Constructor and Description |
---|
TrainersParallelComposition(List<T> trainers)
Construct an instance of this class from a list of trainers.
|
Modifier and Type | Method and Description |
---|---|
<K,V> IgniteModel<I,List<O>> |
fitWithInitializedDeployingContext(DatasetBuilder<K,V> datasetBuilder,
Preprocessor<K,V> preprocessor)
Trains model based on the specified data.
|
boolean |
isUpdateable(IgniteModel<I,List<O>> mdl)
This method is never called, instead of constructing logic of update from
DatasetTrainer.isUpdateable(M) and
DatasetTrainer.updateModel(M, org.apache.ignite.ml.dataset.DatasetBuilder<K, V>, org.apache.ignite.ml.preprocessing.Preprocessor<K, V>) in this class we explicitly override update method. |
static <I,O,M extends IgniteModel<I,O>,T extends DatasetTrainer<M,L>,L> |
of(List<T> trainers)
Create parallel composition of trainers contained in a given list.
|
<K,V> IgniteModel<I,List<O>> |
update(IgniteModel<I,List<O>> mdl,
DatasetBuilder<K,V> datasetBuilder,
Preprocessor<K,V> preprocessor)
Gets state of model in arguments, compare it with training parameters of trainer and if they are fit then trainer
updates model in according to new data and return new model.
|
protected <K,V> IgniteModel<I,List<O>> |
updateModel(IgniteModel<I,List<O>> mdl,
DatasetBuilder<K,V> datasetBuilder,
Preprocessor<K,V> preprocessor)
This method is never called, instead of constructing logic of update from
DatasetTrainer.isUpdateable(IgniteModel) and DatasetTrainer.updateModel(IgniteModel, DatasetBuilder, Preprocessor)
in this class we explicitly override update method. |
fit, fit, fit, fit, fit, fit, getLastTrainedModelOrThrowEmptyDatasetException, identityTrainer, learningEnvironment, update, update, update, update, withConvertedLabels, withEnvironmentBuilder
public TrainersParallelComposition(List<T> trainers)
T
- Type of trainer.trainers
- Trainers.public static <I,O,M extends IgniteModel<I,O>,T extends DatasetTrainer<M,L>,L> TrainersParallelComposition<I,O,L> of(List<T> trainers)
I
- Type of input of model priduced by trainers.O
- Type of output of model priduced by trainers.M
- Type of model priduced by trainers.T
- Type of trainers.L
- Type of input of labels.trainers
- List of trainers.public <K,V> IgniteModel<I,List<O>> fitWithInitializedDeployingContext(DatasetBuilder<K,V> datasetBuilder, Preprocessor<K,V> preprocessor)
fitWithInitializedDeployingContext
in class DatasetTrainer<IgniteModel<I,List<O>>,L>
K
- Type of a key in upstream
data.V
- Type of a value in upstream
data.datasetBuilder
- Dataset builder.preprocessor
- Extractor of UpstreamEntry
into LabeledVector
.public <K,V> IgniteModel<I,List<O>> update(IgniteModel<I,List<O>> mdl, DatasetBuilder<K,V> datasetBuilder, Preprocessor<K,V> preprocessor)
update
in class DatasetTrainer<IgniteModel<I,List<O>>,L>
K
- Type of a key in upstream
data.V
- Type of a value in upstream
data.mdl
- Learned model.datasetBuilder
- Dataset builder.preprocessor
- Extractor of UpstreamEntry
into LabeledVector
.public boolean isUpdateable(IgniteModel<I,List<O>> mdl)
DatasetTrainer.isUpdateable(M)
and
DatasetTrainer.updateModel(M, org.apache.ignite.ml.dataset.DatasetBuilder<K, V>, org.apache.ignite.ml.preprocessing.Preprocessor<K, V>)
in this class we explicitly override update method.isUpdateable
in class DatasetTrainer<IgniteModel<I,List<O>>,L>
mdl
- Model.protected <K,V> IgniteModel<I,List<O>> updateModel(IgniteModel<I,List<O>> mdl, DatasetBuilder<K,V> datasetBuilder, Preprocessor<K,V> preprocessor)
DatasetTrainer.isUpdateable(IgniteModel)
and DatasetTrainer.updateModel(IgniteModel, DatasetBuilder, Preprocessor)
in this class we explicitly override update method.updateModel
in class DatasetTrainer<IgniteModel<I,List<O>>,L>
K
- Type of a key in upstream
data.V
- Type of a value in upstream
data.mdl
- Model.datasetBuilder
- Dataset builder.preprocessor
- Extractor of UpstreamEntry
into LabeledVector
.
GridGain In-Memory Computing Platform : ver. 8.9.14 Release Date : November 5 2024