public static JavaRDD<LabeledPoint> fromDataSet(JavaRDD<DataSet> data, boolean preCache) {
        if (preCache && !data.getStorageLevel().useMemory()) {
            data.cache();
        }
        return data.map(new Function<DataSet, LabeledPoint>() {
            @Override
            public LabeledPoint call(DataSet dataSet) {
                return toLabeledPoint(dataSet);
            }
        });
    }
public static JavaRDD < LabeledPoint > fromDataSet ( JavaRDD < DataSet > data , boolean preCache ) { if ( preCache && ! data . getStorageLevel ( ) . useMemory ( ) ) { data . cache ( ) ; } return data . map ( new Function < DataSet , LabeledPoint > ( ) { @ Override public LabeledPoint call ( DataSet dataSet ) { return toLabeledPoint ( dataSet ) ; } } ) ; }
Convert an rdd of data set in to labeled point.
@param data the dataset to convert
@param preCache boolean pre-cache rdd before operation
@return an rdd of labeled point