diff --git a/sklego/linear_model.py b/sklego/linear_model.py index 62853039..4e055daf 100644 --- a/sklego/linear_model.py +++ b/sklego/linear_model.py @@ -49,6 +49,25 @@ class LowessRegression(BaseEstimator, RegressorMixin): The training data. y_ : np.ndarray of shape (n_samples,) The target (training) values. + + + Example + ------- + ```python + from sklego.linear_model import LowessRegression + from sklearn.datasets import make_regression + from sklearn.model_selection import train_test_split + + X, y = make_regression(n_samples=100, n_features=2, noise=10) + + X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2) + + lowess = LowessRegression(sigma=1, span=0.5) + lowess.fit(X_train, y_train) + + y_pred = lowess.predict(X_test) + print(y_pred) + ``` """ def __init__(self, sigma=1, span=None): diff --git a/tests/test_meta/test_zero_inflated_regressor.py b/tests/test_meta/test_zero_inflated_regressor.py index 14b9b7a6..fd85510f 100644 --- a/tests/test_meta/test_zero_inflated_regressor.py +++ b/tests/test_meta/test_zero_inflated_regressor.py @@ -112,8 +112,8 @@ def test_score_samples(): # Where the classifier prediction is zero, then the score is by something greater than 0. assert approx_gte(scores[~pred_is_non_zero], preds[~pred_is_non_zero]) -def test_no_predict_proba(): +def test_no_predict_proba(): np.random.seed(0) X = np.random.randn(1_000, 4) y = ((X[:, 0] > 0) & (X[:, 1] > 0)) * np.abs(X[:, 2] * X[:, 3] ** 2) @@ -125,4 +125,3 @@ def test_no_predict_proba(): with pytest.raises(AttributeError, match="This 'ZeroInflatedRegressor' has no attribute 'score_samples'"): zir.score_samples(X) -