dividerand
使用随机索引将目标分为三组
说明
示例
使用 'dividerand'
函数获得训练、验证和测试索引
此示例说明如何使用 dividerand
函数获得训练、验证和测试索引。
将 3000
个采样划分为 60%
用于训练,20%
用于验证,20%
用于测试。
[trainInd,valInd,testInd] = dividerand(3000,0.6,0.2,0.2)
输入参数
Q
— 目标数量
标量
要划分的目标数量,指定为标量。
trainRatio
— 训练比率
0.7
(默认) | 标量
训练向量的比率,指定为标量。
valRatio
— 验证比率
0.15
(默认) | 标量
验证向量的比率,指定为标量。
testRatio
— 测试比率
0.15
(默认) | 标量
测试向量的比率,指定为标量。
输出参量
trainInd
— 训练索引
向量
训练索引,以行向量形式返回。
valInd
— 验证索引
向量
验证索引,以行向量形式返回。
testInd
— 测试索引
向量
测试索引,以行向量形式返回。
详细信息
网络使用
以下网络属性定义在调用 train
时使用哪个数据划分函数、其参数是什么以及划分目标的哪些方面。
net.divideFcn net.divideParam net.divideMode
版本历史记录
在 R2008a 中推出
另请参阅
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)