generated from LufsX/Experiment-LogReg
This commit is contained in:
+2
-1
@@ -27,7 +27,7 @@ name = "廖子豪"
|
|||||||
|
|
||||||
# 这里写自己的代码实现
|
# 这里写自己的代码实现
|
||||||
|
|
||||||
def load_data(filepath(horse-colic.test)):
|
def load_data(filepath):
|
||||||
"""
|
"""
|
||||||
从文件中加载数据。
|
从文件中加载数据。
|
||||||
|
|
||||||
@@ -49,6 +49,7 @@ def load_data(filepath(horse-colic.test)):
|
|||||||
X = np.nan_to_num(X, nan=np.nanmean(X, axis=0))
|
X = np.nan_to_num(X, nan=np.nanmean(X, axis=0))
|
||||||
|
|
||||||
return X, y
|
return X, y
|
||||||
|
|
||||||
def train_logreg(X, y, learning_rate=0.01, iterations=1000):
|
def train_logreg(X, y, learning_rate=0.01, iterations=1000):
|
||||||
"""
|
"""
|
||||||
对率回归训练函数。
|
对率回归训练函数。
|
||||||
|
|||||||
Reference in New Issue
Block a user