Search in sources :

Example 1 with SimpleLabeledDataset

use of org.apache.ignite.ml.dataset.primitive.SimpleLabeledDataset in project ignite by apache.

the class DatasetFactory method createSimpleLabeledDataset.

/**
 * Creates a new instance of distributed {@link SimpleLabeledDataset} using the specified {@code partCtxBuilder},
 * {@code featureExtractor} and {@code lbExtractor}. This method determines partition {@code data} to be {@link
 * SimpleLabeledDatasetData}, but allows to use any desired type of partition {@code context}.
 *
 * @param datasetBuilder Dataset builder.
 * @param envBuilder Learning environment builder.
 * @param partCtxBuilder Partition {@code context} builder.
 * @param vectorizer Upstream vectorizer used to extract features and labels and build {@link
 * SimpleLabeledDatasetData}.
 * @param <K> Type of a key in {@code upstream} data.
 * @param <V> Type of a value in {@code upstream} data.
 * @param <C> Type of a partition {@code context}.
 * @return Dataset.
 */
public static <K, V, C extends Serializable, CO extends Serializable> SimpleLabeledDataset<C> createSimpleLabeledDataset(DatasetBuilder<K, V> datasetBuilder, LearningEnvironmentBuilder envBuilder, PartitionContextBuilder<K, V, C> partCtxBuilder, Preprocessor<K, V> vectorizer) {
    LearningEnvironment environment = LearningEnvironmentBuilder.defaultBuilder().buildForTrainer();
    environment.initDeployingContext(vectorizer);
    return create(datasetBuilder, envBuilder, partCtxBuilder, new SimpleLabeledDatasetDataBuilder<>(vectorizer), environment).wrap(SimpleLabeledDataset::new);
}
Also used : LearningEnvironment(org.apache.ignite.ml.environment.LearningEnvironment) SimpleLabeledDatasetDataBuilder(org.apache.ignite.ml.dataset.primitive.builder.data.SimpleLabeledDatasetDataBuilder) SimpleLabeledDataset(org.apache.ignite.ml.dataset.primitive.SimpleLabeledDataset)

Aggregations

SimpleLabeledDataset (org.apache.ignite.ml.dataset.primitive.SimpleLabeledDataset)1 SimpleLabeledDatasetDataBuilder (org.apache.ignite.ml.dataset.primitive.builder.data.SimpleLabeledDatasetDataBuilder)1 LearningEnvironment (org.apache.ignite.ml.environment.LearningEnvironment)1