मैं एक यादृच्छिक वन वस्तु की कक्षा की संभावनाओं को निकालने की कोशिश कर रहा हूं जिसे मैंने पायस्पार्क का उपयोग करके प्रशिक्षित किया है। हालांकि, मुझे दस्तावेज़ में कहीं भी इसका कोई उदाहरण नहीं दिखाई देता है, न ही यह RandomForestModel
का एक तरीका है।पायस्पार्क और एमएलएलआईबी: यादृच्छिक वन भविष्यवाणियों की कक्षा की संभावनाएं
मैं पीएसस्पर्क में RandomForestModel
क्लासिफायर से कक्षा की संभावनाओं को कैसे निकाल सकता हूं?
यहाँ नमूना प्रलेखन कि केवल अंतिम वर्ग (नहीं संभाव्यता) प्रदान करता है में प्रदान की कोड है:
from pyspark.mllib.tree import RandomForest
from pyspark.mllib.util import MLUtils
# Load and parse the data file into an RDD of LabeledPoint.
data = MLUtils.loadLibSVMFile(sc, 'data/mllib/sample_libsvm_data.txt')
# Split the data into training and test sets (30% held out for testing)
(trainingData, testData) = data.randomSplit([0.7, 0.3])
# Train a RandomForest model.
# Empty categoricalFeaturesInfo indicates all features are continuous.
# Note: Use larger numTrees in practice.
# Setting featureSubsetStrategy="auto" lets the algorithm choose.
model = RandomForest.trainClassifier(trainingData, numClasses=2, categoricalFeaturesInfo={},
numTrees=3, featureSubsetStrategy="auto",
impurity='gini', maxDepth=4, maxBins=32)
# Evaluate model on test instances and compute test error
predictions = model.predict(testData.map(lambda x: x.features))
मैं किसी भी model.predict_proba()
विधि नहीं दिख रहा है - मुझे क्या करना चाहिए ??
देर लेकिन वहाँ एक स्केला समाधान के साथ एक कांटा है: https: //github.com/apache/spark/compare/master...mqk:master –
अब समस्या (ज्यादातर) नई स्पार्क एमएल लाइब्रेरी में हल हो गई है: https://stackoverflow.com/questions/43631031/pyspark- कैसे-से-प्राप्त-वर्गीकरण-संभावनाएं-से-मल्टीलायरपेरसेप्टक्लाससी/43643426 # 43643426 – desertnaut