Spark MLlib 环境搭建超详细教程

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
对于 Spark MLlib,您可以使用以下方法修改压缩算法的配置: 1. 在创建 SparkSession 或者 SparkContext 对象时,通过配置 spark.io.compression.codec 属性来指定压缩算法,例如: ``` SparkSession spark = SparkSession.builder() .appName("MyApp") .config("spark.io.compression.codec", "snappy") .getOrCreate(); ``` 2. 如果您只需要在某个具体的算法中使用不同的压缩算法,可以在创建算法对象时,通过配置 algorithm.compression.codec 属性来指定压缩算法,例如: ``` LogisticRegression lr = new LogisticRegression() .setMaxIter(100) .setRegParam(0.01) .setElasticNetParam(0.8) .setFeaturesCol("features") .setLabelCol("label") .setPredictionCol("prediction") .setThreshold(0.5) .setTol(1E-6) .setFitIntercept(true) .setStandardization(true) .setFamily("binomial") .setAlgorithm("auto") .setProbabilityCol("probability") .setRawPredictionCol("rawPrediction") .setWeightCol("weight") .setThresholds(new double[]{0.7, 0.3}) .setBlockSize(128) .setSeed(12345L) .setAggregationDepth(2) .setFeaturesCol("features") .setLabelCol("label") .setPredictionCol("prediction") .setThreshold(0.5) .setTol(1E-6) .setFitIntercept(true) .setStandardization(true) .setFamily("binomial") .setAlgorithm("auto") .setProbabilityCol("probability") .setRawPredictionCol("rawPrediction") .setWeightCol("weight") .setThresholds(new double[]{0.7, 0.3}) .setBlockSize(128) .setSeed(12345L) .setAggregationDepth(2) .set("algorithm.compression.codec", "lz4"); ``` 在这个例子中,我们使用 set("algorithm.compression.codec", "lz4") 将压缩算法设置为 lz4。 希望这些信息能够帮助您在 Spark MLlib 中修改压缩算法的配置。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值