-
原始数据划分为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
-
用VC实现遍历文件夹并建成对应的目录数。实现的操作封装成类,可重用。...
用VC实现遍历文件夹并建成对应的目录数。实现的操作封装成类,可重用。-with VC traverse folders and the completion of the corresponding directory number. To achieve the package into operation category, reusable.
- 2023-01-09 10:25:04下载
- 积分:1
-
VC 操作文件的小例子,包括读取指定的文件,并替换指定的内容并写入另一个文件中...
VC 操作文件的小例子,包括读取指定的文件,并替换指定的内容并写入另一个文件中-VC operation documents small examples, including the designated read in the paper, and the replacement of the designated content, and write another document
- 2022-07-09 13:04:08下载
- 积分:1
-
Change the file access, support for more than windows2000 operating system
更改文件的访问权限,支持windows2000 以上操作系统-Change the file access, support for more than windows2000 operating system
- 2022-08-09 01:32:15下载
- 积分:1
-
二进制文件的读、写、修改
文件操作的对象是:Operator.sys
二进制文件的读、写、修改
文件操作的对象是:Operator.sys-Binary file read, write, modify the file operations is targeted at: Operator.sys
- 2022-04-28 06:34:06下载
- 积分:1
-
分形图象压缩的软件,利用迭呆法实现图象的压缩算法
分形图象压缩的软件,利用迭呆法实现图象的压缩算法-Fractal image compression software, use again and again to stay law realize image compression algorithm
- 2022-06-16 02:12:52下载
- 积分:1
-
用二叉树的算法对指定目录下的文件和目录以格式化的方法保存。...
用二叉树的算法对指定目录下的文件和目录以格式化的方法保存。
-Using Binary tree to save the text in sepecific file and catalogue
- 2022-02-10 17:50:58下载
- 积分:1
-
打开Excel文件并可以根据设置向指定单元格写入数据
打开Excel文件并可以根据设置向指定单元格写入数据-Control Excel to write files
- 2023-03-21 05:45:03下载
- 积分:1
-
可以对文件的最后时间进行批量修改,并且可以批量修改名称。很实用...
可以对文件的最后时间进行批量修改,并且可以批量修改名称。很实用-document can be time for the final volume changes and volume changes can name. Practical
- 2022-06-16 03:41:49下载
- 积分:1
-
读取ACVIEW 的shpfile 格式文件,并输出为文本文件的小程序。
读取ACVIEW 的shpfile 格式文件,并输出为文本文件的小程序。-the shpfile ACVIEW read format, and output to a text file of small programs.
- 2022-02-15 08:28:00下载
- 积分:1