generated from LufsX/Experiment-LogReg
This commit is contained in:
+3
-1
@@ -45,6 +45,8 @@ def predict_logreg(inX, weights):
|
||||
|
||||
def load_data(filepath):
|
||||
data = np.genfromtxt(filepath, delimiter=',', dtype=np.float64)
|
||||
if len(data.shape) == 1:
|
||||
data = data.reshape(1, -1)
|
||||
# 处理缺失值
|
||||
data[np.isnan(data)] = 0
|
||||
X = data[:, :-1]
|
||||
@@ -53,7 +55,7 @@ def load_data(filepath):
|
||||
y[y == 2] = 0
|
||||
y[y == 3] = 0
|
||||
# 去掉特征 3、特征 24~28
|
||||
X = np.delete(X, [2, 23], axis=1)
|
||||
X = np.delete(X, [2] + list(range(22, X.shape[1])), axis=1)
|
||||
return X, y
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user