question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prediction explanations: display Index ID for best/worst prediction explanations

See original GitHub issue

Goal If users intend to understand the best and worst predictions, the API should allow them to see the Index of the explanations.

If the user can provide the index column (perhaps through DataTables), that index ID could be displayed in the reported outputted by explain_predictions_best_worst.

If the user doesn’t provide an index column, no index ID should be displayed in the report.

Proposal Add index ID to the prediction explanation, if the user provides an index column in X.

Note the Index ID:

        Best 1 of 2

                Predicted Probabilities: [benign: 0.0, malignant: 1.0]
                Predicted Value: malignant
                Target Value: malignant
                Cross Entropy: 0.0
                Index ID: 45


                     Feature Name         Feature Value        Contribution to        SHAP Value
                                                                 Prediction
                ================================================================================
                    worst perimeter          155.30                   +                  0.10
                     worst radius             23.14                   +                  0.08
                 worst concave points         0.17                    +                  0.08
                worst fractal dimension       0.09                    -                 -0.00
                   compactness error          0.04                    -                 -0.00
                    worst symmetry            0.22                    -                 -0.00


        Best 2 of 2

                Predicted Probabilities: [benign: 0.0, malignant: 1.0]
                Predicted Value: malignant
                Target Value: malignant
                Cross Entropy: 0.0
                Index ID: 2

                    Feature Name       Feature Value   Contribution to Prediction   SHAP Value
                ==============================================================================
                  worst perimeter         166.10                   +                   0.10
                    worst radius           25.45                   +                   0.08
                worst concave points       0.22                    +                   0.08
                 compactness error         0.03                    -                  -0.00
                 worst compactness         0.21                    -                  -0.00
                   worst symmetry          0.21                    -                  -0.00


        Worst 1 of 2

                Predicted Probabilities: [benign: 0.552, malignant: 0.448]
                Predicted Value: benign
                Target Value: malignant
                Cross Entropy: 0.802
                Index ID: 7

                    Feature Name       Feature Value   Contribution to Prediction   SHAP Value
                ==============================================================================
                  smoothness error         0.00                    +                   0.04
                    mean texture           21.58                   +                   0.03
                   worst texture           30.25                   +                   0.02
                worst concave points       0.11                    -                  -0.02
                    worst radius           15.93                   -                  -0.03
                mean concave points        0.02                    -                  -0.03

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
freddyaboultoncommented, Aug 27, 2020

@gsheni Yea you’re right. I agree that adding the index value to the output of explain_predictions_best_worst can add value to the user.

1reaction
gshenicommented, Aug 27, 2020

@kmax12 yes, you are right. Fixed the printout example.

@dsherry Yes, I suppose the caller could get that information if they wanted to. It would require the caller re-run the following (outside of explain_predictions_best_worst)

(regression)

y_pred = pipeline.predict(input_features)
errors = metric(y_true, y_pred)
sorted_scores = errors.sort_values()
best = sorted_scores.index[:num_to_explain]
worst = sorted_scores.index[-num_to_explain:]
  • I would then have to find the index IDs of the best/worst score.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Prediction Explanations index: DataRobot docs
Describes how to work with XEMP-based Prediction Explanations. Text Prediction Explanations, Helps to interpret the output of text-based explanations. Updated ...
Read more >
Prediction Explanations — DataRobot Python Client 2.22.1 ...
To compute prediction explanations you need to have feature impact computed for ... Compute predictions predict_job = model.request_predictions(dataset.id) ...
Read more >
Use Python to interpret & explain models (preview) - Azure ...
Learn how to get explanations for how your machine learning model determines feature importance and makes predictions when using the Azure ...
Read more >
Efficient and simple prediction explanations with groupShapley
Shapley values [2] is a leading framework for prediction explanation. ... strength between two or more players by defining a Shapley interaction index....
Read more >
How to Connect Model Input Data With Predictions for ...
How do I connect the predicted values with the input data? ... 0 matches the prediction at index 0; the same is true...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found