How to export predictions?
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
Hello,
I created a predictive model with the classification learner but I can't actually see the predictions. What do I need to do in order to see them and how can I export them to excel?
Thanks
採用された回答
Ridwan Alam
2019 年 11 月 21 日
編集済み: Ridwan Alam
2019 年 11 月 21 日
On the Classification Learner app, there is "export model" button.
After you have the model exported to your workspace, you can use
yhat = model.predictFcn(x)
where x is your input or test data.
If you want to write the variable yhat to csv, use csvwrite() or any similar function.
A helpful link:
7 件のコメント
Tiago Afonso
2019 年 11 月 21 日
I managed to get predictions on new data but it shows only a categorical response. The target variable uses 3 categories. How can I turn the predictions into a percentage? For instance, 50% category A, 30% category B, 20% category C.
Ridwan Alam
2019 年 11 月 21 日
編集済み: Ridwan Alam
2019 年 11 月 21 日
[yhat, yscores] = predict(model, x);
% yscores are the posterior probabilities for each class
% yscores is a matrix of size N-by-K, where N is the number of observations (rows) in x,
% and K is the number of classes (in model.ClassNames).
% yscores(i,j) is the posterior probability that row i of x is of class j.
% to convert the probabilities into percentage
ypercentage = 100*yscores;
I believe this answers your question.
Tiago Afonso
2019 年 11 月 21 日
I tried it and got this message:
'model' requires Simulink.
I'm using a trial version of MatLab by the way.
Ridwan Alam
2019 年 11 月 21 日
編集済み: Ridwan Alam
2019 年 11 月 21 日
'model' should be replaced by the variable name you assigned to your exported model from the Classification Learner app.
Btw, please accept this as an answer and vote up if you liked to converse. Thanks!
Tiago Afonso
2019 年 11 月 21 日
This is what I get now:
>> [yhat, yscores] = predict(trainedModel, gggggggggggg)
Undefined function 'predict' for input arguments of type 'table'.
"gggggggggggg" is the name of the new data file.
Ridwan Alam
2019 年 11 月 21 日
[yhat, yscores] = predict(trainedModel, table2array(gggggggggggg))
Tiago Afonso
2019 年 11 月 21 日
I get this now:
>> [yhat, yscores] = predict(trainedModel, table2array(gggggggggggg))
Error using table2array (line 37)
Unable to concatenate the specified table variables.
Caused by:
Error using categorical/cat (line 119)
Unable to concatenate a string array and a categorical array.
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Programmatic Model Editing についてさらに検索
タグ
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
