class LogisticRegression(object): def __init__(self, input_size, output_size, eta, max_epoch, eps):
时间: 2023-12-02 13:05:59 浏览: 72
Logistic Regression.zip_logistic regression_logistic回归_machine l
def __init__(self, input_size, output_size, eta=0.01, max_epoch=1000, eps=1e-6):
"""
Initialize logistic regression model with hyperparameters
input_size: int - size of input features
output_size: int - number of output classes
eta: float - learning rate
max_epoch: int - maximum number of training epochs
eps: float - convergence threshold
"""
self.input_size = input_size
self.output_size = output_size
self.eta = eta
self.max_epoch = max_epoch
self.eps = eps
self.weights = np.zeros((input_size, output_size))
self.bias = np.zeros(output_size)
阅读全文