![]() |
Separate matrix of column vectors into training and testing data in MATLAB
I'm currently doing a project in MATLAB using the MNIST data set. I have a training data set of n = 50000, represented by a matrix of 784 x 50000 (50000 column vectors of size 784).
I am trying to separate my training and testing data (70-30, respectively), but the method I am using is a bit wordy and brute force for my liking. Being that this is MATLAB, I'm sure there has got to be a better way. The code I have been using is listed below. I'm brand new to MATLAB so please help! Thanks :) % MNIST - data loads into trn and trnAns, representing% the input vectors and the desired output vectors, respectivelyload('Data/mnistTrn.mat');mnist_train = zeros(784, 35000);mnist_train_ans = zeros(10, 35000);mnist_test = zeros(784, 15000);mnist_test_ans = zeros(10, 15000);indexes = zeros(1,50000);for i = 1:50000 indexes(i) = i;endindexes(randperm(length(indexes)));for i = 1:50000 if i |
所有时间均为北京时间。现在的时间是 19:42。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.