You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Robert Dodier <ro...@gmail.com> on 2015/11/17 22:38:14 UTC
Any way to get raw score from MultilayerPerceptronClassificationModel ?
Hi,
I'd like to get the raw prediction score from a
MultilayerPerceptronClassificationModel. It appears that the 'predict'
method only returns the argmax of the largest score in the output
layer (line 200 in MultilayerPerceptronClassificationModel.scala in
Spark 1.5.2).
Is there any way to get the raw score? It is computed as
mlpModel.predict(features) in the source code. It appears that I can't
access mlpModel since it is private in
MultilayerPerceptronClassificationModel so I couldn't just grab
mlpModel and call predict on it. Is there another way?
Thanks for any light you can shed on this question.
Robert Dodier
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org
Re: Any way to get raw score from MultilayerPerceptronClassificationModel
?
Posted by Robert Dodier <ro...@gmail.com>.
On Tue, Nov 17, 2015 at 2:36 PM, Ulanov, Alexander
<al...@hpe.com> wrote:
> Raw scores are not available through the public API.
> It would be great to add this feature, it seems that we overlooked it.
OK, thanks for the info.
> The better way would be to write a new implementation of MLP
> model that will extend Classifier (instead of Predictor).
Actually I think it would be better still to extend ProbabilisticClassifier,
since MLP classifier outputs are posterior class probabilities.
best,
Robert Dodier
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org
RE: Any way to get raw score from
MultilayerPerceptronClassificationModel ?
Posted by "Ulanov, Alexander" <al...@hpe.com>.
Hi Robert,
Raw scores are not available through the public API. It would be great to add this feature, it seems that we overlooked it.
The simple way to access the raw predictions currently would be to create a wrapper for mlpModel. This wrapper should be defined in [ml] package. One need to get weights from MultilayerPerceptronClassificationModel to instantiate this wrapper.
The better way would be to write a new implementation of MLP model that will extend Classifier (instead of Predictor). It will be a total copy of the current MultilayerPerceptronClassificationModel except that one would need to implement "predictRaw" and " raw2prediction". Eventually, it might replace the current implementation.
Best regards, Alexander
-----Original Message-----
From: Robert Dodier [mailto:robert.dodier@gmail.com]
Sent: Tuesday, November 17, 2015 1:38 PM
To: user@spark.apache.org
Subject: Any way to get raw score from MultilayerPerceptronClassificationModel ?
Hi,
I'd like to get the raw prediction score from a MultilayerPerceptronClassificationModel. It appears that the 'predict'
method only returns the argmax of the largest score in the output layer (line 200 in MultilayerPerceptronClassificationModel.scala in Spark 1.5.2).
Is there any way to get the raw score? It is computed as
mlpModel.predict(features) in the source code. It appears that I can't access mlpModel since it is private in MultilayerPerceptronClassificationModel so I couldn't just grab mlpModel and call predict on it. Is there another way?
Thanks for any light you can shed on this question.
Robert Dodier
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org For additional commands, e-mail: user-help@spark.apache.org