use of com.alibaba.alink.operator.batch.feature.EqualWidthDiscretizerTrainBatchOp in project Alink by alibaba.
the class EqualWidthDiscretizerTest method testInitializer.
@Test
public void testInitializer() {
EqualWidthDiscretizerModel model = new EqualWidthDiscretizerModel();
Assert.assertEquals(model.getParams().size(), 0);
EqualWidthDiscretizer op = new EqualWidthDiscretizer(new Params());
Assert.assertEquals(op.getParams().size(), 0);
BatchOperator<?> b = new EqualWidthDiscretizerTrainBatchOp();
Assert.assertEquals(b.getParams().size(), 0);
b = new EqualWidthDiscretizerTrainBatchOp(new Params());
Assert.assertEquals(b.getParams().size(), 0);
b = new EqualWidthDiscretizerPredictBatchOp();
Assert.assertEquals(b.getParams().size(), 0);
b = new EqualWidthDiscretizerPredictBatchOp(new Params());
Assert.assertEquals(b.getParams().size(), 0);
StreamOperator<?> s = new EqualWidthDiscretizerPredictStreamOp(b);
Assert.assertEquals(s.getParams().size(), 0);
s = new EqualWidthDiscretizerPredictStreamOp(b, new Params());
Assert.assertEquals(s.getParams().size(), 0);
}
use of com.alibaba.alink.operator.batch.feature.EqualWidthDiscretizerTrainBatchOp in project Alink by alibaba.
the class EqualWidthDiscretizerTest method testException.
@Test
public void testException() throws Exception {
thrown.expect(RuntimeException.class);
NumSeqSourceBatchOp numSeqSourceBatchOp = new NumSeqSourceBatchOp(0, 10, "col0");
EqualWidthDiscretizerTrainBatchOp op = new EqualWidthDiscretizerTrainBatchOp().setNumBuckets(5).setNumBucketsArray(5, 4).setSelectedCols("col0").linkFrom(numSeqSourceBatchOp);
op.lazyPrintModelInfo();
op = new EqualWidthDiscretizerTrainBatchOp().setNumBucketsArray(5).setSelectedCols("col0").linkFrom(numSeqSourceBatchOp);
op.lazyCollect(new Consumer<List<Row>>() {
@Override
public void accept(List<Row> rows) {
System.out.println(Arrays.toString(new EqualWidthDiscretizerModelInfoBatchOp.EqualWidthDiscretizerModelInfo(rows).getCutsArray("col0")));
}
});
}
Aggregations