Search in sources :

Example 11 with TableSourceStreamOp

use of com.alibaba.alink.operator.stream.source.TableSourceStreamOp in project Alink by alibaba.

the class BisectingKMeansTest method before.

@Before
public void before() {
    Row[] rows = new Row[] { Row.of(0, "0  0  0"), Row.of(1, "0.1  0.1  0.1"), Row.of(2, "0.2  0.2  0.2"), Row.of(3, "9  9  9"), Row.of(4, "9.1  9.1  9.1"), Row.of(5, "9.2  9.2  9.2") };
    inputBatchOp = new TableSourceBatchOp(MLEnvironmentFactory.getDefault().createBatchTable(rows, new String[] { "id", "vector" }));
    inputStreamOp = new TableSourceStreamOp(MLEnvironmentFactory.getDefault().createStreamTable(rows, new String[] { "id", "vector" }));
    expectedPrediction = new long[] { 0, 0, 0, 1, 1, 1 };
}
Also used : Row(org.apache.flink.types.Row) TableSourceStreamOp(com.alibaba.alink.operator.stream.source.TableSourceStreamOp) TableSourceBatchOp(com.alibaba.alink.operator.batch.source.TableSourceBatchOp) Before(org.junit.Before)

Example 12 with TableSourceStreamOp

use of com.alibaba.alink.operator.stream.source.TableSourceStreamOp in project Alink by alibaba.

the class KMeansTest method before.

@Before
public void before() {
    Row[] rows = new Row[] { Row.of(0, "0  0  0"), Row.of(1, "0.1  0.1  0.1"), Row.of(2, "0.2  0.2  0.2"), Row.of(3, "9  9  9"), Row.of(4, "9.1  9.1  9.1"), Row.of(5, "9.2  9.2  9.2") };
    inputBatchOp = new TableSourceBatchOp(MLEnvironmentFactory.getDefault().createBatchTable(rows, new String[] { "id", "vector" }));
    inputStreamOp = new TableSourceStreamOp(MLEnvironmentFactory.getDefault().createStreamTable(rows, new String[] { "id", "vector" }));
    expectedPrediction = new double[] { 0.173, 0, 0.173, 0.173, 0, 0.173 };
}
Also used : Row(org.apache.flink.types.Row) TableSourceStreamOp(com.alibaba.alink.operator.stream.source.TableSourceStreamOp) TableSourceBatchOp(com.alibaba.alink.operator.batch.source.TableSourceBatchOp) Before(org.junit.Before)

Aggregations

TableSourceStreamOp (com.alibaba.alink.operator.stream.source.TableSourceStreamOp)12 Row (org.apache.flink.types.Row)11 TableSourceBatchOp (com.alibaba.alink.operator.batch.source.TableSourceBatchOp)10 Test (org.junit.Test)8 BatchOperator (com.alibaba.alink.operator.batch.BatchOperator)6 StreamOperator (com.alibaba.alink.operator.stream.StreamOperator)6 DenseVector (com.alibaba.alink.common.linalg.DenseVector)3 Before (org.junit.Before)3 MemSourceStreamOp (com.alibaba.alink.operator.stream.source.MemSourceStreamOp)2 BigDecimal (java.math.BigDecimal)2 Date (java.sql.Date)2 Time (java.sql.Time)2 Timestamp (java.sql.Timestamp)2 TypeInformation (org.apache.flink.api.common.typeinfo.TypeInformation)2 Params (org.apache.flink.ml.api.misc.param.Params)2 TableSchema (org.apache.flink.table.api.TableSchema)2 ObjectPath (org.apache.flink.table.catalog.ObjectPath)2 AppendIdBatchOp (com.alibaba.alink.operator.batch.dataproc.AppendIdBatchOp)1 MaxAbsScalerPredictStreamOp (com.alibaba.alink.operator.stream.dataproc.MaxAbsScalerPredictStreamOp)1 MinMaxScalerPredictStreamOp (com.alibaba.alink.operator.stream.dataproc.MinMaxScalerPredictStreamOp)1