How to export predictions?
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
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.
[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!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 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)
