use of com.alibaba.alink.pipeline.feature.OneHotEncoderModel in project Alink by alibaba.
the class SplitBatchOpTest method testSplitAfterOneHot.
@Test
public void testSplitAfterOneHot() throws Exception {
BatchOperator data = Iris.getBatchData();
OneHotEncoderModel model = new OneHotEncoder().setSelectedCols(Iris.getFeatureColNames()).setReservedCols(Iris.getLabelColName()).setOutputCols("features").fit(data);
data = model.transform(data);
SplitBatchOp split = new SplitBatchOp().setFraction(0.4);
BatchOperator data1 = split.linkFrom(data);
BatchOperator data2 = split.getSideOutput(0);
Assert.assertEquals(data1.count(), 60);
Assert.assertEquals(data2.count(), 90);
}
Aggregations