-
Notifications
You must be signed in to change notification settings - Fork 15
Merge fit()
and fit_dataset()
. Replace summary()
with transform()
. Add fit_transform()
.
#112
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
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ def p_value(self, z, *args, **kwargs): | |
def _z_to_p(self, z): | ||
return ss.norm.sf(z) | ||
|
||
def fit(self, z, *args, **kwargs): | ||
def _fit(self, z, *args, **kwargs): | ||
"""Fit the estimator to z-values.""" | ||
# This resets the Estimator's dataset_ attribute. fit_dataset will overwrite if called. | ||
self.dataset_ = None | ||
|
@@ -51,13 +51,13 @@ def fit(self, z, *args, **kwargs): | |
self.params_ = {"p": p} | ||
return self | ||
|
||
def summary(self): | ||
"""Generate a summary of the estimator results.""" | ||
def transform(self): | ||
"""Generate a transform of the estimator results.""" | ||
if not hasattr(self, "params_"): | ||
name = self.__class__.__name__ | ||
raise ValueError( | ||
"This {} instance hasn't been fitted yet. Please " | ||
"call fit() before summary().".format(name) | ||
"call _fit() of fit() before transform().".format(name) | ||
tsalo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
) | ||
return CombinationTestResults(self, self.dataset_, p=self.params_["p"]) | ||
|
||
|
@@ -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): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why make this private? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, this one was tricky because There was a problem hiding this comment. Choose a reason for hiding this commentThe 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., There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think if There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 the estimator to z-values, optionally with weights.""" | ||
return super().fit(z, w=w) | ||
return super()._fit(z, w=w) | ||
|
||
def p_value(self, z, w=None): | ||
"""Calculate p-values.""" | ||
|
Uh oh!
There was an error while loading. Please reload this page.