feat: Kmeans Encode Categorical Feature
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python, scikit-learn
- Domain
- machine-learning
Research direction
The issue asks for a KmeansEncoder transformer that fits a scikit-learn KMeans on the input variables and appends the predicted cluster label, with a rough fit/transform sketch in the body. The payload names no existing files, so locate the project's existing transformers and their tests first to match the conventions. Open questions remain: how the cluster count is chosen (the sketch hardcodes 6), and whether the label is a new column. Done means a tested transformer that follows the library's fit/transform pattern, after the design is agreed with maintainers.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem? Please describe.
From Kaggle
The motivating idea for adding cluster labels is that the clusters will break up complicated relationships across features into simpler chunks. Our model can then just learn the simpler chunks one-by-one instead having to learn the complicated whole all at once.
Describe the solution you'd like
A KmeansEncoder transformer that takes as input a set of variables X and return the corresponding cluster label. A basic structure is show below.
class KmeansEncoder:
def fit(X, y=None):
self.kmeans_ = KMeans(n_clusters=6)
self.kmeans_.fit(X)
def transform(X, y=None):
X['Cluster'] = self.kmeans_.predict(X)
return X
- Dominant language
- Python
- Stars
- 2.3k
- Forks
- 391
- Avg merge
- 11h 34m
- Merged PRs (30d)
- 11
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
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.
More from feature-engine/feature_engine
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
feature-engine/feature_engine#1141 · 1 comment ·
Maintainers usually reply within 1 day
-
docs
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
feature-engine/feature_engine#393 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
feature-engine/feature_engine#1140 · 2 comments ·
Maintainers usually reply within 1 day
-
CategoricalImputer fails when fill_value is already a categoryPossibly taken @AryanRG claimed this 12 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 18/100
feature-engine/feature_engine#1113 · 2 comments ·
Maintainers usually reply within 1 day
-
OneHotEncoder loses a dummy name when it matches an encoded input columnPossibly taken @Aadrit555 claimed this 7 days ago. Open
Difficulty 3/5 Half a day Newbie friendliness 25/100
feature-engine/feature_engine#1106 · 1 comment ·
Maintainers usually reply within 1 day
All issues in feature-engine/feature_engine
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 79/100
developmentseed/titiler-covjson#164 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
awslabs/visual-asset-management-system#2164 ·
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
MakazhanAlpamys/Soup#3589 ·
Maintainers usually reply within 1 day
-
channels status reports the wrong Enabled value for Feishu instances and default-enabled WebSocketOpen
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day