这是我的密码:
(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))
我使用transform是因为我想要预测的概率,但是当我尝试这个代码时,我有一个错误:
AttributeError: 'RandomForestModel' object has no attribute 'transform'
暂无答案!
目前还没有任何答案,快来回答吧!