Why do I receive "Too many input arguments" error with predict function?

2 ビュー (過去 30 日間)
Camille Godin
Camille Godin 2022 年 9 月 16 日
コメント済み: Camille Godin 2022 年 9 月 16 日
So I have trained a Linear Discriminant Analysis model using
lda = fitcdiscr(Data,Class);
fitcdiscr on training data and I use it to predict the class of new data using:
[ypred,yci] = predict(lda,NewData);
It works well, runs perfectly. I want to play with the alpha coefficient so I can chose the confidence interval of the model. In my understanding, the code that would allow me to do that is:
[ypred,yci] = predict(Mdl,Xnew,'Alpha',0.01);
However, when I run this code, it gives me the error code "Too many input arguments".
I'm trying to understand why this is true and how to fix it. If you have any other idea how I could play with the conservativeness of my model, please let me know.
Thank you so much in advance.

回答 (1 件)

Walter Roberson
Walter Roberson 2022 年 9 月 16 日
The predict method for that kind of object is https://www.mathworks.com/help/stats/compactclassificationdiscriminant.predict.html which does not support any options.
  5 件のコメント
Walter Roberson
Walter Roberson 2022 年 9 月 16 日
That predict() function is for LinearModel objects created with fitlm(). You are creating a ClassificationDiscriminant object instead, and the predict model for it does not support options.
Camille Godin
Camille Godin 2022 年 9 月 16 日
Thank you for clarifying.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDiscriminant Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by