experiments.baselines.logistic_regression.BinaryLogisticRegressionBaseline¶
- class BinaryLogisticRegressionBaseline¶
Bases:
BinaryLogisticRegressionModel
,SupervisedExperimentBaseline
- __init__()¶
Implements a logistic regression classifier for binary classification
- __repr__()¶
Return repr(self).
Methods
- fit(X, Y)¶
Train the model using features and labels. Let:
i = number of datapoints j = number of features (including bias term, if provied) k = number of classes
- Parameters:
X (array of shape (i,j)) – The features
Y (array of shape (i,k)) – The labels
- Returns:
fitted model weights
- Return type:
array of shape (j,k)
- predict(theta, X)¶
Predict the probability of having the positive class label for each data point in X. Let:
i = number of datapoints j = number of features (including bias term, if provied)
- Parameters:
theta (array of length j or shape (j,1)) – The parameter weights
X (array of shape (i,j)) – The features
- Returns:
predictions for each class each observation
- Return type:
array of length i or shape (i,1)
- 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