-
原始数据划分为train.dat和test.dat
应用背景开始是做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)+"
")
- 2022-01-25 21:21:56下载
- 积分:1
-
对完整的文件名进行按盘符、路径、文件扩展名进行分割。
对完整的文件名进行按盘符、路径、文件扩展名进行分割。-On the integrity of the file name to carry out by letter, path, file extension separated.
- 2022-07-21 19:23:39下载
- 积分:1
-
工资管理系统
这是一个很好的工资系统程序用此程序中使用的文件系统。欢迎下载,试用。谢谢您的支持。
- 2022-04-11 00:05:28下载
- 积分:1
-
VC产生的临时文件有时真的很烦人!这是一个专门清理VC垃圾的小工具,隔一段时间运行一次,彻底清除指定类型的垃圾文件...
VC产生的临时文件有时真的很烦人!这是一个专门清理VC垃圾的小工具,隔一段时间运行一次,彻底清除指定类型的垃圾文件-VC generated temporary file is sometimes really annoying! This is a specialized VC garbage clean-up of small tools, from time to time to run time, the elimination of designated types of junk file
- 2022-11-06 04:55:02下载
- 积分:1
-
大数据读写
针对大数据,大文件快速读写,尽量减少内存的占用,提高效率,节省时间,并且具有数据兼容性,能够分类提取大文件中的数据,并且分类显示,综合分析。
- 2023-05-24 12:45:03下载
- 积分:1
-
一个用MFC编制的BMP格式读取程序
一个用MFC编制的BMP格式读取程序-MFC prepared to use a BMP format to read the procedures
- 2022-01-24 15:45:07下载
- 积分:1
-
信息交换用光盘的容量和文件结构
Volume and File Structure of CDROM for Information Interchange
- 2022-07-22 11:44:04下载
- 积分:1
-
This is a system of code, professional relatively strong, we want to help! ~
这是gis系统的一个代码,专业性比较强,希望对大家有帮助!~-This is a system of code, professional relatively strong, we want to help! ~
- 2022-02-02 13:20:11下载
- 积分:1
-
window handle through the implementation of File Name
通过窗口句柄得到执行文件名 -window handle through the implementation of File Name
- 2022-02-14 04:22:56下载
- 积分:1
-
检查你的文件。如果你不想
checking your files. If you do not want to
- 2022-05-29 23:56:24下载
- 积分:1