use of org.apache.spark.mllib.classification.SVMModel in project incubator-sdap-mudrod by apache.
the class SparkSVM method main.
public static void main(String[] args) {
MudrodEngine me = new MudrodEngine();
JavaSparkContext jsc = me.startSparkDriver().sc;
String path = SparkSVM.class.getClassLoader().getResource("inputDataForSVM_spark.txt").toString();
JavaRDD<LabeledPoint> data = MLUtils.loadLibSVMFile(jsc.sc(), path).toJavaRDD();
// Run training algorithm to build the model.
int numIterations = 100;
final SVMModel model = SVMWithSGD.train(data.rdd(), numIterations);
// Save and load model
model.save(jsc.sc(), SparkSVM.class.getClassLoader().getResource("javaSVMWithSGDModel").toString());
jsc.sc().stop();
}
Aggregations