如何使用python保存多个SVM模型
我正在尝试通过使用 for 循环范围从列表中获取名称来保存多个模型以保存在路径中。
我的模型工作正常,但在尝试以唯一名称保存每个模型时出现错误。
city_id = ['1', '2', '18', '19', '21', '23', '26', '27', '28', '32', '35', '36', '37', '38', '39', '40', '41',
'42', '43', '44', '45', '46', '47', '49', '50', '51', '58', '65', '67', '68', '69', '70', '71']
for i in range(len(city_id)):
joblib.dump(model, 'D:/Model/model_Predict_Locality_predictor_'+ str(city_id[i]) +'.pkl', compress=1)
但是out of range error我也有检查范围,但两个范围都相同。
错误
1
Model Pipeline Created Successfully...
Data fitted Successfully...
Data Predicted Successfully...
Accuracy: 0.9908892595919415
list index out of range
2
Model Pipeline Created Successfully...
Data fitted Successfully...
Data Predicted Successfully...
Accuracy: 0.9790685504971219
list index out of range
准确后,得到如上的错误。
繁星coding
相关分类