Undefined function 'predict' for input arguments of type 'table'.

predict(RUSBoostedTreeModel,X) gives the error "Undefined function 'predict' for input arguments of type 'table'". The documentation https://nl.mathworks.com/help/stats/compactclassificationensemble.predict.html says that X can be a table. What could be the issue? X is of the same format as the data the model was trained on.

 採用された回答

Steven Lord
Steven Lord 2018 年 3 月 19 日

0 投票

Which release of Statistics and Machine Learning Toolbox are you using?
Does the documentation for the predict function in your installation say that the second input can be a table? The online documentation is for the most recent release and so may describe functionality introduced in a later release than you have installed. Your locally installed documentation will describe the functionality you actually have installed.

6 件のコメント

Patrick Schulz
Patrick Schulz 2018 年 3 月 19 日
I'm using R2017b (9.3.0.71...) and my help tells me that tables should work.
Steven Lord
Steven Lord 2018 年 3 月 19 日
Does the ver function indicate you have Statistics and Machine Learning Toolbox installed?
Patrick Schulz
Patrick Schulz 2018 年 3 月 19 日
well, I used the toolbox to train and export the model, so I'm pretty sure it's installed.
Steven Lord
Steven Lord 2018 年 3 月 19 日
Can you show the outputs of class evaluated on the first input of your call to predict? There are many different overloads of predict for various classes and I want to make sure that the one you're using behaves the way that documentation page says it should.
Just looking at the first page of documentation search results I see functions/methods named predict in System Identification Toolbox, Neural Network Toolbox, Statistics and Machine Learning Toolbox, Computer Vision System Toolbox, and Automated Driving System Toolbox.
Patrick Schulz
Patrick Schulz 2018 年 3 月 20 日
編集済み: Patrick Schulz 2018 年 3 月 20 日
ans = 'struct'
edit
Found and answer by using
Model.HowToPredict
'To make predictions on a new table, T, use:
yfit = c.predictFcn(T)
Steven Lord
Steven Lord 2018 年 3 月 20 日
That makes sense. There's no predict method on either the struct or table classes, so MATLAB doesn't know what to run when you call predict. The error mentions table rather than struct because table is a dominant class to struct.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDeep Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by