k近邻-5-fold-cross-validation
摘要:Finishapythoncodethatisforrunning5-foldcrossvalidation.Nearestneighborcodeisprovided.#recallXtr_rowsis50000*3072matriximportnumpyaspyimportmatplotlib.pyplotaspltX1=Xtr_rows[:10000,:]#takefirst10000forvalidationY1=Ytr[:10000]X11=Xtr_rows[10000:,:]#keeplast40000fortrainY11=Ytr[10000:]X2=Xtr_rows[10000:20000,:]#take10000-20000forvalidationY2=Ytr[10000:20000]X21=Xtr_rows[:10000,:]X22=Xtr_rows[20000:,:]X23=np.row_stack((X21,X22))Y21=Ytr[:10000]Y22=Ytr[20000:]Y23=np.row_stack((Y21,Y22))#keepfirst10000and20000-50000fortrainX3=Xtr_rows[20000:30000,:]#take20000-30000forvalidationY3=Ytr[20000:30000]X31=Xtr_rows[:20000,:]X32=Xtr_rows[30000:,:]X33=np.row_stack((X31,X32))Y31=Ytr[:20000]Y32=Y
温馨提示:当前文档最多只能预览
5 页,若文档总页数超出了
5 页,请下载原文档以浏览全部内容。
本文档由 匿名用户 于 2022-12-30 23:11:58上传分享