Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions docs/_scripts/meta-models.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def plot_model(model):
("datagrab", FeatureUnion([
("discrete", Pipeline([
("grab", ColumnSelector("diet")),
("encode", OneHotEncoder(categories="auto", sparse=False))
("encode", OneHotEncoder(categories="auto"))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kwarg name changed in one of the latest versions, unrelated to PR

])),
("continuous", Pipeline([
("grab", ColumnSelector("time")),
Expand Down Expand Up @@ -265,8 +265,15 @@ def plot_model(model):
mod1 = (GroupedPredictor(DummyRegressor(), groups=["m"])
.fit(df[["m"]], df["yt"]))

mod2 = (GroupedPredictor(DecayEstimator(DummyRegressor(), decay_func="exponential", decay_rate=0.9), groups=["m"])
.fit(df[["index", "m"]], df["yt"]))
mod2 = (GroupedPredictor(
estimator=DecayEstimator(
model=DummyRegressor(),
decay_func="exponential",
decay_kwargs={"decay_rate": 0.9}
),
groups=["m"]
).fit(df[["index", "m"]], df["yt"])
)

plt.figure(figsize=(12, 3))
plt.plot(df["yt"], alpha=0.5);
Expand Down Expand Up @@ -494,12 +501,16 @@ def false_negatives(mod, x, y):
from sklearn.linear_model import LogisticRegression
from sklego.meta import OrdinalClassifier

ord_clf = OrdinalClassifier(LogisticRegression(), n_jobs=-1, use_calibration=False)
_ = ord_clf.fit(X, y)
ord_clf.predict_proba(X[0])
ord_clf = OrdinalClassifier(
LogisticRegression(),
n_jobs=-1,
use_calibration=False,
).fit(X, y)

ord_clf.predict_proba(X[:1])
# --8<-- [end:ordinal-classifier]

print(ord_clf.predict_proba(X[0]))
print(ord_clf.predict_proba(X[:1]))

# --8<-- [start:ordinal-classifier-with-calibration]
from sklearn.calibration import CalibratedClassifierCV
Expand Down
Binary file modified docs/_static/meta-models/baseline-model.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading