py-why / py-why/EconML

`sample_weight` in DomainAdaptationLearner `_fit_weighted_pipeline()` method should be kwarg

Open
#774 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
4.8k
Forks
827
PR merge metrics
No merged PRs in 30d

Description

Arbitrary sklearn ML models do not have a positional argument for sample_weight in the fit() method, so the following change needs to be made:

if not isinstance(model_instance, Pipeline):
            model_instance.fit(X, y, sample_weight)

Should be changed to:

if not isinstance(model_instance, Pipeline):
            model_instance.fit(X, y, sample_weight=sample_weight)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the repository for DomainAdaptationLearner and its _fit_weighted_pipeline() method, then inspect the non-Pipeline model fit call. Confirm that sample_weight is passed as a keyword argument and verify the relevant learner behavior with the existing test suite; done means arbitrary scikit-learn models accept the weighted fit without a positional-argument error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, scikit-learn
Domain
machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.