What is difference between training set and test set database?

4 vues (au cours des 30 derniers jours)
preeti
preeti le 20 Mai 2015
Commenté : Walter Roberson le 20 Mai 2015
I have collection of database having images with 25 categories like mountains,rivers,fields,chaparal ,etc .Each category have 40 images.Now I dont know how to divide the dataset into training and test set.In my project a query image from query folder is fired and from the dataset the similar images will be given as output.
Pls suggest how to divide the dataset in good ratio.

Réponses (1)

Walter Roberson
Walter Roberson le 20 Mai 2015
  2 commentaires
preeti
preeti le 20 Mai 2015
Modifié(e) : Walter Roberson le 20 Mai 2015
Thank you Sir,
But I have dataset of 1000 images with 25 categories
I get this code
nrows = size(YourData,1);
r80 = round(0.80 * nrows);
rand80 = randperm(nrows,r80);
trainingset = YourData(rand80,:);
testset = YourData;
testset(rand80,:) = [];
but wat should be urdata?
Walter Roberson
Walter Roberson le 20 Mai 2015
Suppose that you read the images into I{K} for the K'th image, so I is a cell array of data arrays. And suppose that all of the images are exactly the same size. Then
T = cellfun(@(img) img(:), I); %make columns from each image
T2 = horzcat(T{:}); %splice the columns together
YourData = T2.'; %so each image is now a row vector

Connectez-vous pour commenter.

Catégories

En savoir plus sur Statistics and Machine Learning Toolbox dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by