generated from LufsX/Experiment-LogReg
This commit is contained in:
+1
-1
@@ -29,7 +29,7 @@ name = "万子玉"
|
|||||||
def sigmoid(z):
|
def sigmoid(z):
|
||||||
return 1 / (1 + np.exp(-z))
|
return 1 / (1 + np.exp(-z))
|
||||||
|
|
||||||
def train_logreg(X, y, learning_rate=0.01, iterations=1000, batch_size=32, initial_weights=None):
|
def train_logreg(X, y, learning_rate=0.1, iterations=1000, batch_size=32, initial_weights=None):
|
||||||
X = np.insert(X, 0, 1, axis=1) # 添加偏置项
|
X = np.insert(X, 0, 1, axis=1) # 添加偏置项
|
||||||
if initial_weights is None:
|
if initial_weights is None:
|
||||||
weights = np.zeros(X.shape[1])
|
weights = np.zeros(X.shape[1])
|
||||||
|
|||||||
Reference in New Issue
Block a user