Search in sources :

Example 1 with DocCountVectorizerTrainBatchOp

use of com.alibaba.alink.operator.batch.nlp.DocCountVectorizerTrainBatchOp in project Alink by alibaba.

the class DocCountVectorizerTest method testInitializer.

@Test
public void testInitializer() {
    DocCountVectorizerModel model = new DocCountVectorizerModel();
    Assert.assertEquals(model.getParams().size(), 0);
    DocCountVectorizer op = new DocCountVectorizer(new Params());
    Assert.assertEquals(op.getParams().size(), 0);
    BatchOperator<?> b = new DocCountVectorizerTrainBatchOp();
    Assert.assertEquals(b.getParams().size(), 0);
    b = new DocCountVectorizerTrainBatchOp(new Params());
    Assert.assertEquals(b.getParams().size(), 0);
    b = new DocCountVectorizerPredictBatchOp();
    Assert.assertEquals(b.getParams().size(), 0);
    b = new DocCountVectorizerPredictBatchOp(new Params());
    Assert.assertEquals(b.getParams().size(), 0);
    StreamOperator<?> s = new DocCountVectorizerPredictStreamOp(b);
    Assert.assertEquals(s.getParams().size(), 0);
    s = new DocCountVectorizerPredictStreamOp(b, new Params());
    Assert.assertEquals(s.getParams().size(), 0);
}
Also used : DocCountVectorizerPredictBatchOp(com.alibaba.alink.operator.batch.nlp.DocCountVectorizerPredictBatchOp) Params(org.apache.flink.ml.api.misc.param.Params) DocCountVectorizerTrainBatchOp(com.alibaba.alink.operator.batch.nlp.DocCountVectorizerTrainBatchOp) DocCountVectorizerPredictStreamOp(com.alibaba.alink.operator.stream.nlp.DocCountVectorizerPredictStreamOp) Test(org.junit.Test)

Example 2 with DocCountVectorizerTrainBatchOp

use of com.alibaba.alink.operator.batch.nlp.DocCountVectorizerTrainBatchOp in project Alink by alibaba.

the class DocCountVectorizerTest method testException.

@Test(expected = RuntimeException.class)
public void testException() throws Exception {
    BatchOperator<?> data = new MemSourceBatchOp(rows, new String[] { "id", "sentence", "label" });
    DocCountVectorizerTrainBatchOp op = new DocCountVectorizerTrainBatchOp().setSelectedCol("sentence").setMinDF(2.).setMaxDF(1.).setFeatureType("TF").linkFrom(data);
    op.collect();
}
Also used : MemSourceBatchOp(com.alibaba.alink.operator.batch.source.MemSourceBatchOp) DocCountVectorizerTrainBatchOp(com.alibaba.alink.operator.batch.nlp.DocCountVectorizerTrainBatchOp) Test(org.junit.Test)

Aggregations

DocCountVectorizerTrainBatchOp (com.alibaba.alink.operator.batch.nlp.DocCountVectorizerTrainBatchOp)2 Test (org.junit.Test)2 DocCountVectorizerPredictBatchOp (com.alibaba.alink.operator.batch.nlp.DocCountVectorizerPredictBatchOp)1 MemSourceBatchOp (com.alibaba.alink.operator.batch.source.MemSourceBatchOp)1 DocCountVectorizerPredictStreamOp (com.alibaba.alink.operator.stream.nlp.DocCountVectorizerPredictStreamOp)1 Params (org.apache.flink.ml.api.misc.param.Params)1