seldonian.models.sklearn_lr.SkLearnLinearRegressor

class SkLearnLinearRegressor(**kwargs)

Bases: SupervisedSkLearnBaseModel

__init__(**kwargs)

Implements a linear regressor in Scikit-learn

__repr__()

Return repr(self).

Methods

backward_pass(theta, X)

Return the Jacobian d(forward_pass)_i/dtheta_{j+1}, where i run over datapoints and j run over model parameters, keeping in mind that there is a y-intercept term (hence the j+1 not j) in the predict function

create_model(**kwargs)

Create the scikit-learn linear regressor

forward_pass(X)

Make predictions given features, X

get_model_params(*args)

Return weights of the model as a flattened 1D array

predict(theta, X, **kwargs)

Do a forward pass through the sklearn model. Must convert back to numpy array before returning

Parameters:
  • theta (numpy ndarray) – model weights

  • X (numpy ndarray) – model features

Returns:

model predictions

Return type:

numpy ndarray same shape as labels

update_model_params(theta, **kwargs)

Update all model parameters using theta, which must be reshaped

Parameters:

theta (numpy ndarray) – model weights