Search in sources :

Example 1 with LassoRegression

use of com.alibaba.alink.pipeline.regression.LassoRegression in project Alink by alibaba.

the class Chap16 method c_3.

static void c_3() throws Exception {
    AkSourceBatchOp train_data = new AkSourceBatchOp().setFilePath(DATA_DIR + TRAIN_FILE);
    AkSourceBatchOp test_data = new AkSourceBatchOp().setFilePath(DATA_DIR + TEST_FILE);
    new LinearRegression().setFeatureCols(FEATURE_COL_NAMES).setLabelCol(LABEL_COL_NAME).setPredictionCol(PREDICTION_COL_NAME).enableLazyPrintTrainInfo().enableLazyPrintModelInfo().fit(train_data).transform(test_data).link(new EvalRegressionBatchOp().setLabelCol(LABEL_COL_NAME).setPredictionCol(PREDICTION_COL_NAME).lazyPrintMetrics("LinearRegression"));
    new LassoRegression().setLambda(0.05).setFeatureCols(FEATURE_COL_NAMES).setLabelCol(LABEL_COL_NAME).setPredictionCol(PREDICTION_COL_NAME).enableLazyPrintTrainInfo().enableLazyPrintModelInfo("< LASSO model >").fit(train_data).transform(test_data).link(new EvalRegressionBatchOp().setLabelCol(LABEL_COL_NAME).setPredictionCol(PREDICTION_COL_NAME).lazyPrintMetrics("LassoRegression"));
    BatchOperator.execute();
}
Also used : LassoRegression(com.alibaba.alink.pipeline.regression.LassoRegression) AkSourceBatchOp(com.alibaba.alink.operator.batch.source.AkSourceBatchOp) EvalRegressionBatchOp(com.alibaba.alink.operator.batch.evaluation.EvalRegressionBatchOp) LinearRegression(com.alibaba.alink.pipeline.regression.LinearRegression)

Aggregations

EvalRegressionBatchOp (com.alibaba.alink.operator.batch.evaluation.EvalRegressionBatchOp)1 AkSourceBatchOp (com.alibaba.alink.operator.batch.source.AkSourceBatchOp)1 LassoRegression (com.alibaba.alink.pipeline.regression.LassoRegression)1 LinearRegression (com.alibaba.alink.pipeline.regression.LinearRegression)1