title: Probabilistic image classification using imageCategoryClassifier MATLAB
body: <p>I got a classifier with my training set containing images of three types following this guide: <a href="https://ch.mathworks.com/help/vision/examples/image-category-classification-using-bag-of-features.html" rel="nofollow noreferrer">https://ch.mathworks.com/help/vision/examples/image-category-classification-using-bag-of-features.html</a></p>
  
  <p>Now I want to use this classifier to classify the images of another dataset. Outputs are supposed to give me the predicted types of the images and corresponding probabilities.</p>
  
  <p>I found the function "predict" to do the prediction.</p>
  
  <p>Link: <a href="https://ch.mathworks.com/help/vision/ref/imagecategoryclassifier.predict.html" rel="nofollow noreferrer">https://ch.mathworks.com/help/vision/ref/imagecategoryclassifier.predict.html</a></p>
  
  <p>However, I have two questions</p>
  
  <p>First, it says:
  [labelIdx,score] = predict(categoryClassifier,imds) returns the predicted label index and score for the images specified in imds.</p>
  
  <p>I don't understand this "score". It says: "The score provides a negated average binary loss per class". And the outputs of "score" are negative. So is there any way I can obtain the probability(should be [0,1]) from this "score"?</p>
  
  <p>Second, my testing datasets contains images of 6 types, that is, 3 more types than my classifier. But with the function "predict", it will give a label from one of three types to each images. How can I add an extra label to point out the images that cannot be classified into any of the three types?</p>
  
  <p>I think this one could be solved if I can get the probabilities from my first question. At least I could set a threshold to change the labels manually.</p>
  
  <p>Any suggestions that could help solve these problems? Thanks a lot!</p>