PySpark:获取Spark ML多层感知器分类器的输出层神经元值 [英] PySpark: Getting output layer neuron values for Spark ML Multilayer Perceptron Classifier
问题描述
我正在使用Spark ML多层感知器分类器进行二进制分类.
I am doing binary classification using Spark ML Multilayer Perceptron Classifier.
mlp = MultilayerPerceptronClassifier(labelCol="evt", featuresCol="features", layers=[inputneurons,(inputneurons*2)+1,2])
输出层有两个神经元,因为它是二进制分类问题.现在,我想为测试集中的每一行获取两个神经元的值,而不是仅仅获取包含0或1的预测列.
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.
我找不到任何可以在API文档中得到的东西.
I could not find anything to get that in the API document.
推荐答案
可能我的回答会有点晚.但是对于那些新手.
Probably my answer would be a bit late. But for those new.
根据此文档,ML软件包确实仅提供MLP(多层感知器)作为分类器(无回归),因此,它会将输出层值推入softmax函数以生成二进制输出值.
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.
这是来自doc的注释
输出层中的节点使用softmax函数
Nodes in the output layer use softmax function
这篇关于PySpark:获取Spark ML多层感知器分类器的输出层神经元值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!