generated from LufsX/Experiment-LogReg
This commit is contained in:
+1
-4
@@ -45,12 +45,9 @@ def load_data(filepath):
|
||||
X = data[:, :-1]
|
||||
y = data[:, -1]
|
||||
|
||||
# 标准化特征数据
|
||||
X = (X - np.mean(X, axis=0)) / np.std(X, axis=0)
|
||||
|
||||
return X, y
|
||||
# 这里实现对率回归训练函数
|
||||
def train_logreg(X, y, learning_rate=0.001, num_iterations=5000, regularization_strength=0.001):
|
||||
def train_logreg(X, y, learning_rate=0.01, num_iterations=1000, regularization_strength=0):
|
||||
"""
|
||||
对率回归训练函数。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user