Could anyone help me how to solve the error stating Y must be a vector of categorical responses or a cell array of categorical response sequences.
19 次查看(过去 30 天)
显示 更早的评论
In my code Y is {3x1} cell
where Y{1,1}=12x1 double
Y{2,1}=12x2 double
Y{3,1}=12x3 double
Could anyone help me how should I change Y to a cell array of categorical response sequences.
0 个评论
回答(2 个)
jaah navi
2021-6-20
1 个评论
Walter Roberson
2021-6-20
Sorry, No, that is not valid training information.
If XTrain is a numeric array, then YTrain must be a categorical vector with number of entries equal to the number of samples in XTrain.
If XTrain is a cell array of numeric arrays, then YTrain must be a cell array, and each entry must be a categorical vector with number of entries each to the number of samples in the corresponding XTrain cell.
YTrain corresponds to class labels: each training sample (no matter how many features it has) corresponds to exactly one class.
Your Y{2,1} is 12 x 2. That would imply that you have two classes for each of 12 samples, or else that you have 12 classes for each of two samples. Either way is not permitted.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Deep Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!