EpistasisLab / EpistasisLab/scikit-rebate
Add sklearn.utils.check_array to fit and predict
- Dominant language
- Jupyter Notebook
- Stars
- 420
- Forks
- 72
- Avg merge
- 3m
- Merged PRs (30d)
- 3
Description
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
```python
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()`)
```python
self._X = check_array(X)
self._y = column_or_1d(y)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.