如何解决pyspark:mllib 'RandomForestModel' 对象没有属性 'transform'
这是我的代码:
(trainingData,testData) = my_data.randomSplit([0.80,0.20])
model = RandomForest.trainClassifier(trainingData,numClasses=2,categoricalFeaturesInfo={},numTrees=10,featureSubsetStrategy="auto",impurity='gini',maxDepth=10,maxBins=32)
prediction_proba = model.transform(testData.map(lambda x: x.features))
我使用变换是因为我想要预测的概率,但是当我尝试这段代码时,我遇到了这个错误:
AttributeError: 'RandomForestModel' object has no attribute 'transform'
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。