generated from LufsX/Challenge-SVM
This commit is contained in:
+14
@@ -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")
|
||||
# 加载测试集
|
||||
|
||||
Reference in New Issue
Block a user