有没有一种方法可以强制使用某些集合,并让其他集合在Matlab神经网络中随机决定?

有没有一种方法可以强制使用某些集合,并让其他集合在Matlab神经网络中随机决定?,matlab,neural-network,Matlab,Neural Network,我的问题是关于。在我的分类任务中,我想用11个索引测试网络,但我想做很多分类,我需要Matlab随机决定使用哪些向量进行训练和验证,就像从NNSTART启动的GUI一样。 可能吗 我需要如何更改以下代码 net.divideFcn = 'divideind'; net.divideParam.trainInd=1:102; % The first 127 vectors are for training. net.dividnet.divideParam.valInd=103:127;

我的问题是关于。在我的分类任务中,我想用11个索引测试网络,但我想做很多分类,我需要Matlab随机决定使用哪些向量进行训练和验证,就像从NNSTART启动的GUI一样。 可能吗

我需要如何更改以下代码

net.divideFcn = 'divideind';
net.divideParam.trainInd=1:102;  % The first 127 vectors are for training.
net.dividnet.divideParam.valInd=103:127;    % The next 25 vectors are for validation.
net.divideParam.testInd=128:138; % The last 11 vectors are for testing the network.

我想你可以用随机的方式分配这些数字

比如:

indx=103:138;
rand_indx=indx(randperm(length(indx))); % reorder them randomly

net.dividnet.divideParam.valInd=rand_indx(1:25);    % The next 25 vectors are for validation.
net.divideParam.testInd=rand_indx(26:end); % The last 11 vectors are for testing the network.

@dzsezusz硬编码随机索引?为什么不使用这种方法?我使用switch case语句手动划分了培训和验证集,然后进行了分类。它对我的问题非常有效。@dzsezusz我想,但它更有意义,可以通过编程实现,既可以进一步提高可读性,又可以避免人为因素手动选择正确的数据。最后,你为什么要用手工编程呢!?