登录
首页 » 文件处理 » 原始数据划分为train.dat和test.dat

原始数据划分为train.dat和test.dat

于 2022-01-25 发布 文件大小:29.06 MB
0 148
下载积分: 2 下载次数: 2

代码说明:

应用背景开始是做movielense的数据,可以把原始数据任意划分为train.dat和test.dat,主要是为了做验证实验。非常简单明了,适合初学者看看,如果不喜欢,请轻喷。关键技术# -*- coding: cp936 -*- from sklearn import cross_validation c = [] filename = r"Raw.data" #原始数据 out_train = open(r"train.txt","w") #训练集 out_test = open(r"test.txt","w") #测试集 for line in open(filename):     items = line.strip().split(",")      c.append(items)   c_train,c_test = cross_validation.train_test_split(c,test_size=0.1)#size =你需要的比例 for i in c_train:     out_train.write(",".join(i)+" ") for i in c_test:     out_test.write(",".join(i)+" ")

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • document for Byte Swap
    Swap Byte for document -document for Byte Swap
    2022-02-25 06:04:58下载
    积分:1
  • 繁体
    繁体-简体转换控件-History-English conversion Controls
    2022-04-10 21:12:10下载
    积分:1
  • │ Array.cpp │ Array.ds w │ Array.h │ Array.rc │ ArrayDlg.cpp │ ArrayDl...
    │ Array.cpp │ Array.ds w │ Array.h │ Array.rc │ ArrayDlg.cpp │ ArrayDlg.h │ ReadMe.txt │ Resource.h │ StdAfx.cpp │ StdAfx.h │ └─res Array.ico Array.rc2 MFC的数组类支持的数组类似于C++中的常规数组,可以存放任何数据类型。C++的常规数组在使用前必须将其定义成能够容纳所有可能需要的元素,而MFC数组类创建的对象可以根据需要动态地增大或减小,数组的起始下标是0,而上限可以是固定的,也可以随着元素的增加而增加,数组在内存中的地址仍然是连续分配的。   MFC定义了数组模板类CArray,并针对各种常用变量类型定义了CByteArray,CWordArray,CUIntArray,CDWordArray,CStringArray,CObArray,CPtrArray。 MFC数组类使用方法基本相同。--- Array.cpp Array.dsp---- Array .dsw . h-- Array.rc ArrayDlg.cpp---- Read ArrayDlg.h Me.txt-- Resource.h StdAfx.cpp---- supply-StdAfx.h res Array.ico Array.rc2 MFC array is an array type of support similar to the regular C Regulation array can store any data type. Conventional C prior to the use of the array must be defined as possible to accommodate all the needs of the elements, MFC array type and the object can be created based on the need to dynamically increase or decrease the threshold array index is 0, and the ceiling i
    2022-03-07 20:55:03下载
    积分:1
  • SPI这个RAR使用闪烁的串行闪存
    spi rar this rar file use to flashing serial flash
    2022-05-31 21:51:00下载
    积分:1
  • // 试用举例: #include "ZUtf8_16.h" 见包中的说明。
    // 试用举例: #include "ZUtf8_16.h" 见包中的说明。-//For the trial :# include "ZUtf8_16.h" see included in the note.
    2022-09-24 23:40:02下载
    积分:1
  • INI控制,c写的,可以放到Linux/Wince的OS
    INI文件控制,c写的,可以放到Linux/Wince的OS-INI file control, c write, you can put Linux/Wince of OS
    2022-08-24 15:42:54下载
    积分:1
  • vc++ 系统检测 源码
    vc++ 文件系统检测 源码 -filesystem_monitor_in_vc_c++.
    2023-06-02 11:30:04下载
    积分:1
  • for general inclusion in the database management need not start small
    用于一般通讯录的管理不需要启动数据库很小-for general inclusion in the database management need not start small
    2022-08-15 21:09:46下载
    积分:1
  • ssl漏洞侦测原始码
    ssl漏洞侦测原始码
    2022-01-27 12:13:03下载
    积分:1
  • RTF源代码
    RTF文件处理源代码-RTF document processing source code
    2022-10-16 19:35:03下载
    积分:1
  • 696518资源总数
  • 106227会员总数
  • 11今日下载