use of com.alibaba.alink.operator.batch.classification.LinearSvmPredictBatchOp in project Alink by alibaba.
the class Chap08 method c_6.
static void c_6() throws Exception {
AkSourceBatchOp train_data = new AkSourceBatchOp().setFilePath(DATA_DIR + TRAIN_FILE);
AkSourceBatchOp test_data = new AkSourceBatchOp().setFilePath(DATA_DIR + TEST_FILE);
LinearSvmTrainBatchOp svmTrainer = new LinearSvmTrainBatchOp().setFeatureCols(FEATURE_COL_NAMES).setLabelCol(LABEL_COL_NAME);
LinearSvmPredictBatchOp svmPredictor = new LinearSvmPredictBatchOp().setPredictionCol(PREDICTION_COL_NAME).setPredictionDetailCol(PRED_DETAIL_COL_NAME);
train_data.link(svmTrainer);
svmPredictor.linkFrom(svmTrainer, test_data);
svmTrainer.lazyPrintTrainInfo().lazyPrintModelInfo();
svmPredictor.lazyPrint(5, "< Prediction >").link(new AkSinkBatchOp().setFilePath(DATA_DIR + SVM_PRED_FILE).setOverwriteSink(true));
BatchOperator.execute();
}
Aggregations