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

采纳的回答

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

标签

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by