Search in sources :

Example 1 with LinearSvmPredictBatchOp

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();
}
Also used : AkSourceBatchOp(com.alibaba.alink.operator.batch.source.AkSourceBatchOp) LinearSvmTrainBatchOp(com.alibaba.alink.operator.batch.classification.LinearSvmTrainBatchOp) LinearSvmPredictBatchOp(com.alibaba.alink.operator.batch.classification.LinearSvmPredictBatchOp) AkSinkBatchOp(com.alibaba.alink.operator.batch.sink.AkSinkBatchOp)

Aggregations

LinearSvmPredictBatchOp (com.alibaba.alink.operator.batch.classification.LinearSvmPredictBatchOp)1 LinearSvmTrainBatchOp (com.alibaba.alink.operator.batch.classification.LinearSvmTrainBatchOp)1 AkSinkBatchOp (com.alibaba.alink.operator.batch.sink.AkSinkBatchOp)1 AkSourceBatchOp (com.alibaba.alink.operator.batch.source.AkSourceBatchOp)1