use of com.alibaba.alink.operator.batch.dataproc.FlattenMTableBatchOp in project Alink by alibaba.
the class ProphetBatchOpTest method test2.
@Ignore
@Test
public void test2() throws Exception {
AlinkGlobalConfiguration.setPrintProcessInfo(true);
Row[] rowsData = new Row[] { Row.of("20210501", 0.1, "a1"), Row.of("20210502", 0.2, "a1"), Row.of("20210503", 0.3, "a1"), Row.of("20210504", 0.4, "a1"), Row.of("20210505", 0.5, "a1"), Row.of("20210506", 0.6, "a1"), Row.of("20210507", 0.7, "a1"), Row.of("20210508", 0.8, "a1"), Row.of("20210509", 0.9, "a1") };
String[] colNames = new String[] { "ds", "f1", "f2" };
// train batch model.
MemSourceBatchOp source = new MemSourceBatchOp(Arrays.asList(rowsData), colNames);
source.select("to_timestamp(ds, 'yyyyMMdd') as ds, f1 as val, f2 as id").link(new GroupByBatchOp().setGroupByPredicate("id").setSelectClause("id, mtable_agg(ds, val) as data")).link(new ProphetBatchOp().setValueCol("data").setPredictionCol("pred").setPredictNum(12).setUncertaintySamples(0).setReservedCols("id").setPythonEnv("file:///Users/ning.cain/soft/miniforge3/envs/py39t/")).link(new FlattenMTableBatchOp().setReservedCols("id").setSelectedCol("pred").setSchemaStr("ds string, val double")).print();
}
Aggregations