Error using gather GATHER requires at least as many inputs as outputs.
3 views (last 30 days)
Show older comments
Ibtihal Alsaleh
on 21 Sep 2022
Commented: Ibtihal Alsaleh
on 23 Sep 2022
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 Comments
Accepted Answer
Walter Roberson
on 21 Sep 2022
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.
More Answers (0)
See Also
Categories
Find more on Naive Bayes in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!