如何通过sklearn模型的预测函数来保留数据集的索引?
我在Jupyter Notebook中使用了这段代码,但是输出文件没有保留X_prod中的原始索引。
clf_Naive = joblib.load('Name.pkl')
predNaive = clf_Naive.predict(X_prod)
predNaiveProba = clf_Naive.predict_proba(X_prod)
pred = pd.DataFrame(data=predNaive)
pred.to_csv('Pred_Naive.csv', sep=';',header=False, index=True) 发布于 2021-05-10 10:22:07
我猜问题可能出在joblib.load()中,因为负载需要2个参数
1.filename
2.您希望读取文件的模式
有关更多详细信息,请查看此 [https://joblib.readthedocs.io/en/latest/generated/joblib.load.html1]
https://stackoverflow.com/questions/67463506
复制相似问题