@Test
public void testnaiveBayes() throws Exception {

    String[] feature = new String[] {"f0", "f1", "f2", "f3", "f4"};
    String label = "label";
    BatchOperator batchData = (BatchOperator) getData(true);
    NaiveBayesTrainBatchOp op = new NaiveBayesTrainBatchOp()
        .setCategoricalCols("f0", "f4").setSmoothing(0.0).setWeightCol("weight")
        .setFeatureCols(feature).setLabelCol(label).linkFrom(batchData);
    op.getModelInfoBatchOp().lazyPrintModelInfo();
    op.lazyPrint(-1);
    NaiveBayesPredictBatchOp predict = new NaiveBayesPredictBatchOp()
        .setPredictionCol("predict").setPredictionDetailCol("detail").setReservedCols("label");
    BatchOperator res = predict.linkFrom(op, batchData);
    res.select(new String[]{"label", "predict"}).lazyCollect();
    StreamOperator streamData = (StreamOperator) getData(false);
    new NaiveBayesPredictStreamOp(op).setPredictionCol("predict").linkFrom(streamData).print();
    StreamOperator.execute();
    new NaiveBayes()
        .setFeatureCols(feature).setLabelCol(label).setPredictionCol("predict")
        .fit(batchData).transform(batchData).collect();
}