1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, isPy27
5, pytestCheckHook
6, numpy
7, scipy
8, scikit-learn
9, pandas
10, tqdm
11, slicer
12, numba
13, matplotlib
14, nose
15, ipython
16}:
17
18buildPythonPackage rec {
19 pname = "shap";
20 version = "0.39.0";
21 disabled = isPy27;
22
23 src = fetchFromGitHub {
24 owner = "slundberg";
25 repo = pname;
26 rev = "v${version}";
27 sha256 = "065c40k6g8sy6ynzk4k8k7iddl18g2b6kb9kg4m6g7npclmn5wvp";
28 };
29
30 propagatedBuildInputs = [
31 numpy
32 scipy
33 scikit-learn
34 pandas
35 tqdm
36 slicer
37 numba
38 ];
39
40 preCheck = ''
41 export HOME=$TMPDIR
42 # when importing the local copy the extension is not found
43 rm -r shap
44 '';
45 checkInputs = [ pytestCheckHook matplotlib nose ipython ];
46 # Those tests access the network
47 disabledTests = [
48 "test_kernel_shap_with_a1a_sparse_zero_background"
49 "test_kernel_shap_with_a1a_sparse_nonzero_background"
50 "test_kernel_shap_with_high_dim_sparse"
51 "test_sklearn_random_forest_newsgroups"
52 "test_sum_match_random_forest"
53 "test_sum_match_extra_trees"
54 "test_single_row_random_forest"
55 "test_sum_match_gradient_boosting_classifier"
56 "test_single_row_gradient_boosting_classifier"
57 "test_HistGradientBoostingClassifier_proba"
58 "test_HistGradientBoostingClassifier_multidim"
59 "test_sum_match_gradient_boosting_regressor"
60 "test_single_row_gradient_boosting_regressor"
61 ];
62
63 meta = with lib; {
64 description = "A unified approach to explain the output of any machine learning model";
65 homepage = "https://github.com/slundberg/shap";
66 license = licenses.mit;
67 maintainers = with maintainers; [ evax ];
68 platforms = platforms.unix;
69 # ModuleNotFoundError: No module named 'sklearn.ensemble.iforest'
70 broken = true;
71 };
72}