Error using gather GATHER requires at least as many inputs as outputs.
3 次查看(过去 30 天)
显示 更早的评论
Hi I am creating a code to use fitcnb function with my clean dataset
I got this error after the code run for sometimes
Error using gather
GATHER requires at least as many inputs as outputs.
Error in fitcnbFunction (line 46)
[Mdl,HyperparameterOptimizationResults]=gather(fitcnb(xdata,ydata,'DistributionNames','mvmn'));
could you please help
0 个评论
采纳的回答
Walter Roberson
2022-9-21
You are invoking tall array's gather function, https://www.mathworks.com/help/matlab/ref/tall.gather.html
The syntax for that permits multiple outputs, but only when there are multiple inputs, in which case it gathers each input array into its corresponding output array.
gather() with multiple outputs cannot be used to collect and gather multiple outputs of a function: you have to assign those outputs to variables and gather() the variables.
But the fitcnb() function you are invoking is https://www.mathworks.com/help/stats/fitcnb.html which only ever has a single output anyhow. You can extract HyperparameterOptimizationResults as a property of the returned model, not as a separate output.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Naive Bayes 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!