Effacer les filtres
Effacer les filtres

How to partition a table or matrix of observation data so that samples from every group are included?

2 vues (au cours des 30 derniers jours)
I have a table of categorized data with 41 categories. Every category has at least 5 samples. If I partition it into a 90:10 training:test split like so:
cvp = cvpartition(data.Category,'Holdout',0.1);
it'll split it into the quantities I want but one group will frequently not contain samples from all 41 categories. How do I split it so that all categories are represented in both the training and test datasets? It's in Table format at the moment but can switch to cell array if needed.

Réponses (1)

Sachin Meena
Sachin Meena le 21 Sep 2018
Try the
cvpartition(group,'HoldOut',p,'Stratify',stratifyOption)
option, refer to cvpartition documentation for examples. You may not need to use tall arrays.

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by