Search in sources :

Example 1 with OneHotModelInfo

use of com.alibaba.alink.operator.common.feature.OneHotModelInfo in project Alink by alibaba.

the class OneHotTrainBatchOpTest method testLazyPrint.

@Test
public void testLazyPrint() throws Exception {
    RandomTableSourceBatchOp op = new RandomTableSourceBatchOp().setIdCol("id").setNumCols(40).setNumRows(200L);
    OneHotTrainBatchOp qop = new OneHotTrainBatchOp().setSelectedCols(ArrayUtils.removeElements(op.getColNames(), "id")).linkFrom(op);
    qop.lazyCollectModelInfo(new Consumer<OneHotModelInfo>() {

        @Override
        public void accept(OneHotModelInfo oneHotModelInfo) {
            for (String s : oneHotModelInfo.getSelectedColsInModel()) {
                Assert.assertEquals(oneHotModelInfo.getDistinctTokenNumber(s).intValue(), 200);
            }
        }
    });
    qop.lazyPrintModelInfo();
    BatchOperator.execute();
}
Also used : OneHotModelInfo(com.alibaba.alink.operator.common.feature.OneHotModelInfo) RandomTableSourceBatchOp(com.alibaba.alink.operator.batch.source.RandomTableSourceBatchOp) Test(org.junit.Test)

Aggregations

RandomTableSourceBatchOp (com.alibaba.alink.operator.batch.source.RandomTableSourceBatchOp)1 OneHotModelInfo (com.alibaba.alink.operator.common.feature.OneHotModelInfo)1 Test (org.junit.Test)1