Skip to content

Instantly share code, notes, and snippets.

@thierrymoudiki
Last active December 13, 2025 18:27
Show Gist options
  • Select an option

  • Save thierrymoudiki/19a856e2d9c75d5b4fe57fa332b5e8c9 to your computer and use it in GitHub Desktop.

Select an option

Save thierrymoudiki/19a856e2d9c75d5b4fe57fa332b5e8c9 to your computer and use it in GitHub Desktop.
Loop on all sklearn models
from sklearn.utils import all_estimators
from tqdm import tqdm
# Get all scikit-learn regressors
estimators = all_estimators(type_filter='regressor')
for name, RegressorClass in tqdm(estimators):
if name in ['MultiOutputRegressor', 'MultiOutputClassifier', 'StackingRegressor', 'StackingClassifier',
'VotingRegressor', 'VotingClassifier', 'TransformedTargetRegressor', 'RegressorChain',
'GradientBoostingRegressor', 'HistGradientBoostingRegressor', 'RandomForestRegressor',
'ExtraTreesRegressor', 'MLPRegressor']:
continue
try:
print(f"name: {name}, class: {RegressorClass}")
except Exception as e:
print(f"Error: {e}")
continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment