Error using gather GATHER requires at least as many inputs as outputs.

6 views (last 30 days)
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

Accepted Answer

Walter Roberson
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)

Categories

Find more on Parallel Computing Fundamentals in Help Center and File Exchange

Tags

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!