seldonian.models.models.BoundedLinearRegressionModel

class BoundedLinearRegressionModel

Bases: LinearRegressionModel

__init__()

Implements linear regression with a bounded predict function. Overrides several parent methods. Assumes y-intercept is 0.

__repr__()

Return repr(self).

Methods

fit(X, Y)

Train the model using the feature,label pairs

Parameters:
  • X (NxM numpy ndarray) – features

  • Y (Nx1 numpy ndarray) – labels

Returns:

weights from the fitted model

Return type:

numpy ndarray

predict(theta, X)

Overrides the original predict function to squash predictions. Hardcoded bounds.

Parameters:
  • theta (numpy ndarray) – The parameter weights

  • X (numpy ndarray) – The features

Returns:

predicted labels

Return type:

numpy ndarray