SklearnModel

class SklearnModel(sklearn_model_type, embedding_id, symbol_prefix=None, num_pca_dims=None, **sklearn_model_kwargs)[source]

Bases: ModelMixin

Base class for sklearn-style models.

Parameters:
  • sklearn_model_type (type) – the class that admits basic sklearn interface.

  • embedding_id (str) – the ID of the embedding to use for perturbations.

  • symbol_prefix (Optional[str]) – prefix to add on perturbation vocabulary keys

  • perturb_num_pca_dims – optionally apply PCA to perturbation embeddings.

  • **sklearn_model_kwargs – parameters to use to initialize sklearn model.

fit(traindata, valdata=None)[source]

Model fitting.

Parameters:
  • traindata (PlibData) – Training data.

  • valdata (Optional[PlibData]) – Validation data.

predict(data_x, batch_size=None)[source]

Predict values for the given data.

Parameters:
  • data_x (PlibData[DataFrame]) – Data without labels i.e. without the “values” column.

  • batch_size (Optional[int]) – Not supported for Sklearn models.

Return type:

ndarray[Any, dtype[TypeVar(_ScalarType_co, bound= generic, covariant=True)]]

Returns:

Value predictions.