Closed YanisLalou closed 2 months ago
Merging #160 (d408d87) into main (ff06a8b) will decrease coverage by
0.04%
. The diff coverage is92.30%
.
You add the
**kwargs
in the definition of the function but forgot to give them toself.base_estimator.predict_proba(X, **kwargs)
By doing so we haveE TypeError: predict_proba() got an unexpected keyword argument 'sample_domain'
because BaseSVC doesnt accept ***kwargs.
2 possible solutions:
# If kwargs are accepted, pass them to predict_proba
try:
return predict_proba(X, **kwargs)
except TypeError:
# If kwargs are not accepted, call predict_proba without kwargs
return predict_proba(X)
OR
# Check if 'kwargs' is among the parameters
if 'kwargs' in predict_proba_signature.parameters:
# If 'kwargs' is accepted, pass it to predict_proba
return predict_proba(X, **kwargs)
elif 'sample_domain' in predict_proba_signature.parameters:
# If 'sample_domain' is accepted, pass it along with X
return predict_proba(X, sample_domain)
else:
# If neither 'kwargs' nor 'sample_domain' is accepted, call predict_proba without them
return predict_proba(X)
What do you think ?
OR
we can change the metadata for this specific object i.e:
__metadata_request__fit = {'sample_domain': True}
__metadata_request__partial_fit = {'sample_domain': False}
__metadata_request__predict = {'sample_domain': False, 'allow_source': False}
__metadata_request__predict_proba = {'sample_domain': False, 'allow_source': False}
__metadata_request__predict_log_proba = {
'sample_domain': False,
'allow_source': False
}
__metadata_request__score = {'sample_domain': False, 'allow_source': False}
__metadata_request__decision_function = {
'sample_domain': False,
'allow_source': False
}