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

Add sklearn.utils.check_array to fit and predict #53

Open
mpearmain opened this issue Jul 19, 2018 · 0 comments · May be fixed by #73
Open

Add sklearn.utils.check_array to fit and predict #53

mpearmain opened this issue Jul 19, 2018 · 0 comments · May be fixed by #73

Comments

@mpearmain
Copy link

Currently the fit method fails if you pass a pandas dataframe object to the fit() and predict() adding using the sklearn util check_array (http://scikit-learn.org/stable/modules/generated/sklearn.utils.check_array.html#sklearn.utils.check_array) will by default convert the pandas df to an at 2D numpy array which can then be used without code change from the user.

i.e
In the examples you load data as a data frame

genetic_data = pd.read_csv('https://github.com/EpistasisLab/scikit-rebate/raw/master/data/'
                           'GAMETES_Epistasis_2-Way_20atts_0.4H_EDM-1_1.tsv.gz',
                           sep='\t', compression='gzip')
# 
# Now we convert to a numpy array
#
features, labels = genetic_data.drop('class', axis=1).values, genetic_data['class'].values

This would be as simple as changing (in fit() and 'predict()`)

 self._X = check_array(X)
 self._y = column_or_1d(y)
aadu added a commit to aadu/scikit-rebate that referenced this issue Aug 7, 2020
@aadu aadu linked a pull request Aug 7, 2020 that will close 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

Successfully merging a pull request may close this issue.

1 participant