Why is fitcdiscr function much slower than classify?
조회 수: 2 (최근 30일)
이전 댓글 표시
I am classifying some data and I am using fitcdiscr fucntion to train the classifier and its predict method to classify test data. I then found the function classify which does the exact same thing but it trains and predicts the data at the same time. It produces the same results but classify is much faster than fitcdiscr. I have no idea why this is the case...
For the same data I get from tic-toc 'Elapsed time is 5.529583 seconds.' with fitcdiscr and 'Elapsed time is 0.395027 seconds.' with classify.
댓글 수: 0
답변 (1개)
Bernhard Suhm
2018년 3월 25일
It depends on what parameters you pass to either... fitcdiscr supports cross-validation and hyperparameter optimization, and either of those could extend the runtime significantly. Also it does not require you to fit the classifier every time you make a new prediction or you change prior probabilities because it creates a model object.
참고 항목
카테고리
Help Center 및 File Exchange에서 Discriminant Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!