SeldonRegressor

class SeldonRegressor(api_key=None, *, host=None, dataset_name='dataset', model='seldon-small', strategy=None, memory_optimization=True, preprocess=True, n_groups=None, column_names=None, selected_features=None, timeout_s=900, metadata=None, user=None, api_version=None, default_headers=None)

Sklearn-compatible regressor using the Neuralk API.

This regressor connects to either the Neuralk cloud API or an on-premise NICL server. It follows the standard scikit-learn regressor interface and only accepts continuous regression targets.

Parameters:
  • api_key (str, optional) – API key for authentication (e.g., “nk_live_xxxx”). Required for cloud mode. If not provided, reads from the NEURALK_API_KEY environment variable. Optional for on-premise mode.

  • host (str, optional) – Base URL of the server. If not provided, uses the Neuralk cloud endpoint. When provided, enables on-premise mode which doesn’t require an API key.

  • dataset_name (str, default="dataset") – Name identifier for the dataset used in API requests.

  • model (str, default="seldon-small") – Model identifier to use for inference.

  • strategy (str, optional) – Prompting strategy for group-wise processing.

  • memory_optimization (bool, default=True) – Enable server-side memory optimization.

  • preprocess (bool, default=True) – Enable server-side data preprocessing.

  • n_groups (int, optional) – Number of groups for the prompting strategy.

  • column_names (List[str], optional) – Column names corresponding to features in X.

  • selected_features (List[str], optional) – Features to use for grouping strategies.

  • timeout_s (int, default=900) – Request timeout in seconds.

  • metadata (dict, optional) – Optional metadata to include with requests.

  • user (str, optional) – Optional user identifier for request tracking.

  • api_version (str, optional) – Optional API version string to send as ‘Nicl-Version’ header.

  • default_headers (dict, optional) – Optional default headers to include with every request.

Examples

>>> from neuralk import SeldonRegressor
>>> reg = SeldonRegressor(api_key="nk_live_xxxx")
>>> reg.fit(X_train, y_train)
>>> predictions = reg.predict(X_test)