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

Merge fit() and fit_dataset(). Replace summary() with transform(). Add fit_transform(). #112

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

Conversation

JulioAPeraza
Copy link
Collaborator

Closes #103.

Changes proposed in this pull request:

  • Merged fit() and fit_dataset() in BaseEstimator.
  • Add fit_transform() in BaseEstimator, to fit and transform data in one step.
  • Convert fit() to _fit() for all estimators.
  • Make CombinationTest compatible with BaseEstimator.
  • Add test_estimator_fit_transform.

@JulioAPeraza JulioAPeraza added the enhancement New feature or request label Aug 30, 2022
@JulioAPeraza JulioAPeraza changed the title Merged fit() and fit_dataset(). Replace summary() with transform(). Add fit_transform(). Merge fit() and fit_dataset(). Replace summary() with transform(). Add fit_transform(). Aug 30, 2022
Copy link
Member

@tsalo tsalo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally forgot about this PR. Sorry about that!

pymare/estimators/combination.py Outdated Show resolved Hide resolved
@@ -112,9 +112,9 @@ class StoufferCombinationTest(CombinationTest):
# Maps Dataset attributes onto fit() args; see BaseEstimator for details.
_dataset_attr_map = {"z": "y", "w": "v"}

def fit(self, z, w=None):
def _fit(self, z, w=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why make this private?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this one was tricky because fit() alone only works with datasets while _fit() is fitted to arrays. This was a solution that worked, but I'm sure there is a more elegant one that can make that distinction clearer.
Would you suggest a different approach? Thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I don't remember if I had considered how fitting to arrays would work with the proposed changes... I wish I'd made a note about it in #103.

We don't want users to call a private method, so I think the options are to either make the array-fitting method a different public method (e.g., fit_array) or to support arrays in fit. WDYT?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if fit() alone cannot distinguish between an array or dataset we should keep fit() only for arrays for the sake of scikit-learn styling, and fit_dataset() for datasets.
Does that mean we need to add fit_dataset_transform() in addition to fit_transform()?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want the Dataset to be the default (unless I'm misremembering), so I think fit_array and fit would be better than fit and fit_dataset. It's a difficult thing though, so maybe we should bring in the rest of the neurostore team on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Merge Estimator.summary() and Estimator.fit()
2 participants