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

new module with a few sklearn wrappers #21

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

jrasero
Copy link
Contributor

@jrasero jrasero commented Jun 17, 2022

This pull request creates a new module, which I called "sklearn_wrappers", that implements basic sklearn functionalities with the inclusion of a deconfounding step. This has the intention of encapsulation in a familiar scikit-learn way, so that It can be easier for new users.

In the current pull request, three main objects have been implemented:

  • a DeconfEstimator class, where you pass a deconfounder object from this library and an estimator from scikit-learn. It then first deconfounds the data and feed this to the estimator supplied. It implements the usual fit and predict methods.
  • deconfounded_cv_predict and deconfounded_cv_score functions, intended to mimic the functions cross_val_predict and cross_val_score from scikit-learn. Note that the estimators passed to these functions should be an instance of DeconfEstimator .

The idea with this new module is to include more wrappers in the future.

raamana and others added 25 commits June 17, 2021 09:42
In particular, this bug was located in the _transform function,
when looping through the test batches to remove the location and
scale effects. This bug was introduced after changing
the global names of the variables.

Also, the keys in bladder_test data have been renamed to follow
the same nomenclature that we now use with respect to the previous one
(Y, b, X..).

Some other typos have been corrected to fulfill code styling.
	modified:   confounds/sklearn.py
@raamana
Copy link
Owner

raamana commented Jun 18, 2022

thanks Javi! this looks great.

a high level comment on the module name -- given its broader focus, I think a more appropriate name would be evaluation.py as we may be including other cross-validation and resampling routines over time. what do you think?

I will comment on the code as I review it!

@raamana
Copy link
Owner

raamana commented Jun 18, 2022

I just had a quick look, and I feel like its best we review it together, so I follow your motivation and reasoning! I'd have done some things slightly differently so I want to understand what's happening before I ask for or propose specific changes.

@jrasero
Copy link
Contributor Author

jrasero commented Jun 18, 2022

Sure Pradeep, it makes sense to review this together.

@raamana
Copy link
Owner

raamana commented Jun 18, 2022

Wanna do it now? or what time would work for you?

@jrasero
Copy link
Contributor Author

jrasero commented Jun 18, 2022

I can do it now, yeah. Just give me 5 mins

@jrasero
Copy link
Contributor Author

jrasero commented Jun 18, 2022

Ready

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 this pull request may close these issues.

None yet

2 participants