问题
I am doing binary classification using Spark ML Multilayer Perceptron Classifier.
mlp = MultilayerPerceptronClassifier(labelCol="evt", featuresCol="features", layers=[inputneurons,(inputneurons*2)+1,2])
The output layer has of two neurons as it is a binary classification problem. Now I would like get the values two neurons for each of the rows in the test set instead of just getting the prediction column containing either 0 or 1.
I could not find anything to get that in the API document.
回答1:
Probably my answer would be a bit late. But for those new.
According to this documentation, ML package does offer MLP (Multilayer Perceptron) as classifier only (no regression) and as a result it pushes output layer values to a softmax function to generate binary output value.
This is a note from doc
Nodes in the output layer use softmax function
来源:https://stackoverflow.com/questions/40113393/pyspark-getting-output-layer-neuron-values-for-spark-ml-multilayer-perceptron-c