Seldon¶
- class Seldon(api_key=None, *, host=None, dataset_name='dataset', model='seldon-small', strategy=None, memory_optimization=None, preprocess=True, n_groups=None, column_names=None, selected_features=None, timeout_s=900, metadata=None, user=None, api_version=None, default_headers=None)¶
Convenience wrapper that dispatches to
SeldonClassifierorSeldonRegressorbased on the target variable atfittime.Warning
Seldon is NOT a scikit-learn estimator.
It cannot be used with sklearn utilities such as
Pipeline,cross_val_score,GridSearchCV, or any API that relies onclone(),get_params(), orset_params().This is intentional. Because
Seldondetermines whether the task is classification or regression duringfit, it is incompatible with sklearn’s static estimator contract.For sklearn integration, use
SeldonClassifierorSeldonRegressordirectly.- Parameters:
*args – Positional arguments forwarded unchanged to the underlying estimator constructor.
**kwargs –
Keyword arguments forwarded unchanged to either
SeldonClassifierorSeldonRegressor.Supported parameters are identical to those accepted by those classes, except that
memory_optimizationdefaults toNone. When left asNone, the value is selected automatically:Falsefor classification tasksTruefor regression tasks
api_key (str | None)
host (str | None)
dataset_name (str)
model (str)
strategy (str | None)
memory_optimization (bool | None)
preprocess (bool)
n_groups (int | None)
timeout_s (int)
user (str | None)
api_version (str | None)
Notes
Parameter validation is deferred until
fit, once the task type has been determined.Examples
Standalone usage (works):
>>> from neuralk import Seldon >>> model = Seldon(api_key="nk_live_xxxx") >>> model.fit(X_train, y_train) # auto-detects task type >>> predictions = model.predict(X_test)Sklearn usage (does NOT work — raises TypeError):
>>> from sklearn.model_selection import cross_val_score >>> cross_val_score(Seldon(...), X, y) # TypeError