use of com.alibaba.alink.pipeline.classification.LogisticRegression in project Alink by alibaba.
the class Chap13 method c_3.
static void c_3() throws Exception {
AkSourceBatchOp train_data = new AkSourceBatchOp().setFilePath(DATA_DIR + SPARSE_TRAIN_FILE);
AkSourceBatchOp test_data = new AkSourceBatchOp().setFilePath(DATA_DIR + SPARSE_TEST_FILE);
BatchOperator.setParallelism(1);
new OneVsRest().setClassifier(new LogisticRegression().setVectorCol(VECTOR_COL_NAME).setLabelCol(LABEL_COL_NAME).setPredictionCol(PREDICTION_COL_NAME)).setNumClass(10).fit(train_data).transform(test_data).link(new EvalMultiClassBatchOp().setLabelCol(LABEL_COL_NAME).setPredictionCol(PREDICTION_COL_NAME).lazyPrintMetrics("OneVsRest - LogisticRegression"));
new OneVsRest().setClassifier(new LinearSvm().setVectorCol(VECTOR_COL_NAME).setLabelCol(LABEL_COL_NAME).setPredictionCol(PREDICTION_COL_NAME)).setNumClass(10).fit(train_data).transform(test_data).link(new EvalMultiClassBatchOp().setLabelCol(LABEL_COL_NAME).setPredictionCol(PREDICTION_COL_NAME).lazyPrintMetrics("OneVsRest - LinearSvm"));
BatchOperator.execute();
}
use of com.alibaba.alink.pipeline.classification.LogisticRegression in project Alink by alibaba.
the class LogisticRegressionMixVecTest method batchMixVecTest5.
@Test
public void batchMixVecTest5() {
BatchOperator<?> trainData = (BatchOperator<?>) getData();
Pipeline pipeline = new Pipeline().add(new LogisticRegression().setVectorCol("svec").setWithIntercept(false).setStandardization(false).setLabelCol("labels").setPredictionCol("pred"));
PipelineModel model = pipeline.fit(trainData);
model.transform(trainData).collect();
}
use of com.alibaba.alink.pipeline.classification.LogisticRegression in project Alink by alibaba.
the class LogisticRegressionMixVecTest method batchMixVecTest15.
@Test
public void batchMixVecTest15() {
BatchOperator<?> trainData = (BatchOperator<?>) getData();
Pipeline pipeline = new Pipeline().add(new LogisticRegression().setVectorCol("svec2").setWithIntercept(false).setStandardization(false).setLabelCol("labels").setPredictionCol("pred"));
PipelineModel model = pipeline.fit(trainData);
model.transform(trainData).collect();
}
use of com.alibaba.alink.pipeline.classification.LogisticRegression in project Alink by alibaba.
the class LogisticRegressionMixVecTest method batchMixVecTest8.
@Test
public void batchMixVecTest8() {
BatchOperator<?> trainData = (BatchOperator<?>) getData();
Pipeline pipeline = new Pipeline().add(new LogisticRegression().setVectorCol("vec").setWithIntercept(false).setStandardization(true).setLabelCol("labels").setPredictionCol("pred"));
PipelineModel model = pipeline.fit(trainData);
model.transform(trainData).collect();
}
use of com.alibaba.alink.pipeline.classification.LogisticRegression in project Alink by alibaba.
the class LogisticRegressionMixVecTest method batchMixVecTest6.
@Test
public void batchMixVecTest6() {
BatchOperator<?> trainData = (BatchOperator<?>) getData();
Pipeline pipeline = new Pipeline().add(new LogisticRegression().setVectorCol("vec").setWithIntercept(false).setStandardization(false).setLabelCol("labels").setPredictionCol("pred"));
PipelineModel model = pipeline.fit(trainData);
model.transform(trainData).collect();
}
Aggregations