Search in sources :

Example 1 with Lda

use of com.alibaba.alink.pipeline.clustering.Lda in project Alink by alibaba.

the class PipelineModelTest method getPipeline.

protected Pipeline getPipeline() {
    // model mapper
    QuantileDiscretizer quantileDiscretizer = new QuantileDiscretizer().setNumBuckets(2).setSelectedCols("sepal_length");
    // SISO mapper
    Binarizer binarizer = new Binarizer().setSelectedCol("petal_width").setOutputCol("bina").setReservedCols("sepal_length", "petal_width", "petal_length", "category").setThreshold(1.);
    // MISO Mapper
    VectorAssembler assembler = new VectorAssembler().setSelectedCols("sepal_length", "petal_width").setOutputCol("assem").setReservedCols("sepal_length", "petal_width", "petal_length", "category");
    // Lda
    Lda lda = new Lda().setPredictionCol("lda_pred").setPredictionDetailCol("lda_pred_detail").setSelectedCol("category").setTopicNum(2).setRandomSeed(0);
    return new Pipeline().add(binarizer).add(assembler).add(quantileDiscretizer).add(lda);
}
Also used : VectorAssembler(com.alibaba.alink.pipeline.dataproc.vector.VectorAssembler) Lda(com.alibaba.alink.pipeline.clustering.Lda) Binarizer(com.alibaba.alink.pipeline.feature.Binarizer) QuantileDiscretizer(com.alibaba.alink.pipeline.feature.QuantileDiscretizer)

Example 2 with Lda

use of com.alibaba.alink.pipeline.clustering.Lda in project Alink by alibaba.

the class LocalPredictorTest method getPipeline.

protected Pipeline getPipeline() {
    // model mapper
    QuantileDiscretizer quantileDiscretizer = new QuantileDiscretizer().setNumBuckets(2).setSelectedCols("sepal_length");
    // SISO mapper
    Binarizer binarizer = new Binarizer().setSelectedCol("petal_width").setOutputCol("bina").setReservedCols("sepal_length", "petal_width", "petal_length", "category").setThreshold(1.);
    // MISO Mapper
    VectorAssembler assembler = new VectorAssembler().setSelectedCols("sepal_length", "petal_width").setOutputCol("assem").setReservedCols("sepal_length", "petal_width", "petal_length", "category");
    // Lda
    Lda lda = new Lda().setPredictionCol("lda_pred").setPredictionDetailCol("lda_pred_detail").setSelectedCol("category").setTopicNum(2).setRandomSeed(0);
    Select select = new Select().setClause("cast(sepal_length as double) as sepal_length, " + "cast(petal_width as double) as petal_width, " + "cast(petal_length as double) as petal_length, " + "category");
    // Glm
    GeneralizedLinearRegression glm = new GeneralizedLinearRegression().setFeatureCols("sepal_length", "petal_width").setLabelCol("petal_length").setPredictionCol("glm_pred");
    return new Pipeline().add(binarizer).add(assembler).add(quantileDiscretizer).add(glm);
}
Also used : VectorAssembler(com.alibaba.alink.pipeline.dataproc.vector.VectorAssembler) GeneralizedLinearRegression(com.alibaba.alink.pipeline.regression.GeneralizedLinearRegression) Lda(com.alibaba.alink.pipeline.clustering.Lda) Select(com.alibaba.alink.pipeline.sql.Select) Binarizer(com.alibaba.alink.pipeline.feature.Binarizer) QuantileDiscretizer(com.alibaba.alink.pipeline.feature.QuantileDiscretizer)

Aggregations

Lda (com.alibaba.alink.pipeline.clustering.Lda)2 VectorAssembler (com.alibaba.alink.pipeline.dataproc.vector.VectorAssembler)2 Binarizer (com.alibaba.alink.pipeline.feature.Binarizer)2 QuantileDiscretizer (com.alibaba.alink.pipeline.feature.QuantileDiscretizer)2 GeneralizedLinearRegression (com.alibaba.alink.pipeline.regression.GeneralizedLinearRegression)1 Select (com.alibaba.alink.pipeline.sql.Select)1