首页 > 编程知识 正文

十折交叉验证python,十折交叉验证

时间:2023-05-03 11:23:24 阅读:187294 作者:4271

from sklearn.model_selection import KFoldfrom sklearn.datasets import load_irisfrom sklearn.ensemble import RandomForestClassifierimport numpy as npX,y = load_iris(return_X_y=True)KF = KFold(n_splits=10,shuffle=False,random_state=100)model = RandomForestClassifier()for train_index,test_index in KF.split(X): print("train_index:{},test_index:{}".format(train_index,test_index))

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。