erroranalysis 0.5.2__tar.gz → 0.5.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- erroranalysis-0.5.4/MANIFEST.in +2 -0
- {erroranalysis-0.5.2/erroranalysis.egg-info → erroranalysis-0.5.4}/PKG-INFO +12 -5
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/README.md +1 -1
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis/_internal/process_categoricals.py +1 -1
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis/analyzer/error_analyzer.py +1 -1
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis/error_correlation_methods/gbm.py +8 -3
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis/version.py +1 -1
- {erroranalysis-0.5.2 → erroranalysis-0.5.4/erroranalysis.egg-info}/PKG-INFO +12 -5
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis.egg-info/SOURCES.txt +1 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis.egg-info/requires.txt +1 -1
- erroranalysis-0.5.4/requirements-object-detection.txt +1 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/requirements.txt +1 -1
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/setup.py +2 -2
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/tests/test_importances.py +37 -0
- erroranalysis-0.5.2/MANIFEST.in +0 -1
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/LICENSE +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis/__init__.py +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis/_internal/__init__.py +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis/_internal/cohort_filter.py +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis/_internal/constants.py +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis/_internal/error_analyzer/__init__.py +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis/_internal/error_report/__init__.py +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis/_internal/matrix_filter.py +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis/_internal/metrics.py +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis/_internal/surrogate_error_tree.py +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis/_internal/utils.py +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis/_internal/version_checker.py +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis/analyzer/__init__.py +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis/error_correlation_methods/__init__.py +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis/error_correlation_methods/ebm.py +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis/report/__init__.py +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis/report/error_report.py +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis.egg-info/dependency_links.txt +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis.egg-info/top_level.txt +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/setup.cfg +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/tests/test_cohort_filter.py +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/tests/test_error_report.py +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/tests/test_matrix_filter.py +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/tests/test_metrics.py +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/tests/test_pyspark_surrogate_error_tree.py +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/tests/test_root_stats.py +0 -0
- {erroranalysis-0.5.2 → erroranalysis-0.5.4}/tests/test_surrogate_error_tree.py +0 -0
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: erroranalysis
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.4
|
|
4
4
|
Summary: Core error analysis APIs
|
|
5
5
|
Home-page: https://github.com/microsoft/responsible-ai-widgets
|
|
6
6
|
Author: Roman Lutz, Ilya Matiach, Ke Xu
|
|
7
7
|
Author-email: raiwidgets-maintain@microsoft.com
|
|
8
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
9
8
|
Classifier: Programming Language :: Python :: 3.7
|
|
10
9
|
Classifier: Programming Language :: Python :: 3.8
|
|
11
10
|
Classifier: Programming Language :: Python :: 3.9
|
|
12
11
|
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
13
|
Classifier: License :: OSI Approved :: MIT License
|
|
14
14
|
Classifier: Operating System :: OS Independent
|
|
15
15
|
Classifier: Development Status :: 3 - Alpha
|
|
16
|
-
Requires-Python: >=3.
|
|
16
|
+
Requires-Python: >=3.7
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
|
-
Provides-Extra: object_detection
|
|
19
18
|
License-File: LICENSE
|
|
19
|
+
Requires-Dist: numpy>=1.17.2
|
|
20
|
+
Requires-Dist: pandas<2.0.0,>=0.25.1
|
|
21
|
+
Requires-Dist: scipy>=1.4.1
|
|
22
|
+
Requires-Dist: scikit-learn>=0.22.1
|
|
23
|
+
Requires-Dist: lightgbm>=2.0.11
|
|
24
|
+
Requires-Dist: raiutils>=0.4.2
|
|
25
|
+
Provides-Extra: object-detection
|
|
26
|
+
Requires-Dist: vision_explanation_methods; extra == "object-detection"
|
|
20
27
|
|
|
21
28
|
# Error Analysis SDK for Python
|
|
22
29
|
|
|
23
|
-
### This package has been tested with Python 3.
|
|
30
|
+
### This package has been tested with Python 3.7, 3.8, 3.9, 3.10 and 3.11
|
|
24
31
|
|
|
25
32
|
The error analysis sdk enables users to get a deeper understanding of machine learning model errors. When evaluating a machine learning model, aggregate accuracy is not sufficient and single-score evaluation may hide important conditions of inaccuracies. Use Error Analysis to identify cohorts with higher error rates and diagnose the root causes behind these errors.
|
|
26
33
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Error Analysis SDK for Python
|
|
2
2
|
|
|
3
|
-
### This package has been tested with Python 3.
|
|
3
|
+
### This package has been tested with Python 3.7, 3.8, 3.9, 3.10 and 3.11
|
|
4
4
|
|
|
5
5
|
The error analysis sdk enables users to get a deeper understanding of machine learning model errors. When evaluating a machine learning model, aggregate accuracy is not sufficient and single-score evaluation may hide important conditions of inaccuracies. Use Error Analysis to identify cohorts with higher error rates and diagnose the root causes behind these errors.
|
|
6
6
|
|
|
@@ -49,5 +49,5 @@ def process_categoricals(all_feature_names: List[str],
|
|
|
49
49
|
categories.append(category_values)
|
|
50
50
|
category_dictionary[category_index] = category_values
|
|
51
51
|
|
|
52
|
-
return categories, categorical_indexes, category_dictionary
|
|
52
|
+
return categories, categorical_indexes, category_dictionary, \
|
|
53
53
|
string_ind_data
|
|
@@ -482,7 +482,7 @@ class BaseAnalyzer(ABC):
|
|
|
482
482
|
except ValueError:
|
|
483
483
|
# Impute input_data if it contains NaNs, infinity or a value too
|
|
484
484
|
# large for dtype('float64')
|
|
485
|
-
input_data = np.nan_to_num(input_data)
|
|
485
|
+
input_data = np.nan_to_num(input_data.astype(float))
|
|
486
486
|
importances = self._compute_error_correlation(
|
|
487
487
|
input_data, diff, error_correlation_method)
|
|
488
488
|
return importances
|
|
@@ -12,8 +12,8 @@ from erroranalysis._internal.constants import ModelTask
|
|
|
12
12
|
|
|
13
13
|
def compute_gbm_global_importance(input_data, diff, model_task,
|
|
14
14
|
categorical_indexes):
|
|
15
|
-
"""Compute global importance score for
|
|
16
|
-
:param input_data: The input data to compute the
|
|
15
|
+
"""Compute global importance score for GBM between the features and error.
|
|
16
|
+
:param input_data: The input data to compute the GBM global importance
|
|
17
17
|
score on.
|
|
18
18
|
:type input_data: numpy.ndarray
|
|
19
19
|
:param diff: The difference between the label and prediction
|
|
@@ -21,7 +21,7 @@ def compute_gbm_global_importance(input_data, diff, model_task,
|
|
|
21
21
|
:type diff: numpy.ndarray
|
|
22
22
|
:param model_task: The model task.
|
|
23
23
|
:type model_task: str
|
|
24
|
-
:return: The computed
|
|
24
|
+
:return: The computed GBM global importance score between the features and
|
|
25
25
|
error.
|
|
26
26
|
:rtype: list[float]
|
|
27
27
|
"""
|
|
@@ -33,6 +33,11 @@ def compute_gbm_global_importance(input_data, diff, model_task,
|
|
|
33
33
|
model.fit(input_data, diff, categorical_feature=categorical_indexes)
|
|
34
34
|
explainer = shap.TreeExplainer(model)
|
|
35
35
|
shap_values = explainer.shap_values(input_data)
|
|
36
|
+
dims = np.shape(shap_values)
|
|
37
|
+
# fix some inconsistencies in the shape of the shap_values
|
|
38
|
+
# for newer versions of shap>=0.45.0 for single-valued target column
|
|
39
|
+
if is_classification and len(dims) == 2:
|
|
40
|
+
shap_values = np.expand_dims(shap_values, axis=0)
|
|
36
41
|
shap_mean_abs = np.abs(shap_values).mean(axis=0)
|
|
37
42
|
if is_classification:
|
|
38
43
|
shap_mean_abs = shap_mean_abs.mean(axis=0)
|
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: erroranalysis
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.4
|
|
4
4
|
Summary: Core error analysis APIs
|
|
5
5
|
Home-page: https://github.com/microsoft/responsible-ai-widgets
|
|
6
6
|
Author: Roman Lutz, Ilya Matiach, Ke Xu
|
|
7
7
|
Author-email: raiwidgets-maintain@microsoft.com
|
|
8
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
9
8
|
Classifier: Programming Language :: Python :: 3.7
|
|
10
9
|
Classifier: Programming Language :: Python :: 3.8
|
|
11
10
|
Classifier: Programming Language :: Python :: 3.9
|
|
12
11
|
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
13
|
Classifier: License :: OSI Approved :: MIT License
|
|
14
14
|
Classifier: Operating System :: OS Independent
|
|
15
15
|
Classifier: Development Status :: 3 - Alpha
|
|
16
|
-
Requires-Python: >=3.
|
|
16
|
+
Requires-Python: >=3.7
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
|
-
Provides-Extra: object_detection
|
|
19
18
|
License-File: LICENSE
|
|
19
|
+
Requires-Dist: numpy>=1.17.2
|
|
20
|
+
Requires-Dist: pandas<2.0.0,>=0.25.1
|
|
21
|
+
Requires-Dist: scipy>=1.4.1
|
|
22
|
+
Requires-Dist: scikit-learn>=0.22.1
|
|
23
|
+
Requires-Dist: lightgbm>=2.0.11
|
|
24
|
+
Requires-Dist: raiutils>=0.4.2
|
|
25
|
+
Provides-Extra: object-detection
|
|
26
|
+
Requires-Dist: vision_explanation_methods; extra == "object-detection"
|
|
20
27
|
|
|
21
28
|
# Error Analysis SDK for Python
|
|
22
29
|
|
|
23
|
-
### This package has been tested with Python 3.
|
|
30
|
+
### This package has been tested with Python 3.7, 3.8, 3.9, 3.10 and 3.11
|
|
24
31
|
|
|
25
32
|
The error analysis sdk enables users to get a deeper understanding of machine learning model errors. When evaluating a machine learning model, aggregate accuracy is not sufficient and single-score evaluation may hide important conditions of inaccuracies. Use Error Analysis to identify cohorts with higher error rates and diagnose the root causes behind these errors.
|
|
26
33
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
vision_explanation_methods
|
|
@@ -30,15 +30,15 @@ setuptools.setup(
|
|
|
30
30
|
long_description_content_type="text/markdown",
|
|
31
31
|
url="https://github.com/microsoft/responsible-ai-widgets",
|
|
32
32
|
packages=setuptools.find_packages(),
|
|
33
|
-
python_requires='>=3.
|
|
33
|
+
python_requires='>=3.7',
|
|
34
34
|
install_requires=install_requires,
|
|
35
35
|
extras_require=extras_require,
|
|
36
36
|
classifiers=[
|
|
37
|
-
"Programming Language :: Python :: 3.6",
|
|
38
37
|
"Programming Language :: Python :: 3.7",
|
|
39
38
|
"Programming Language :: Python :: 3.8",
|
|
40
39
|
"Programming Language :: Python :: 3.9",
|
|
41
40
|
"Programming Language :: Python :: 3.10",
|
|
41
|
+
"Programming Language :: Python :: 3.11",
|
|
42
42
|
"License :: OSI Approved :: MIT License",
|
|
43
43
|
"Operating System :: OS Independent",
|
|
44
44
|
"Development Status :: 3 - Alpha"
|
|
@@ -6,6 +6,7 @@ import time
|
|
|
6
6
|
import numpy as np
|
|
7
7
|
import pytest
|
|
8
8
|
from common_utils import replicate_dataset
|
|
9
|
+
from sklearn.base import BaseEstimator
|
|
9
10
|
|
|
10
11
|
from erroranalysis._internal.constants import (ErrorCorrelationMethods,
|
|
11
12
|
ModelTask)
|
|
@@ -139,6 +140,42 @@ class TestImportances(object):
|
|
|
139
140
|
scores = model_analyzer.compute_importances(error_correlation_method)
|
|
140
141
|
assert len(scores) == DEFAULT_SAMPLE_COLS
|
|
141
142
|
|
|
143
|
+
@pytest.mark.parametrize('num_rows', [3, 4])
|
|
144
|
+
@pytest.mark.parametrize('nan_correlation_method',
|
|
145
|
+
[MUTUAL_INFO, EBM, GBM_SHAP])
|
|
146
|
+
def test_nan_data_importances(self, num_rows, nan_correlation_method):
|
|
147
|
+
# validate we can run on very few rows
|
|
148
|
+
X_train, _, X_test, y_test, _ = \
|
|
149
|
+
create_binary_classification_dataset(NUM_SAMPLE_ROWS)
|
|
150
|
+
feature_names = list(X_train.columns)
|
|
151
|
+
|
|
152
|
+
class DummyModel(BaseEstimator):
|
|
153
|
+
def fit(self, X, y=None):
|
|
154
|
+
return self
|
|
155
|
+
|
|
156
|
+
def predict(self, X):
|
|
157
|
+
return np.zeros((len(X),), dtype=bool)
|
|
158
|
+
|
|
159
|
+
def predict_proba(self, X):
|
|
160
|
+
return np.zeros((len(X),), dtype=bool)
|
|
161
|
+
|
|
162
|
+
# Use the dummy model
|
|
163
|
+
model = DummyModel()
|
|
164
|
+
|
|
165
|
+
X_test = X_test[:num_rows]
|
|
166
|
+
y_test = y_test[:num_rows]
|
|
167
|
+
|
|
168
|
+
# Randomly replace some values in X_test with NaN
|
|
169
|
+
nan_mask = np.random.choice([True, False], size=X_test.shape)
|
|
170
|
+
X_test = X_test.astype(float)
|
|
171
|
+
X_test[nan_mask] = np.nan
|
|
172
|
+
|
|
173
|
+
categorical_features = []
|
|
174
|
+
model_analyzer = ModelAnalyzer(model, X_test, y_test,
|
|
175
|
+
feature_names,
|
|
176
|
+
categorical_features)
|
|
177
|
+
model_analyzer.compute_importances(nan_correlation_method)
|
|
178
|
+
|
|
142
179
|
@pytest.mark.parametrize('error_correlation_method',
|
|
143
180
|
[MUTUAL_INFO, EBM, GBM_SHAP])
|
|
144
181
|
def test_importances_missings(self, error_correlation_method):
|
erroranalysis-0.5.2/MANIFEST.in
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
include requirements.txt
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis/_internal/error_analyzer/__init__.py
RENAMED
|
File without changes
|
{erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis/_internal/error_report/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{erroranalysis-0.5.2 → erroranalysis-0.5.4}/erroranalysis/error_correlation_methods/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|