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

Y label Error. #4

Open
xunmzii opened this issue Dec 1, 2022 · 5 comments
Open

Y label Error. #4

xunmzii opened this issue Dec 1, 2022 · 5 comments

Comments

@xunmzii
Copy link

xunmzii commented Dec 1, 2022

When I tried openFE, the error I got as below.
ofe = openfe() features = ofe.fit(data=X_train_feature, label=Y_train.ravel(), n_jobs=1) D:\miniconda3\lib\site-packages\sklearn\preprocessing\_label.py:133: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel(). y = column_or_1d(y, warn=True)
I guess the source code of OpenFE has not the corresponding processing about label data.

@ZhangTP1996
Copy link
Collaborator

When I tried openFE, the error I get as below. ofe = openfe() features = ofe.fit(data=X_train_feature, label=Y_train.ravel(), n_jobs=1) D:\miniconda3\lib\site-packages\sklearn\preprocessing\_label.py:133: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel(). y = column_or_1d(y, warn=True) I guess the source code of OpenFE have not the corresponding processing about label data.

OpenFE accepts label in a pd.DataFrame with one column. We will try to make OpenFE compatible with different input types.

@ZhangTP1996
Copy link
Collaborator

When I tried openFE, the error I get as below. ofe = openfe() features = ofe.fit(data=X_train_feature, label=Y_train.ravel(), n_jobs=1) D:\miniconda3\lib\site-packages\sklearn\preprocessing\_label.py:133: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel(). y = column_or_1d(y, warn=True) I guess the source code of OpenFE have not the corresponding processing about label data.

And please make sure that data and label have the same index.

@kkangliu
Copy link

kkangliu commented Dec 7, 2022

As the data URL is not available, I manually downloaded the dataset from the link as below:
https://www.kaggle.com/datasets/camnugent/california-housing-prices

Then I encountered the same issue when I tried to run the provided example.py. Fortunately, I found that it can be solved by simply adding the following code after the definition of these variables into the self._evaluate() and the self.stage2_select() functions of the openfe/openfe.py:

# avoid dataframe bug
train_y = np.array(train_y)[:, 0]
train_init = np.array(train_init)[:, 0]
val_y = np.array(val_y)[:, 0]
val_init = np.array(val_init)[:, 0]

@xunmzii
Copy link
Author

xunmzii commented Dec 9, 2022

When I tried openFE, the error I get as below. ofe = openfe() features = ofe.fit(data=X_train_feature, label=Y_train.ravel(), n_jobs=1) D:\miniconda3\lib\site-packages\sklearn\preprocessing\_label.py:133: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel(). y = column_or_1d(y, warn=True) I guess the source code of OpenFE have not the corresponding processing about label data.

OpenFE accepts label in a pd.DataFrame with one column. We will try to make OpenFE compatible with different input types.

I really appreciate that and thanks a lot for your attention!

@leonleeann
Copy link

I encountered the same warnning, when I was trying to solve a classification problem instead of a regression one.
If I write a piece of experiment code that mimic the example 'IEEE', there's no such warnning.
But tons of such warnnings always appear when I passed task='classification' to openfe.fit().
It looks like that the fit() is expecting a 2D DataFrame on the parameter label, but when we do a 'classification' job, some codes inside fit() is expecting a 1D label
(我也遇到同样的问题,做回归任务不会,只有分类任务的时候,会出现大量的类似警告。就是传递task='classification'给openfe.fit()的时候。看起来openfe.fit()内部似乎有点自相矛盾:一方面它希望参数label是一个二维的DataFrame,另一方面在它内部,当做分类的时候,又希望该参数是一维的?希望这个信息有点用).

BTW, all examples in this repository are for regression instead of classification.

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

4 participants