Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive warning when manipulating pandas dataframes #540

Open
Paroag opened this issue Jan 5, 2024 · 0 comments
Open

False positive warning when manipulating pandas dataframes #540

Paroag opened this issue Jan 5, 2024 · 0 comments

Comments

@Paroag
Copy link

Paroag commented Jan 5, 2024

Scikit learn added compatibility for pandas dataframe with the set_output API update. I have sklearn pipelines in my project that uses pyod models. When fitting/predicting, the following warning is triggered:

UserWarning: X has feature names, but IsolationForest was fitted without feature names

The IForest.fit method does not actually pass the pandas dataframe to the underlying IsolationForest but the associated numpy array. The line of code X = check_array(X) is responsible for the conversion.

Here is a reproducible example:

import pandas as pd
from pyod.models.iforest import IForest


data = pd.DataFrame({
    "col1": [1, 2, 3, 4],
    "col2": [1, 2, 3, 4]
})

forest = IForest()
forest.fit(data)
forest.predict_proba(data)

Any ideas on how to address this issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant