Skip to content

Commit d8583c7

Browse files
committed
fixes bug re custom model selection
1 parent b30192a commit d8583c7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

openml/flows/sklearn_converter.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,10 +586,13 @@ def check(param_dict, disallow_parameter=False):
586586
elif isinstance(model, sklearn.model_selection.RandomizedSearchCV):
587587
param_distributions = model.param_distributions
588588
else:
589+
if hasattr(model, 'param_distributions'):
590+
param_distributions = model.param_distributions
591+
else:
592+
raise AttributeError('Using subclass BaseSearchCV other than {GridSearchCV, RandomizedSearchCV}. Could not find attribute param_distributions. ')
589593
print('Warning! Using subclass BaseSearchCV other than ' \
590594
'{GridSearchCV, RandomizedSearchCV}. Should implement param check. ')
591-
pass
592-
595+
593596
if not check(param_distributions, True):
594597
raise PyOpenMLError('openml-python should not be used to '
595598
'optimize the n_jobs parameter.')

0 commit comments

Comments
 (0)