title: How to plot precision and recall of a CNN in MATLAB?
body: <p>How to plot the precision and recall curves of a CNN?
  I have generated the scores from CNN and want to plot the precision-recall curve, but I am unable to get that.
  I have calculated <code>TP</code>, <code>TN</code>, <code>FP</code>, and <code>FN</code> using:</p>
  
  <pre><code>idx = (ACTUAL()==1);
  p = length(ACTUAL(idx));  
  n = length(ACTUAL(~idx));   
  N = p+n;
  tp = sum(ACTUAL(idx)==PREDICTED(idx));   
  tn = sum(ACTUAL(~idx)==PREDICTED(~idx));   
  fp = n-tn;   
  fn = p-tp;
  </code></pre>
  
  <p>The formula of precision and recall is</p>
  
  <pre><code>precision = tp/(tp+fp)
  </code></pre>
  
  <p>but with that, I am getting some undesired plot.</p>
  
  <p>I have obtained scores of the CNN using the following command:</p>
  
  <pre><code>[YTest,score]=classify(convnet,TestData)
  </code></pre>