PySpark: Getting output layer neuron values for Spark ML Multilayer Perceptron Classifier

半城伤御伤魂 提交于 2021-02-07 09:07:43

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!