cesar 2 meses atrás
pai
commit
785131b7bc
4 arquivos alterados com 15668 adições e 11 exclusões
  1. 7827
    0
      data/2025-02-12_5_.csv
  2. 7828
    0
      data/2025-02-13_5_.csv
  3. BIN
      paper/Adapt25_Paper_Template_updated_AKO_v1.docx
  4. 13
    11
      v5_class.py

+ 7827
- 0
data/2025-02-12_5_.csv
Diferenças do arquivo suprimidas por serem muito extensas
Ver arquivo


+ 7828
- 0
data/2025-02-13_5_.csv
Diferenças do arquivo suprimidas por serem muito extensas
Ver arquivo


BIN
paper/Adapt25_Paper_Template_updated_AKO_v1.docx Ver arquivo


+ 13
- 11
v5_class.py Ver arquivo

@@ -42,7 +42,7 @@ parser.add_option("-p", "--plot", dest="plot", help="Only plot data (false)", de
42 42
 # 5.  Open door
43 43
 
44 44
 
45
-NumberOfFailures=3  # So far, we have only data for the first 4 types of failures
45
+NumberOfFailures=4  # So far, we have only data for the first 4 types of failures
46 46
 datafiles=[[],[]]   # 0 for train,  1 for test
47 47
 for i in range(NumberOfFailures+1):
48 48
     datafiles[0].append([])
@@ -53,21 +53,21 @@ datafiles[0][0]=['2024-08-07_5_','2024-08-08_5_','2025-01-25_5_','2025-01-26_5_'
53 53
 datafiles[0][1]=['2024-12-11_5_', '2024-12-12_5_','2024-12-13_5_'] 
54 54
 datafiles[0][2]=['2024-12-18_5_','2024-12-21_5_','2024-12-22_5_','2024-12-23_5_','2024-12-24_5_'] 
55 55
 datafiles[0][3]=['2024-12-28_5_','2024-12-29_5_','2024-12-30_5_'] 
56
-#datafiles[0][4]=['2025-02-05_5_','2025-02-10_5_']
56
+datafiles[0][4]=['2025-02-13_5_']
57 57
 
58 58
 if options.transition:
59 59
     datafiles[1][0]=['2025-01-27_5_','2025-01-28_5_'] 
60 60
     datafiles[1][1]=['2024-12-14_5_','2024-12-15_5_','2024-12-16_5_']  # with TRANSITION
61 61
     datafiles[1][2]=['2024-12-17_5_','2024-12-19_5_','2024-12-25_5_','2024-12-26_5_'] # with TRANSITION
62 62
     datafiles[1][3]=['2024-12-27_5_','2024-12-31_5_','2025-01-01_5_'] # with TRANSITION
63
-    #datafiles[1][4]=['2025-02-05_5_','2025-02-10_5_']
63
+    datafiles[1][4]=['2025-02-12_5_','2025-02-13_5_']
64 64
 
65 65
 else:
66 66
     datafiles[1][0]=['2025-01-27_5_','2025-01-28_5_'] 
67 67
     datafiles[1][1]=['2024-12-14_5_','2024-12-15_5_'] 
68 68
     datafiles[1][2]=['2024-12-19_5_','2024-12-25_5_','2024-12-26_5_'] 
69 69
     datafiles[1][3]=['2024-12-31_5_','2025-01-01_5_'] 
70
-    #datafiles[1][4]=['2025-02-05_5_','2025-02-10_5_']
70
+    datafiles[1][4]=['2025-02-13_5_']
71 71
  
72 72
 
73 73
 #datafiles[0][4]=['2025-02-05_5_'] 
@@ -318,8 +318,8 @@ def plotData():
318 318
 
319 319
 
320 320
 #   2nd scenario. Go over anomalies and classify it by less error
321
-datalist=[dataTestNorm[0],dataTestNorm[1],dataTestNorm[2],dataTestNorm[3]]
322
-#datalist=[dataTestNorm[0],dataTestNorm[1],dataTestNorm[2],dataTestNorm[3],dataTestNorm[4]]
321
+#datalist=[dataTestNorm[0],dataTestNorm[1],dataTestNorm[2],dataTestNorm[3]]
322
+datalist=[dataTestNorm[0],dataTestNorm[1],dataTestNorm[2],dataTestNorm[3],dataTestNorm[4]]
323 323
 x_test=create_sequences(datalist[0],int(options.timesteps))
324 324
 for i in range(1,len(datalist)):
325 325
     x_test=np.vstack((x_test,create_sequences(datalist[i],int(options.timesteps))))
@@ -336,7 +336,7 @@ if options.plot:
336 336
     plotData()
337 337
     exit(0)
338 338
 
339
-testClasses=[0,1,2,3]
339
+testClasses=[0,1,2,3,4]
340 340
 
341 341
 if not len(testClasses)==len(testRanges):
342 342
     print("ERROR:  testClasses and testRanges must have same length")
@@ -460,7 +460,6 @@ def anomalyMetric(classes,testranges,testclasses):
460 460
     print("F1-Score: ",F1)
461 461
 
462 462
 anomalyMetric(classes,testRanges,testClasses)
463
-plotData4()
464 463
 
465 464
 # Compute delay until correct detection for a list of ranges (when transition data exists)
466 465
 def computeDelay(l,classes,testRanges,testClasses):
@@ -471,18 +470,21 @@ def computeDelay(l,classes,testRanges,testClasses):
471 470
         start=testRanges[i][0]
472 471
         count=0
473 472
         while start<testRanges[i][1]:
474
-            start+=1
475 473
             if classes[start]==testClasses[i]:
476 474
                 count+=1
477
-            if count==NoFailsInARow:
475
+            if count==NoFailsInARow or start==(testRanges[i][1]-1):
478 476
                 count=0
479 477
                 #print(start,start-testRanges[i][0]-NoFailsInARow+timesteps)
480 478
                 d[ind]=start-testRanges[i][0]-NoFailsInARow+timesteps
481 479
                 break
480
+            start+=1
482 481
         ind+=1
482
+    print(d)
483 483
     return(d.mean())
484 484
 
485
-d=computeDelay([2,3],classes,testRanges,testClasses)
485
+print(testRanges)
486
+d=computeDelay([2,3,4],classes,testRanges,testClasses)
486 487
 print("mean delay: ",d)
488
+plotData4()
487 489
 
488 490
 

Powered by TurnKey Linux.