PySpark:获取 Spark ML 多层感知器分类器的输出层神经元值 [英] PySpark: Getting output layer neuron values for Spark ML Multilayer Perceptron Classifier

查看:41
本文介绍了PySpark:获取 Spark ML 多层感知器分类器的输出层神经元值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 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.

这是来自文档的注释

输出层节点使用softmax函数

Nodes in the output layer use softmax function

这篇关于PySpark:获取 Spark ML 多层感知器分类器的输出层神经元值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆