Search in sources :

Example 1 with QuantileDiscretizerModelInfo

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

the class QuantileDiscretizerTrainBatchOpTest method testLazyPrint.

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

        @Override
        public void accept(QuantileDiscretizerModelInfo quantileDiscretizerModelInfo) {
            for (String s : quantileDiscretizerModelInfo.getSelectedColsInModel()) {
                System.out.println(s + ":" + JsonConverter.toJson(quantileDiscretizerModelInfo.getCutsArray(s)));
            }
        }
    });
    qop.lazyPrintModelInfo();
    BatchOperator.execute();
}
Also used : RandomTableSourceBatchOp(com.alibaba.alink.operator.batch.source.RandomTableSourceBatchOp) QuantileDiscretizerModelInfo(com.alibaba.alink.operator.common.feature.QuantileDiscretizerModelInfo) Test(org.junit.Test)

Aggregations

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