-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
Closed
Description
The following snippet will raise a warning regarding feature names
# %%
from sklearn.datasets import load_iris
iris = load_iris(as_frame=True)
X = iris.data[["sepal width (cm)", "petal width (cm)"]]
y = iris.target
# %%
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(
X, y, random_state=42
)
# %%
from sklearn.linear_model import LogisticRegression
model = LogisticRegression().fit(X_train, y_train)
# %%
from sklearn.inspection import DecisionBoundaryDisplay
display = DecisionBoundaryDisplay.from_estimator(model, X_train, alpha=0.5)
scatter = display.ax_.scatter(
X_train["sepal width (cm)"], X_train["petal width (cm)"], c=y_train, edgecolor="k"
)
display.ax_.legend(scatter.legend_elements()[0], iris.target_names)/Users/glemaitre/Documents/packages/scikit-learn/sklearn/base.py:450: UserWarning: X does not have valid feature names, but LogisticRegression was fitted with feature names
warnings.warn(It is not a regression but the warning should not be raised. I think that we should correct this for 1.1 release.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Needs TriageIssue requires triageIssue requires triage