You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For all estimators inheriting from BaseEstimator, if a method explicitly accepts an argument other than X, y, Y, a corresponding set_{method}_request is generated for it.
#26503 proposes the cleanup for inverse_transform methods to make sure the corresponding set_inverse_transform_request is only generated when necessary.
We should do the same for all other generated methods and make sure they are legit.
A list of all generated methods can be seen using this code:
fromsklearn.utilsimportall_estimatorsfromsklearn.baseimportMetaEstimatorMixinimportinspectforname, Clsinall_estimators():
is_meta=issubclass(Cls, MetaEstimatorMixin)
ifis_meta:
print(f"{name} is a meta-estimator")
else:
print(name)
set_methods= [
nameforname, _ininspect.getmembers(Cls, inspect.isroutine)
ifname.startswith("set_") andname.endswith("request")
]
# get input arguments of the methods in set_methodsargs= {
name: inspect.getfullargspec(getattr(Cls, name)).kwonlyargsfornameinset_methods
}
forkey, valueinargs.items():
print(f" {key}: {value}")
print()
sample_weight for non-meta estimators is legit, but for meta-estimators needs checking. Not all meta-estimators actually consume sample_weight, but many of them have it as an explicit arg.
Not all meta-estimators inherit from MetaEstimatorMixin, therefore not marked as meta-estimator above.
copy should probably be considered metadata, but not sure
check_input should probably not be considered metadata
return_std should probably be considered metadata
The text was updated successfully, but these errors were encountered:
For all estimators inheriting from
BaseEstimator
, if a method explicitly accepts an argument other thanX
,y
,Y
, a correspondingset_{method}_request
is generated for it.#26503 proposes the cleanup for
inverse_transform
methods to make sure the correspondingset_inverse_transform_request
is only generated when necessary.We should do the same for all other generated methods and make sure they are legit.
A list of all generated methods can be seen using this code:
Which generates the following output:
Observations, among other things:
sample_weight
for non-meta estimators is legit, but for meta-estimators needs checking. Not all meta-estimators actually consumesample_weight
, but many of them have it as an explicit arg.MetaEstimatorMixin
, therefore not marked as meta-estimator above.copy
should probably be considered metadata, but not surecheck_input
should probably not be considered metadatareturn_std
should probably be considered metadataThe text was updated successfully, but these errors were encountered: