coding categorical response variables for use with scikit-learn
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 990
- Forks
- 106
- Avg merge
- 7d 34m
- Merged PRs (30d)
- 1
Description
scikit-learn expects the response variable to be a 1d array. For example,
from sklearn.linear_model import LogisticRegression
lr = LogisticRegression()
lr.fit(X, y) # here y is expected to be 1d array, strings or numerical labels
However, if y is an array of strings, patsy will convert it to dummy variables, which scikit-learn will not accept as a valid response y.
Would it be useful perhaps to be able to tell patsy that a given (string-type) variable should remain a string and/or converted to numeric labels?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the LogisticRegression example and its lr.fit(X, y) call, then inspect how patsy currently converts string response variables into dummy variables. Clarify whether the desired behavior is preserving strings or producing numeric labels before identifying the affected response-variable path. Done means defining and testing one agreed behavior that produces a valid one-dimensional scikit-learn response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, scikit-learn
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100