Java Code Examples for org.apache.spark.mllib.regression.LabeledPoint#label()
The following examples show how to use
org.apache.spark.mllib.regression.LabeledPoint#label() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MLLibUtil.java From deeplearning4j with Apache License 2.0 | 5 votes |
/** * * @param point * @param numPossibleLabels * @return {@link DataSet} */ private static DataSet fromLabeledPoint(LabeledPoint point, long numPossibleLabels) { Vector features = point.features(); double label = point.label(); // FIXMEL int cast double[] fArr = features.toArray(); return new DataSet(Nd4j.create(fArr, new long[]{1,fArr.length}), FeatureUtil.toOutcomeVector((int) label, (int) numPossibleLabels)); }
Example 2
Source File: MLLibUtil.java From deeplearning4j with Apache License 2.0 | 4 votes |
private static DataSet convertToDataset(LabeledPoint lp) { Vector features = lp.features(); double label = lp.label(); return new DataSet(Nd4j.create(features.toArray()), Nd4j.create(new double[] {label})); }
Example 3
Source File: TestSparkMultiLayerParameterAveraging.java From deeplearning4j with Apache License 2.0 | 4 votes |
@Override public LabeledPoint call(LabeledPoint v1) throws Exception { return new LabeledPoint(v1.label(), Vectors.dense(v1.features().toArray())); }