use of com.alibaba.alink.operator.batch.feature.ChiSqSelectorBatchOp in project Alink by alibaba.
the class Chap09 method c_3.
static void c_3() throws Exception {
CsvSourceBatchOp source = new CsvSourceBatchOp().setFilePath(DATA_DIR + ORIGIN_FILE).setSchemaStr(Utils.generateSchemaString(COL_NAMES, COL_TYPES));
source.lazyPrint(5, "< origin data >");
Utils.splitTrainTestIfNotExist(source, DATA_DIR + TRAIN_FILE, DATA_DIR + TEST_FILE, 0.9);
new AkSourceBatchOp().setFilePath(DATA_DIR + TRAIN_FILE).link(new ChiSqSelectorBatchOp().setSelectorType(SelectorType.NumTopFeatures).setNumTopFeatures(3).setSelectedCols(FEATURE_COL_NAMES).setLabelCol(LABEL_COL_NAME).lazyPrintModelInfo("< Chi-Square Selector >"));
new AkSourceBatchOp().setFilePath(DATA_DIR + TRAIN_FILE).select("veil_type").distinct().lazyPrint(100);
BatchOperator.execute();
}
Aggregations