Search in sources :

Example 6 with StandardScaler

use of com.alibaba.alink.pipeline.dataproc.StandardScaler in project Alink by alibaba.

the class Chap19 method c_2.

static void c_2() throws Exception {
    MemSourceBatchOp source = new MemSourceBatchOp(CRIME_ROWS_DATA, CRIME_COL_NAMES);
    Pipeline std_pca = new Pipeline().add(new StandardScaler().setSelectedCols("murder", "rape", "robbery", "assault", "burglary", "larceny", "auto")).add(new PCA().setCalculationType(CalculationType.COV).setK(4).setSelectedCols("murder", "rape", "robbery", "assault", "burglary", "larceny", "auto").setPredictionCol(VECTOR_COL_NAME).enableLazyPrintModelInfo());
    std_pca.fit(source).transform(source).link(new VectorToColumnsBatchOp().setVectorCol(VECTOR_COL_NAME).setSchemaStr("prin1 double, prin2 double, prin3 double, prin4 double").setReservedCols("state")).lazyPrint(10, "state with principle components");
    BatchOperator.execute();
}
Also used : MemSourceBatchOp(com.alibaba.alink.operator.batch.source.MemSourceBatchOp) VectorToColumnsBatchOp(com.alibaba.alink.operator.batch.dataproc.format.VectorToColumnsBatchOp) StandardScaler(com.alibaba.alink.pipeline.dataproc.StandardScaler) Pipeline(com.alibaba.alink.pipeline.Pipeline) PCA(com.alibaba.alink.pipeline.feature.PCA)

Aggregations

StandardScaler (com.alibaba.alink.pipeline.dataproc.StandardScaler)6 Pipeline (com.alibaba.alink.pipeline.Pipeline)4 CsvSourceBatchOp (com.alibaba.alink.operator.batch.source.CsvSourceBatchOp)3 FeatureHasher (com.alibaba.alink.pipeline.feature.FeatureHasher)2 BatchOperator (com.alibaba.alink.operator.batch.BatchOperator)1 LogisticRegressionTrainBatchOp (com.alibaba.alink.operator.batch.classification.LogisticRegressionTrainBatchOp)1 VectorToColumnsBatchOp (com.alibaba.alink.operator.batch.dataproc.format.VectorToColumnsBatchOp)1 EvalRegressionBatchOp (com.alibaba.alink.operator.batch.evaluation.EvalRegressionBatchOp)1 MemSourceBatchOp (com.alibaba.alink.operator.batch.source.MemSourceBatchOp)1 TableSourceBatchOp (com.alibaba.alink.operator.batch.source.TableSourceBatchOp)1 StreamOperator (com.alibaba.alink.operator.stream.StreamOperator)1 JsonValueStreamOp (com.alibaba.alink.operator.stream.dataproc.JsonValueStreamOp)1 SplitStreamOp (com.alibaba.alink.operator.stream.dataproc.SplitStreamOp)1 StandardScalerPredictStreamOp (com.alibaba.alink.operator.stream.dataproc.StandardScalerPredictStreamOp)1 EvalBinaryClassStreamOp (com.alibaba.alink.operator.stream.evaluation.EvalBinaryClassStreamOp)1 FtrlPredictStreamOp (com.alibaba.alink.operator.stream.onlinelearning.FtrlPredictStreamOp)1 FtrlTrainStreamOp (com.alibaba.alink.operator.stream.onlinelearning.FtrlTrainStreamOp)1 CsvSourceStreamOp (com.alibaba.alink.operator.stream.source.CsvSourceStreamOp)1 TableSourceStreamOp (com.alibaba.alink.operator.stream.source.TableSourceStreamOp)1 PipelineModel (com.alibaba.alink.pipeline.PipelineModel)1