All Apps and Add-ons

How to display scored probabilities from Machine Learning Toolkit model?

cjcoleman
Engager

I'm working with the Machine Learning Toolkit to build and test some binary classification models. I see that once the test set is scored, the predicted classification for the models are displayed but I am unable to locate the specifically predicted probabilities for these classifications.

Is it possible to display this result in addition to the predicted class? If so, how?

1 Solution

yangzd
Splunk Employee
Splunk Employee

Predicted probabilities are supported in LogisticRegression. You can simply include probabilities=true in your fit query and it will show the predicted probabilities alongside the predicted classes.

Please refer to the MLTK documentation here: http://docs.splunk.com/Documentation/MLApp/latest/User/Algorithms#LogisticRegression

View solution in original post

yangzd
Splunk Employee
Splunk Employee

Predicted probabilities are supported in LogisticRegression. You can simply include probabilities=true in your fit query and it will show the predicted probabilities alongside the predicted classes.

Please refer to the MLTK documentation here: http://docs.splunk.com/Documentation/MLApp/latest/User/Algorithms#LogisticRegression

cjcoleman
Engager

Thank you, this is exactly what I was looking for.

0 Karma

iceco
New Member

Why that field doesn't show to me even I set probabilities=true? Can I know the field name of probabilities ?

0 Karma

yangzd
Splunk Employee
Splunk Employee

The generated fields will be something like predicted(target_field) for the class prediction, and bunch of probability(target_field=class_a), probability(target_field=class_b)... for the probabilities of predicting the fields as class_a, class_b, etc.
Can you double check if you are using LogisticRegression properly and at least seeing the predicted(target_field)?

0 Karma

iceco
New Member

Yes, I just figured it out. And when you want to apply it, you'd better apply "model_name
"probabilities=true
to show it in the table

0 Karma

yangzd
Splunk Employee
Splunk Employee

That's great!

0 Karma

iceco
New Member

Thanks for your suggestion. And do you know do other algorithms have the similar function. I mean the toolkit uses scikit-learn lib, almost every classification model in this lib should have probability function, but I didn't see it in the MLTK doc

0 Karma

aeapen
New Member

@iceco It's quite easy to add probability function to other classifiers, by extending the existing ones using Custom functions. You can look at the code for LogisticRegression as an example, and add similar for others classifiers.

0 Karma

yangzd
Splunk Employee
Splunk Employee

Great point. Definitely other algorithms should support the probability prediction, as long as it's available in scikit-learn. Please stay tuned for the next MLTK release(s)!

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...