python中shuffleSplit()函数
来源:互联网 发布:java高级编程培训 编辑:程序博客网 时间:2024/05/22 02:25
参数:
n : int
数据集中的元素总数。
n_iter : int (default 10)
重新洗牌和分裂迭代次数。
test_size : float (default 0.1), int, or None
如果是float类型的数据, 这个数应该介于0-1.0之间,代表test集所占比例. 如果是int类型, 代表test集的数量. 如果为None, 值将自动设置为train集大小的补集
train_size : float, int, or None (default is None)
如果是float类型的数据 应该介于0和1之间,并表示数据集在train集分割中所占的比例 如果是int类型, 代表train集的样本数量. 如果为None, 值将自动设置为test集大小的补集
random_state : int or RandomState
用于随机抽样的伪随机数发生器状态。
>>> from sklearn import cross_validation>>> rs = cross_validation.ShuffleSplit(4, n_iter=3,... test_size=.25, random_state=0)>>> len(rs)3>>> print(rs)... ShuffleSplit(4, n_iter=3, test_size=0.25, ...)>>> for train_index, test_index in rs:... print("TRAIN:", train_index, "TEST:", test_index)...TRAIN: [3 1 0] TEST: [2]TRAIN: [2 1 3] TEST: [0]TRAIN: [0 2 1] TEST: [3]>>> rs = cross_validation.ShuffleSplit(4, n_iter=3,... train_size=0.5, test_size=.25, random_state=0)>>> for train_index, test_index in rs:... print("TRAIN:", train_index, "TEST:", test_index)...TRAIN: [3 1] TEST: [2]TRAIN: [2 1] TEST: [0]TRAIN: [0 2] TEST: [3].. automethod:: __init__
0 0
- python中shuffleSplit()函数
- python中join()函数
- Python中enumerate()函数的用法
- python函数总结(更新中。。。)
- python中矩阵相加函数sum()
- python中__str__()函数的用法
- python中join()函数的用法
- Python中bytearray()函数的初识
- Python中 内置函数
- python中函数陷阱
- python中range函数
- python 中enumerate函数
- python中sorted()函数
- Python中函数参数
- Python中map()函数
- python中调用函数
- python 中range函数
- python中range函数
- Python学习笔记(六)——面向对象编程
- WSL问题之32位程序运行
- cmake 解决错误:Cannot specify link libraries for target
- 利用Ghost作为图床
- CCF NOI1021 发放奖金
- python中shuffleSplit()函数
- CSDN如何转载他人文章
- Centos 下搭建FTP上传下载服务器
- CCF NOI1022 平均年龄
- CCF NOI1023 最大跨度
- unity粒子系统与UGUI三步选
- python画散点图简单示例
- Centos安装mysql心路历程
- MarkDown序列图案例