experiments.baselines.linear_regression.LinearRegressionBaseline

class LinearRegressionBaseline

Bases: LinearRegressionModel, SupervisedExperimentBaseline

__init__()

Implements a classifier that always predicts that the positive class has prob=0.5, regardless of input

__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)

Predict label using the linear model

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

  • X (numpy ndarray) – The features

Returns:

predicted labels

Return type:

numpy ndarray

train(X, y)

Train the model. Just a wrapper to parent’s fit() method.

Parameters:
  • X (2D np.ndarray) – features

  • y (1D np.ndarray) – labels