如图,机器学习PAI这个结果怎么不对?
import com.alibaba.alink.operator.stream.StreamOperator;
import com.alibaba.alink.operator.stream.outlier.KSigmaOutlierStreamOp;
import com.alibaba.alink.operator.stream.source.MemSourceStreamOp;
//import com.alibaba.alink.testutil.AlinkTestBase;
import org.apache.flink.types.Row;
import org.junit.Test;
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.List;
//public class KSigmaOutlierStreamOpTest extends AlinkTestBase {
public class KSigmaOutlierStreamOpTest {
@Test
public void test() throws Exception {
List mTableData = Arrays.asList(
Row.of(1, new Timestamp(1000), 0.0),
Row.of(1, new Timestamp(2000), 0.0),
Row.of(1, new Timestamp(3000), 0.0),
Row.of(1, new Timestamp(4000), 0.0),
Row.of(1, new Timestamp(5000), 0.0),
Row.of(1, new Timestamp(6000), 0.0),
Row.of(1, new Timestamp(7000), 0.0),
Row.of(1, new Timestamp(8000), 0.0),
Row.of(1, new Timestamp(9000), 0.0),
Row.of(1, new Timestamp(10000), 10000.0)
);
MemSourceStreamOp dataOp = new MemSourceStreamOp(mTableData, new String[] {"id", "ts", "val"});
KSigmaOutlierStreamOp outlierOp = new KSigmaOutlierStreamOp()
.setGroupCols("id")
.setTimeCol("ts")
.setPrecedingRows(2)
.setFeatureCol("val")
.setPredictionCol("pred")
.setPredictionDetailCol("pred_detail");
dataOp.link(outlierOp).print();
StreamOperator.execute();
}
}
AlinkTestBase这个找不到,我就屏蔽了测试一下,然后发现结果好像不对。再就是把label那一列删掉了