Predicting probabilities for a set of values

Hi,

I love what you guys are doing. Keep on the good work.

Question:

Using Mindsdb + Mariadb I would like to get the probability for all items in a column with a limited set of values.
Lets take for example in the bank_churn example data. Suppose I train to predict the geography column.
Instead of getting the top country (e.g. Germany) I would like to get the probability for all countries
Germany 0.8
France 0.6
Italy 0.3

Etc…

Please advise.
Thanks!

2 Likes

Hi @nirbd, thanks for the kind words!

This is something that we have been working on, and it should be available on next week’s release. You can expect a follow up with instructions and a short example by then.

Cheers,
Patricio

1 Like

Thanks Patricio. I’m waiting for it.

  • Nir
1 Like

Hi @nirbd,

As of MindsDB 2.19.0, you can access this feature by specifying 'output_class_distribution': True in your predictor advanced_args dictionary.

Here’s a short example using the python interface:

...
predictor.learn(..., advanced_args={'output_class_distribution': True})
results = predictor.predict(...)

class_probs = results._data['{target}_class_distribution']
class_labels = results._transaction.lmd['lightwood_data']['{target}_class_map']
...

Let me know how it goes!

2 Likes

That’s amazing. Thanks!

1 Like

Hi @paxcema

How can I get these results with AI tables?

Thanks,
Nir

Hi @nirbd, we are working on the AI tables integration. I’ll ping back with an example once it’s possible.

Excellent. thanks @paxcema

Hi,

Apologies for the delay. This information is now available in the {target}_explain field for the MySQL and Mongo APIs:

{"class_distribution": {
   "5": 0.04799520883510369,
   "6": 0.10778617414928329, 
   "7": 0.4064338499181312, 
   "4": 0.053223713685620955, 
   "3": 0.06277927869179267, 
   "8": 0.22103869370700427, 
   "9": 0.10074308101306396},
"predicted_value": "7", 
"confidence": 0.69, 
"prediction_quality": "confident", 
"important_missing_information": [
    "fixed_acidity", 
    "chlorides", 
    "free_sulfur_dioxide", 
    "total_sulfur_dioxide"]
}

thanks, looks great. Does it work also on MariaDB?

1 Like

Indeed, it’s available on MariaDB

thanks

barilliance_logo_150x50_w.png