SKSurrogate
sksurrogate/quickstart

SKSurrogate in five minutes

SurrogateRandomCV is a drop-in for RandomizedSearchCV; ranges are written as plain tuples (integers or floats) and lists (categorical values).

Install

pip install sksurrogate

The package requires Python 3.10 or newer and ships the search layer on top of scikit-learn. Nothing else is needed for the tuner; the control plane runs from a compose profile when you want it.

Optimize a model

from sklearn.svm import SVC
from SKSurrogate import SurrogateRandomCV

search = SurrogateRandomCV(
    SVC(),
    param_distributions={"C": (1e-3, 10.0), "kernel": ["poly", "rbf"], "degree": (1, 4)},
    n_iter=30,
).fit(X, y)
search.best_params_, search.best_score_

The object is a BaseSearchCV subclass, so best_params_, best_score_, cv_results_, refitting and scoring behave as they do in scikit-learn — adopting it changes one import, not your codebase. Every candidate evaluation is recorded, so the result is an artifact you can inspect rather than a single returned winner.

Automatic pipeline design

from SKSurrogate import AML

AML(preset="classification").fit(X, y)

AML(preset="regression") covers the regression case and needs no search configuration. For pandas DataFrames the preset fits numeric, categorical, datetime and text preprocessing inside each cross-validation fold when cat_cols is omitted; array-like inputs should already be numeric. fit(X, y, strategy="eoa") selects evolutionary search.

Where to go next

© 2019–2026 Mehdi Ghasemi · MIT licence sksurrogate v0.3.0 · scikit-learn-native