Skip to content

Commit 2269b6e

Browse files
author
gmartinonQM
committed
fix merge conflicts
2 parents 4ca6487 + fdfeb66 commit 2269b6e

File tree

7 files changed

+32
-20
lines changed

7 files changed

+32
-20
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.2.0
2+
current_version = 0.2.1
33
commit = True
44
tag = True
55

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
# built documents.
8686
#
8787
# The short X.Y version.
88-
version = "0.2.0"
88+
version = "0.2.1"
8989
# The full version, including alpha/beta/rc tags.
9090
release = version
9191

doc/quick_start.rst

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,30 @@ The estimated prediction intervals can then be plotted as follows.
6666
6767
from matplotlib import pyplot as plt
6868
from mapie.metrics import coverage_score
69+
70+
coverage_scores = [
71+
coverage_score(y, y_preds[:, 1, i], y_preds[:, 2, i])
72+
for i, _ in enumerate(alpha)
73+
]
74+
6975
plt.xlabel("x")
7076
plt.ylabel("y")
7177
plt.scatter(X, y, alpha=0.3)
7278
plt.plot(X, y_preds[:, 0, 0], color="C1")
7379
order = np.argsort(X[:, 0])
7480
plt.plot(X[order], y_preds[order][:, 1, 1], color="C1", ls="--")
7581
plt.plot(X[order], y_preds[order][:, 2, 1], color="C1", ls="--")
76-
plt.fill_between(X[order].ravel(), y_preds[:, 1, 0][order].ravel(), y_preds[:, 2, 0][order].ravel(), alpha=0.2)
77-
coverage_scores = [coverage_score(y, y_preds[:, 1, i], y_preds[:, 2, i]) for i, _ in enumerate(alpha)]
82+
plt.fill_between(
83+
X[order].ravel(),
84+
y_preds[:, 1, 0][order].ravel(),
85+
y_preds[:, 2, 0][order].ravel(),
86+
alpha=0.2
87+
)
7888
plt.title(
79-
f"Target and effective coverages for alpha={alpha[0]:.2f}: ({1-alpha[0]:.3f}, {coverage_scores[0]:.3f})\n" +
80-
f"Target and effective coverages for alpha={alpha[1]:.2f}: ({1-alpha[1]:.3f}, {coverage_scores[1]:.3f})"
89+
f"Target and effective coverages for "
90+
f"alpha={alpha[0]:.2f}: ({1-alpha[0]:.3f}, {coverage_scores[0]:.3f})\n"
91+
f"Target and effective coverages for "
92+
f"alpha={alpha[1]:.2f}: ({1-alpha[1]:.3f}, {coverage_scores[1]:.3f})"
8193
)
8294
plt.show()
8395

examples/plot_toy_model.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
mapie.fit(X, y)
2323
y_preds = mapie.predict(X)
2424

25+
coverage_scores = [
26+
coverage_score(y, y_preds[:, 1, i], y_preds[:, 2, i])
27+
for i, _ in enumerate(alpha)
28+
]
29+
2530
plt.xlabel("x")
2631
plt.ylabel("y")
2732
plt.scatter(X, y, alpha=0.3)
@@ -35,10 +40,6 @@
3540
y_preds[:, 2, 0][order].ravel(),
3641
alpha=0.2
3742
)
38-
coverage_scores = [
39-
coverage_score(y, y_preds[:, 1, i], y_preds[:, 2, i])
40-
for i, _ in enumerate(alpha)
41-
]
4243
plt.title(
4344
f"Target and effective coverages for "
4445
f"alpha={alpha[0]:.2f}: ({1-alpha[0]:.3f}, {coverage_scores[0]:.3f})\n"

mapie/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.2.0"
1+
__version__ = "0.2.1"

mapie/estimators.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,9 @@ def _check_cv(
294294
if cv >= 2:
295295
return KFold(n_splits=cv)
296296
if (
297-
isinstance(cv, KFold) or
298-
isinstance(cv, LeaveOneOut) or
299-
cv == "prefit"
297+
isinstance(cv, KFold)
298+
or isinstance(cv, LeaveOneOut)
299+
or cv == "prefit"
300300
):
301301
return cv
302302
raise ValueError(
@@ -442,12 +442,11 @@ def _fit_and_predict_oof_model(
442442
"""
443443
X_train, y_train, X_val = X[train_index], y[train_index], X[val_index]
444444
if sample_weight is None:
445-
sample_weight_train = None
445+
estimator = fit_estimator(estimator, X_train, y_train)
446446
else:
447-
sample_weight_train = sample_weight[train_index]
448-
estimator = fit_estimator(
449-
estimator, X_train, y_train, sample_weight_train
450-
)
447+
estimator = fit_estimator(
448+
estimator, X_train, y_train, sample_weight[train_index]
449+
)
451450
y_pred = estimator.predict(X_val)
452451
val_id = np.full_like(y_pred, k)
453452
return estimator, y_pred, val_id, val_index

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
DISTNAME = "MAPIE"
6-
VERSION = "0.2.0"
6+
VERSION = "0.2.1"
77
DESCRIPTION = (
88
"A scikit-learn-compatible module"
99
"for estimating prediction intervals."

0 commit comments

Comments
 (0)