Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GBM prediction confidence #83

Open
gaop123 opened this issue Jul 28, 2018 · 3 comments
Open

GBM prediction confidence #83

gaop123 opened this issue Jul 28, 2018 · 3 comments

Comments

@gaop123
Copy link

gaop123 commented Jul 28, 2018

Hi, is it possible to add an option for getting the confidence of a prediction of a GBM?
To know how much the prediction "can be trusted"
How can i do it by my self?
Thanks!

@mdabros
Copy link
Owner

mdabros commented Jul 30, 2018

Hi @gaop123 ,

If you are creating a classification model, you can get the confidence of the GBM by using the PredictProbability method on the model:

/// Single new data point 
var observation = new double[] { 1, 2, 200, 1, 3.4 };
var probabilityPrediction = model.PredictProbability(observation);

// This is a dictionary from target value to probability/confidence
var probabilities = probabilityPrediction.Probabilities;

// targetValue of the predicted class
var prediction = probabilityPrediction.Prediction;

// This will give the probability/confidence of the predicted class.
var predictionProbability = probabilities[prediction].

If you need the probability/confidence for the other classes, you can get the probability by parsing their target values to the probabilities dictionary.

Best regards
Mads

@gaop123
Copy link
Author

gaop123 commented Jul 30, 2018 via email

@mdabros
Copy link
Owner

mdabros commented Aug 2, 2018

@gaop123 Ahh yes, that is something different indeed. Currently, there are no build in methods for dealing with classes unknown at training time.

There are a few ways you can handle it, for instance add an anomaly detector in front of your classifier. The anomaly detectors purpose would be to flag all observations which are different from what the classifier was originally trained on, separate these out, and only parse on the observations that seem to belong to the original data distribution.
This is by no means a perfect method though, and it will have some draw backs, since the anomaly detector won't be 100% correct. Sometimes you will still get unknown classes sent to the classifier, and sometime the anomaly detector will filter out known classes.

More consideration can be found here: what-image-classifiers-can-do-about-unknown-objects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants