Search in sources :

Example 1 with DocumentSequenceConvertFunction

use of org.deeplearning4j.spark.models.paragraphvectors.functions.DocumentSequenceConvertFunction in project deeplearning4j by deeplearning4j.

the class SparkParagraphVectors method fitLabelledDocuments.

/**
     * This method builds ParagraphVectors model, expecting JavaRDD<LabelledDocument>.
     * It can be either non-tokenized documents, or tokenized.
     *
     * @param documentsRdd
     */
public void fitLabelledDocuments(JavaRDD<LabelledDocument> documentsRdd) {
    validateConfiguration();
    broadcastEnvironment(new JavaSparkContext(documentsRdd.context()));
    JavaRDD<Sequence<VocabWord>> sequenceRDD = documentsRdd.map(new DocumentSequenceConvertFunction(configurationBroadcast));
    super.fitSequences(sequenceRDD);
}
Also used : JavaSparkContext(org.apache.spark.api.java.JavaSparkContext) Sequence(org.deeplearning4j.models.sequencevectors.sequence.Sequence) DocumentSequenceConvertFunction(org.deeplearning4j.spark.models.paragraphvectors.functions.DocumentSequenceConvertFunction)

Aggregations

JavaSparkContext (org.apache.spark.api.java.JavaSparkContext)1 Sequence (org.deeplearning4j.models.sequencevectors.sequence.Sequence)1 DocumentSequenceConvertFunction (org.deeplearning4j.spark.models.paragraphvectors.functions.DocumentSequenceConvertFunction)1