Thanks to visit codestin.com
Credit goes to github.com

Skip to content

new module with a few sklearn wrappers#21

Open
jrasero wants to merge 25 commits into
raamana:masterfrom
jrasero:sklearn_wrapper
Open

new module with a few sklearn wrappers#21
jrasero wants to merge 25 commits into
raamana:masterfrom
jrasero:sklearn_wrapper

Conversation

@jrasero

@jrasero jrasero commented Jun 17, 2022

Copy link
Copy Markdown
Contributor

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

raamana commented Jun 18, 2022

Copy link
Copy Markdown
Owner

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

raamana commented Jun 18, 2022

Copy link
Copy Markdown
Owner

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

jrasero commented Jun 18, 2022

Copy link
Copy Markdown
Contributor Author

Sure Pradeep, it makes sense to review this together.

@raamana

raamana commented Jun 18, 2022

Copy link
Copy Markdown
Owner

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

@jrasero

jrasero commented Jun 18, 2022

Copy link
Copy Markdown
Contributor Author

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

@jrasero

jrasero commented Jun 18, 2022

Copy link
Copy Markdown
Contributor Author

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.

2 participants