Commits

Ning Sun committed 183e699

finished anormal detection

  • Participants
  • Parent commits 72f9a77

Comments (0)

Files changed (2)

mlclass-ex8/estimateGaussian.m

 
 
 
+mu = sum(X) / m;
 
-
+sigma2 = sum((bsxfun(@minus, X, mu).^2)) / m;
 
 
 

mlclass-ex8/selectThreshold.m

 
 
 
+  cvp  = (pval < epsilon);
+  tp = sum((cvp == 1) & (yval == 1));
+  fp = sum((cvp == 1) & (yval == 0));
+  fn = sum((cvp == 0) & (yval == 1));
 
+  prec = tp/(tp+fp);
+  rec = tp/(tp+fn);
 
-
-
+  F1 = 2*prec*rec/(prec+rec);