1

I am working on epilepsy seizure prediction using CNN. I want to find True negative value in my code.I have true positive,false positive and false negative but I don't know how to find true negative value. That's my code explain how I found true positive,false positive and false negative values.

Any help would be appreciated.

interPrediction=model.predict_generator(generate_arrays_for_predict(indexPat, filesPath), max_queue_size=4, steps=len(filesPath))
preictPrediction=model.predict_generator(generate_arrays_for_predict(indexPat, filesPath), max_queue_size=4, steps=len(filesPath))
acc=0 #accumulator
fp=0
tp=0
fn=0
lastTenResult=list()
for el in interPrediction:
    if(el[1]>0.5):
         acc=acc+1
         lastTenResult.append(1)
    else:
         lastTenResult.append(0)
    if(len(lastTenResult)>10):
         acc=acc-lastTenResult.pop(0)
    if(acc>=8):
      fp=fp+1
      lastTenResult=list()
      acc=0
lastTenResult=list()
for el in preictPrediction:
    if(el[1]>0.5):
       acc=acc+1
       lastTenResult.append(1)
    else:
       lastTenResult.append(0)
    if(len(lastTenResult)>10):
       acc=acc-lastTenResult.pop(0)
    if(acc>=8):
      tp=tp+1 
    else:
        if(len(lastTenResult)==10):
          fn=fn+1 
desertnaut
  • 57,590
  • 26
  • 140
  • 166
Eda
  • 565
  • 1
  • 7
  • 18
  • Does this helps: https://stackoverflow.com/questions/31324218/scikit-learn-how-to-obtain-true-positive-true-negative-false-positive-and-fal? – Pygirl Jul 21 '20 at 14:24
  • @Pygirl I don't have `x_train` and `y_train` in my code. I use `model.fit_generator`. – Eda Jul 21 '20 at 14:27
  • 1
    @Pygirl No it doesn't help – Eda Jul 21 '20 at 15:13

0 Answers0