pyspark:mllib'randomforestmodel'对象没有属性'transform'

mzaanser  于 2021-07-14  发布在  Spark
关注(0)|答案(0)|浏览(266)

这是我的密码:

  1. (trainingData, testData) = my_data.randomSplit([0.80, 0.20])
  2. model = RandomForest.trainClassifier(trainingData, numClasses=2, categoricalFeaturesInfo={},
  3. numTrees=10, featureSubsetStrategy="auto",
  4. impurity='gini', maxDepth=10, maxBins=32)
  5. prediction_proba = model.transform(testData.map(lambda x: x.features))

我使用transform是因为我想要预测的概率,但是当我尝试这个代码时,我有一个错误:

  1. AttributeError: 'RandomForestModel' object has no attribute 'transform'

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题