/** * As regression data set dataset. * * @param featurizer the featurizer * @param labelAttributeType the label attribute * @return the dataset */ default Dataset<Instance> asRegressionDataSet( @NonNull Featurizer<HString> featurizer, @NonNull AttributeType labelAttributeType) { return Dataset.regression() .type(getDataSetType()) .source(asLabeledStream(labelAttributeType).map(featurizer::extractLabeled)) .build(); }
/** * As regression data set dataset. * * @param featurizer the featurizer * @param labelFunction the label function * @return the dataset */ default Dataset<Instance> asRegressionDataSet( @NonNull Featurizer<HString> featurizer, @NonNull SerializableFunction<HString, Double> labelFunction) { return Dataset.regression() .type(getDataSetType()) .source(asLabeledStream(labelFunction).map(featurizer::extractLabeled)) .build(); }
/** * As sequence data set dataset. * * @param sequenceType the sequence type * @param featurizer the featurizer * @return the dataset */ default Dataset<Sequence> asSequenceDataSet( @NonNull AnnotationType sequenceType, @NonNull SequenceFeaturizer<Annotation> featurizer) { return Dataset.sequence() .type(getDataSetType()) .source( asSequenceStream(sequenceType).map(seq -> featurizer.extractSequence(seq.iterator()))) .build(); }
/** * As sequence data set dataset. * * @param labelFunction the label function * @param featurizer the featurizer * @return the dataset */ default Dataset<Sequence> asSequenceDataSet( @NonNull Function<? super Annotation, String> labelFunction, @NonNull SequenceFeaturizer<Annotation> featurizer) { return Dataset.sequence() .type(getDataSetType()) .source( asSequenceStream(labelFunction).map(seq -> featurizer.extractSequence(seq.iterator()))) .build(); }
/** * As regression data set dataset. * * @param featurizer the featurizer * @return the dataset */ default Dataset<Instance> asRegressionDataSet(@NonNull Featurizer<HString> featurizer) { return Dataset.regression() .type(getDataSetType()) .source(stream().map(featurizer::extract)) .build(); }