更新 function.py
Gitea Actions Test / Challenge-Actions (push) Successful in 32s

This commit is contained in:
2024-11-13 19:02:52 +08:00
parent c20d290c65
commit 27673b3993
+14
View File
@@ -106,6 +106,20 @@ def predict_svm(inX, weights):
if __name__ == "__main__":
# 取得列信息
with open("resources/horse-colic.names", 'r', encoding='utf-8') as f:
data_names = f.read()
data_columns = re.findall(r'(?<=[0-9]:).*', data_names)
data_columns = [col.strip() for col in data_columns[:-3]]
data_columns
# 离散列
columns_discrete = ['surgery?', 'Age', 'temperature of extremities', 'peripheral pulse',
'mucous membranes', 'capillary refill time', 'pain - a subjective judgement of the horse\'s pain level', 'peristalsis',
'abdominal distension', 'nasogastric tube', 'nasogastric reflux', 'rectal examination - feces', 'abdomen', 'abdominocentesis appearance']
# 独热编码列
col_oneHot = ['surgery?', 'Age']
# 加载训练集
X_train, y_train = load_data("./data/horse-colic.data")
# 加载测试集