Error using gather GATHER requires at least as many inputs as outputs.
조회 수: 1 (최근 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!