cesar преди 16 часа
родител
ревизия
6be1cfd48c
променени са 6 файла, в които са добавени 18 реда и са изтрити 11 реда
  1. Двоични данни
      model_v1_0._checkpoint.weights.h5
  2. Двоични данни
      model_v1_1._checkpoint.weights.h5
  3. Двоични данни
      model_v1_2._checkpoint.weights.h5
  4. Двоични данни
      model_v1_3._checkpoint.weights.h5
  5. Двоични данни
      model_v1_4._checkpoint.weights.h5
  6. 18
    11
      v1_multifailure.py

Двоични данни
model_v1_0._checkpoint.weights.h5 Целия файл


Двоични данни
model_v1_1._checkpoint.weights.h5 Целия файл


Двоични данни
model_v1_2._checkpoint.weights.h5 Целия файл


Двоични данни
model_v1_3._checkpoint.weights.h5 Целия файл


Двоични данни
model_v1_4._checkpoint.weights.h5 Целия файл


+ 18
- 11
v1_multifailure.py Целия файл

@@ -46,6 +46,8 @@ datafiles[4]=['2024-12-28_5_','2024-12-29_5_','2024-12-30_5_','2024-12-31_5_','2
46 46
 features=['r1 s1','r1 s4','r1 s5','pa1 apiii']
47 47
 features=['r1 s1','r1 s2','r1 s3','r1 s4','r1 s5','r1 s6','r1 s7','r1 s8','r1 s9','r1 s10','r2 s1','r2 s2','r2 s3','r2 s4','r2 s5','r2 s6','r2 s7','r2 s8','r2 s9','pa1 apiii','tc s1','tc s2']
48 48
 
49
+#features=['r2 s2', 'tc s1','r1 s10','r1 s6','r2 s8']
50
+
49 51
 NumFeatures=len(features)
50 52
 
51 53
 df_list=[]
@@ -114,7 +116,7 @@ def plotData():
114 116
     #axes[1].legend()
115 117
     #axes[0].set_ylabel(features[0])
116 118
     #axes[1].set_ylabel(features[1])
117
-    plt.show()
119
+    #plt.show()
118 120
 
119 121
 #plotData()
120 122
 
@@ -353,6 +355,10 @@ def plotData3():
353 355
 
354 356
 
355 357
 def anomalyMetric(testList):  # first of list is non failure data
358
+    # FP, TP: false/true positive
359
+    # TN, FN: true/false negative
360
+    # Sensitivity: probab of fail detection if data is fail
361
+    # Specificity: prob of no fail detection if data is well
356 362
     x_test = create_sequences(testList[0])
357 363
     x_test_pred = model[0].predict(x_test)
358 364
     test_mae_loss = np.mean(np.abs(x_test_pred - x_test), axis=1)
@@ -361,13 +367,11 @@ def anomalyMetric(testList):  # first of list is non failure data
361 367
     for i in range(anomalies.shape[0]):
362 368
         if AtLeastOneTrue(anomalies[i]):
363 369
             count+=1
364
-    FP=count/anomalies.shape[0]
370
+    FP=count
371
+    TN=anomalies.shape[0]-1
365 372
     count=0
366
-    for i in range(anomalies.shape[0]):
367
-        if AtLeastOneTrue(anomalies[i]):
368
-            count+=1
369
-    FP=count/anomalies.shape[0]
370
-    TN=np.zeros((NumberOfFailures))
373
+    TP=np.zeros((NumberOfFailures))
374
+    FN=np.zeros((NumberOfFailures))
371 375
     for i in range(1,len(testList)):
372 376
         x_test = create_sequences(testList[i])
373 377
         x_test_pred = model[0].predict(x_test)
@@ -377,10 +381,13 @@ def anomalyMetric(testList):  # first of list is non failure data
377 381
         for j in range(anomalies.shape[0]):
378 382
             if AtLeastOneTrue(anomalies[j]):
379 383
                 count+=1
380
-        TN[i-1] = count/anomalies.shape[0]
381
-    print("FP: ",FP)
382
-    print("TN: ",TN)
383
-    return (1-FP)*NumberOfFailures+TN.sum()
384
+        TP[i-1] = count
385
+        FN[i-1] = anomalies.shape[0]-count
386
+    Sensitivity=TP.sum()/(TP.sum()+FN.sum())
387
+    Specifity=TN/(TN+FP)
388
+    print("Sensitivity: ",Sensitivity)
389
+    print("Specifity: ",Specifity)
390
+    return Sensitivity+Specifity
384 391
 
385 392
 
386 393
 

Powered by TurnKey Linux.