forked from LufsX/Experiment-LogReg
This commit is contained in:
+14
@@ -1,3 +1,17 @@
|
|||||||
|
import numpy as np
|
||||||
|
|
||||||
|
"""
|
||||||
|
请在这里填写学号和姓名,不填写即成绩无效。
|
||||||
|
"""
|
||||||
|
id = "202210423224"
|
||||||
|
name = "吴杨洋"
|
||||||
|
|
||||||
|
|
||||||
|
def sigmoid(z):
|
||||||
|
"""
|
||||||
|
Sigmoid 激活函数。
|
||||||
|
"""
|
||||||
|
return 1 / (1 + np.exp(-z))
|
||||||
def train_logreg(X, y, random_state=42):
|
def train_logreg(X, y, random_state=42):
|
||||||
model = LogisticRegression(solver='liblinear', random_state=random_state)
|
model = LogisticRegression(solver='liblinear', random_state=random_state)
|
||||||
model.fit(X, y)
|
model.fit(X, y)
|
||||||
|
|||||||
Reference in New Issue
Block a user