CompStats 0.1.11__tar.gz → 0.1.12__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.
- {compstats-0.1.11 → compstats-0.1.12}/CompStats/__init__.py +1 -1
- {compstats-0.1.11 → compstats-0.1.12}/CompStats/interface.py +24 -8
- {compstats-0.1.11 → compstats-0.1.12}/CompStats/tests/test_interface.py +7 -0
- {compstats-0.1.11 → compstats-0.1.12}/CompStats.egg-info/PKG-INFO +6 -2
- {compstats-0.1.11 → compstats-0.1.12}/CompStats.egg-info/requires.txt +1 -0
- {compstats-0.1.11 → compstats-0.1.12}/PKG-INFO +6 -2
- {compstats-0.1.11 → compstats-0.1.12}/README.rst +2 -0
- {compstats-0.1.11 → compstats-0.1.12}/pyproject.toml +5 -1
- {compstats-0.1.11 → compstats-0.1.12}/CompStats/bootstrap.py +0 -0
- {compstats-0.1.11 → compstats-0.1.12}/CompStats/measurements.py +0 -0
- {compstats-0.1.11 → compstats-0.1.12}/CompStats/metrics.py +0 -0
- {compstats-0.1.11 → compstats-0.1.12}/CompStats/performance.py +0 -0
- {compstats-0.1.11 → compstats-0.1.12}/CompStats/tests/__init__.py +0 -0
- {compstats-0.1.11 → compstats-0.1.12}/CompStats/tests/data.csv +0 -0
- {compstats-0.1.11 → compstats-0.1.12}/CompStats/tests/test_bootstrap.py +0 -0
- {compstats-0.1.11 → compstats-0.1.12}/CompStats/tests/test_measurements.py +0 -0
- {compstats-0.1.11 → compstats-0.1.12}/CompStats/tests/test_metrics.py +0 -0
- {compstats-0.1.11 → compstats-0.1.12}/CompStats/tests/test_performance.py +0 -0
- {compstats-0.1.11 → compstats-0.1.12}/CompStats/utils.py +0 -0
- {compstats-0.1.11 → compstats-0.1.12}/CompStats.egg-info/SOURCES.txt +0 -0
- {compstats-0.1.11 → compstats-0.1.12}/CompStats.egg-info/dependency_links.txt +0 -0
- {compstats-0.1.11 → compstats-0.1.12}/CompStats.egg-info/top_level.txt +0 -0
- {compstats-0.1.11 → compstats-0.1.12}/LICENSE +0 -0
- {compstats-0.1.11 → compstats-0.1.12}/MANIFEST.in +0 -0
- {compstats-0.1.11 → compstats-0.1.12}/setup.cfg +0 -0
- {compstats-0.1.11 → compstats-0.1.12}/setup.py +0 -0
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
-
__version__ = '0.1.
|
|
14
|
+
__version__ = '0.1.12'
|
|
15
15
|
from CompStats.bootstrap import StatisticSamples
|
|
16
16
|
from CompStats.measurements import CI, SE, difference_p_value
|
|
17
17
|
from CompStats.performance import performance, difference, all_differences, plot_performance, plot_difference
|
|
@@ -90,6 +90,7 @@ class Perf(object):
|
|
|
90
90
|
|
|
91
91
|
"""
|
|
92
92
|
def __init__(self, y_true, *y_pred,
|
|
93
|
+
name:str=None,
|
|
93
94
|
score_func=balanced_accuracy_score,
|
|
94
95
|
error_func=None,
|
|
95
96
|
num_samples: int=500,
|
|
@@ -100,8 +101,13 @@ class Perf(object):
|
|
|
100
101
|
self.score_func = score_func
|
|
101
102
|
self.error_func = error_func
|
|
102
103
|
algs = {}
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
if name is not None:
|
|
105
|
+
if isinstance(name, str):
|
|
106
|
+
name = [name]
|
|
107
|
+
else:
|
|
108
|
+
name = [f'alg-{k+1}' for k, _ in enumerate(y_pred)]
|
|
109
|
+
for key, v in zip(name, y_pred):
|
|
110
|
+
algs[key] = np.asanyarray(v)
|
|
105
111
|
algs.update(**kwargs)
|
|
106
112
|
self.predictions = algs
|
|
107
113
|
self.y_true = y_true
|
|
@@ -186,6 +192,7 @@ class Perf(object):
|
|
|
186
192
|
k = 1
|
|
187
193
|
name = f'alg-{k}'
|
|
188
194
|
self.best = None
|
|
195
|
+
self.statistic = None
|
|
189
196
|
self.predictions[name] = np.asanyarray(y_pred)
|
|
190
197
|
samples = self._statistic_samples
|
|
191
198
|
calls = samples.calls
|
|
@@ -296,14 +303,23 @@ class Perf(object):
|
|
|
296
303
|
>>> perf.statistic
|
|
297
304
|
{'alg-1': 1.0, 'forest': 0.9500891265597148}
|
|
298
305
|
"""
|
|
299
|
-
|
|
306
|
+
if hasattr(self, '_statistic') and self._statistic is not None:
|
|
307
|
+
return self._statistic
|
|
308
|
+
BiB = True if self.score_func is not None else False
|
|
300
309
|
data = sorted([(k, self.statistic_func(self.y_true, v))
|
|
301
310
|
for k, v in self.predictions.items()],
|
|
302
|
-
key=lambda x: self.sorting_func(x[1]),
|
|
303
|
-
reverse=
|
|
311
|
+
key=lambda x: self.sorting_func(x[1]),
|
|
312
|
+
reverse=BiB)
|
|
304
313
|
if len(data) == 1:
|
|
305
|
-
|
|
306
|
-
|
|
314
|
+
self._statistic = data[0][1]
|
|
315
|
+
else:
|
|
316
|
+
self._statistic = dict(data)
|
|
317
|
+
return self._statistic
|
|
318
|
+
|
|
319
|
+
@statistic.setter
|
|
320
|
+
def statistic(self, value):
|
|
321
|
+
"""statistic setter"""
|
|
322
|
+
self._statistic = value
|
|
307
323
|
|
|
308
324
|
@property
|
|
309
325
|
def se(self):
|
|
@@ -509,7 +525,7 @@ class Perf(object):
|
|
|
509
525
|
algs[c] = value[c].to_numpy()
|
|
510
526
|
self.predictions.update(algs)
|
|
511
527
|
return
|
|
512
|
-
self._y_true = value
|
|
528
|
+
self._y_true = np.asanyarray(value)
|
|
513
529
|
|
|
514
530
|
@property
|
|
515
531
|
def score_func(self):
|
|
@@ -23,6 +23,13 @@ import pandas as pd
|
|
|
23
23
|
from CompStats.tests.test_performance import DATA
|
|
24
24
|
|
|
25
25
|
|
|
26
|
+
def test_Perf_name():
|
|
27
|
+
"""Test Perf name keyword"""
|
|
28
|
+
from CompStats.metrics import f1_score
|
|
29
|
+
score = f1_score([1, 0, 1], [1, 0, 0], name='algo')
|
|
30
|
+
assert 'algo' in score.predictions
|
|
31
|
+
|
|
32
|
+
|
|
26
33
|
def test_Perf_plot_col_wrap():
|
|
27
34
|
"""Test plot when 2 classes"""
|
|
28
35
|
from CompStats.metrics import f1_score
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: CompStats
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.12
|
|
4
4
|
Summary: CompStats implements an evaluation methodology for statistically analyzing competition results and competition
|
|
5
5
|
Project-URL: Homepage, https://compstats.readthedocs.io
|
|
6
6
|
Project-URL: Repository, https://github.com/INGEOTEC/CompStats
|
|
@@ -21,6 +21,8 @@ Requires-Dist: numpy
|
|
|
21
21
|
Requires-Dist: scikit-learn>=1.3.0
|
|
22
22
|
Requires-Dist: pandas
|
|
23
23
|
Requires-Dist: seaborn>=0.13.0
|
|
24
|
+
Requires-Dist: statsmodels
|
|
25
|
+
Dynamic: license-file
|
|
24
26
|
|
|
25
27
|
====================================
|
|
26
28
|
CompStats
|
|
@@ -94,6 +96,8 @@ Let us incorporate another predictions, now with Naive Bayes classifier, and His
|
|
|
94
96
|
|
|
95
97
|
>>> nb = GaussianNB().fit(X_train, y_train)
|
|
96
98
|
>>> score(nb.predict(X_val), name='Naive Bayes')
|
|
99
|
+
>>> hist = HistGradientBoostingClassifier().fit(X_train, y_train)
|
|
100
|
+
>>> score(hist.predict(X_val), name='Hist. Grad. Boost. Tree')
|
|
97
101
|
<Perf(score_func=f1_score)>
|
|
98
102
|
Statistic with its standard error (se)
|
|
99
103
|
statistic (se)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: CompStats
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.12
|
|
4
4
|
Summary: CompStats implements an evaluation methodology for statistically analyzing competition results and competition
|
|
5
5
|
Project-URL: Homepage, https://compstats.readthedocs.io
|
|
6
6
|
Project-URL: Repository, https://github.com/INGEOTEC/CompStats
|
|
@@ -21,6 +21,8 @@ Requires-Dist: numpy
|
|
|
21
21
|
Requires-Dist: scikit-learn>=1.3.0
|
|
22
22
|
Requires-Dist: pandas
|
|
23
23
|
Requires-Dist: seaborn>=0.13.0
|
|
24
|
+
Requires-Dist: statsmodels
|
|
25
|
+
Dynamic: license-file
|
|
24
26
|
|
|
25
27
|
====================================
|
|
26
28
|
CompStats
|
|
@@ -94,6 +96,8 @@ Let us incorporate another predictions, now with Naive Bayes classifier, and His
|
|
|
94
96
|
|
|
95
97
|
>>> nb = GaussianNB().fit(X_train, y_train)
|
|
96
98
|
>>> score(nb.predict(X_val), name='Naive Bayes')
|
|
99
|
+
>>> hist = HistGradientBoostingClassifier().fit(X_train, y_train)
|
|
100
|
+
>>> score(hist.predict(X_val), name='Hist. Grad. Boost. Tree')
|
|
97
101
|
<Perf(score_func=f1_score)>
|
|
98
102
|
Statistic with its standard error (se)
|
|
99
103
|
statistic (se)
|
|
@@ -70,6 +70,8 @@ Let us incorporate another predictions, now with Naive Bayes classifier, and His
|
|
|
70
70
|
|
|
71
71
|
>>> nb = GaussianNB().fit(X_train, y_train)
|
|
72
72
|
>>> score(nb.predict(X_val), name='Naive Bayes')
|
|
73
|
+
>>> hist = HistGradientBoostingClassifier().fit(X_train, y_train)
|
|
74
|
+
>>> score(hist.predict(X_val), name='Hist. Grad. Boost. Tree')
|
|
73
75
|
<Perf(score_func=f1_score)>
|
|
74
76
|
Statistic with its standard error (se)
|
|
75
77
|
statistic (se)
|
|
@@ -6,7 +6,8 @@ dependencies = [
|
|
|
6
6
|
'numpy',
|
|
7
7
|
'scikit-learn>=1.3.0',
|
|
8
8
|
'pandas',
|
|
9
|
-
'seaborn>=0.13.0'
|
|
9
|
+
'seaborn>=0.13.0',
|
|
10
|
+
'statsmodels'
|
|
10
11
|
]
|
|
11
12
|
dynamic = ['version']
|
|
12
13
|
|
|
@@ -26,6 +27,9 @@ classifiers = [
|
|
|
26
27
|
[tool.setuptools.dynamic]
|
|
27
28
|
version = {attr = 'CompStats.__version__'}
|
|
28
29
|
|
|
30
|
+
[tool.setuptools]
|
|
31
|
+
packages = ['CompStats', 'CompStats.tests']
|
|
32
|
+
|
|
29
33
|
[project.urls]
|
|
30
34
|
Homepage = "https://compstats.readthedocs.io"
|
|
31
35
|
Repository = "https://github.com/INGEOTEC/CompStats"
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|