All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.deeplearning4j.spark.util.SparkDataUtils Maven / Gradle / Ivy

There is a newer version: 1.0.0-beta_spark_2
Show newest version
package org.deeplearning4j.spark.util;

import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.datavec.api.records.reader.RecordReader;
import org.deeplearning4j.spark.datavec.RecordReaderFunction;
import org.nd4j.linalg.dataset.DataSet;

/**
 * Created by Alex on 15/06/2016.
 */
public class SparkDataUtils {

    private JavaRDD loadFromTextFile(String path, int labelIndex, int numClasses, RecordReader recordReader, JavaSparkContext sc){
        JavaRDD lines = sc.textFile(path);
        // gotta map this to a Matrix/INDArray
        return lines.map(new RecordReaderFunction(recordReader, labelIndex, numClasses));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy