shap icon indicating copy to clipboard operation
shap copied to clipboard

[Meta-issue] Increase test coverage

Open CloseChoice opened this issue 8 months ago • 1 comments

Problem Description

We currently only have a pretty low coverage which makes it hard to refactor certain parts of the code base. We would like to increase the coverage to make it safe for everyone to create PRs and increase the level of safety reviewers feel when accepting PRs.

Our latest code coverage can be seen on CodeCov.io.

File statements missing excluded coverage
shap/explainers/pytree.py 186 186 0 0%
shap/utils/_keras.py 41 41 0 0%
shap/utils/image.py 81 81 0 0%
shap/plots/_waterfall.py 316 306 0 3%
shap/plots/_benchmark.py 125 119 0 5%
shap/plots/_partial_dependence.py 151 143 0 5%
shap/plots/_decision.py 243 228 0 6%
shap/plots/_violin.py 197 186 0 6%
shap/plots/_force_matplotlib.py 210 195 0 7%
shap/explainers/_kernel.py 426 390 0 8%
shap/plots/_group_difference.py 46 42 0 9%
shap/maskers/_composite.py 99 89 0 10%
shap/explainers/_sampling.py 115 102 0 11%
shap/plots/_heatmap.py 70 62 0 11%
shap/explainers/_linear.py 209 182 3 13%
shap/explainers/other/_maple.py 166 145 0 13%
shap/plots/_utils.py 150 130 0 13%
shap/maskers/_image.py 139 119 0 14%
shap/plots/_image.py 115 99 0 14%
shap/actions/_optimizer.py 55 47 0 15%
shap/plots/_monitoring.py 44 36 0 18%
shap/plots/_embedding.py 31 25 0 19%
shap/explainers/_permutation.py 91 73 0 20%
shap/plots/_scatter.py 445 350 0 21%
shap/explainers/other/_lime.py 45 35 0 22%
shap/plots/_beeswarm.py 521 401 0 23%
shap/explainers/other/_treegain.py 21 16 0 24%
shap/models/_teacher_forcing.py 178 134 0 25%
shap/models/_text_generation.py 100 75 0 25%
shap/explainers/_additive.py 38 27 0 29%
shap/explainers/other/_random.py 28 20 0 29%
shap/models/_topk_lm.py 110 76 0 31%
shap/utils/_clustering.py 120 83 0 31%
shap/datasets.py 154 105 0 32%
shap/utils/_legacy.py 172 103 0 40%
shap/plots/_text.py 619 355 0 43%
shap/plots/colors/_colorconv.py 230 130 0 43%
shap/maskers/_output_composite.py 32 18 0 44%
shap/maskers/_fixed_composite.py 31 17 0 45%
shap/explainers/_partition.py 247 132 0 47%
shap/explainers/_tree.py 1120 543 4 52%
shap/_explanation.py 501 231 0 54%
shap/maskers/_masker.py 13 6 0 54%
shap/plots/_bar.py 221 98 0 56%
shap/utils/_general.py 194 86 0 56%
shap/utils/_masked_model.py 267 115 0 57%
shap/plots/_force.py 240 101 0 58%
shap/explainers/_gradient.py 334 137 0 59%
shap/utils/transformers.py 37 15 0 59%
shap/actions/_action.py 5 2 0 60%
shap/maskers/_fixed.py 10 4 0 60%
shap/explainers/other/_coefficient.py 8 3 0 62%
shap/maskers/_tabular.py 130 49 0 62%
shap/init.py 71 25 0 65%
shap/maskers/_text.py 285 97 0 66%
shap/explainers/_deep/deep_tf.py 486 145 0 70%
shap/explainers/_exact.py 181 51 0 72%
shap/explainers/_explainer.py 240 62 0 74%
shap/links.py 16 4 0 75%
shap/explainers/tf_utils.py 40 9 0 78%
shap/_version.py 11 2 0 82%
shap/utils/_show_progress.py 29 4 0 86%
shap/_serializable.py 127 16 0 87%
shap/plots/init.py 20 2 0 90%
shap/explainers/_deep/deep_pytorch.py 256 23 0 91%
shap/explainers/_gpu_tree.py 30 2 0 93%
shap/explainers/other/_ubjson.py 121 7 0 94%
shap/models/_transformers_pipeline.py 22 1 0 95%
shap/models/_model.py 27 1 0 96%
shap/plots/colors/_colors.py 88 2 0 98%
shap/actions/init.py 2 0 0 100%
shap/explainers/init.py 23 0 0 100%
shap/explainers/_deep/init.py 32 0 0 100%
shap/explainers/_deep/deep_utils.py 12 0 0 100%
shap/explainers/other/init.py 6 0 0 100%
shap/maskers/init.py 9 0 0 100%
shap/models/init.py 6 0 0 100%
shap/plots/_labels.py 1 0 0 100%
shap/plots/colors/init.py 2 0 0 100%
shap/utils/init.py 5 0 0 100%
shap/utils/_exceptions.py 18 0 0 100%

I suggest that we gradually start making PRs that increase the coverage especially of the less well covered files.

CloseChoice avatar Jun 12 '24 06:06 CloseChoice