cesar před 2 týdny
rodič
revize
321b3a7fa7
1 změnil soubory, kde provedl 19 přidání a 10 odebrání
  1. 19
    10
      v4_class.py

+ 19
- 10
v4_class.py Zobrazit soubor

@@ -344,6 +344,18 @@ test_mae_loss=np.array((test_mae_loss))
344 344
 test_mae_loss_average=np.mean(test_mae_loss,axis=2)  # average over features
345 345
 classes=np.argmin(test_mae_loss_average,axis=0)
346 346
 
347
+x=[]
348
+y=[]
349
+for j in range(NumberOfFailures+1):
350
+    x.append([])
351
+    y.append([])
352
+for j in range(NumberOfFailures+1):
353
+    for k in range(testRanges[j][0],testRanges[j][1]):
354
+        if not  classes[k]==j:
355
+            x[classes[k]].append(k)
356
+            y[classes[k]].append(x_test[k,0,indexesToPlot[0]]*stdevs[0]+means[0])
357
+
358
+
347 359
 
348 360
 def plotData4():
349 361
     NumFeaturesToPlot=len(indexesToPlot)
@@ -360,24 +372,21 @@ def plotData4():
360 372
                 init=end
361 373
                 end+=(testRanges[j+1][1]-testRanges[j+1][0])
362 374
 
363
-        for j in range(NumberOfFailures+1):
364
-            x=[]
365
-            y=[]
366
-            for k in range(len(classes)):
367
-                if classes[k]==j:
368
-                    x.append(k)
369
-                    y.append(x_test[k,0,indexesToPlot[i]]*stdevs[i]+means[i])
370
-            axes[i].plot(x,y ,color=colordot[j],marker='.',markersize=10,linewidth=0,label="Fail detect  type "+str(j) )
375
+            #if i==0:
376
+            #    axes[0].plot(x[j],y[j] ,color=colordot[j],marker='.',markersize=10,linewidth=0,label="Fail detect  type "+str(j) )
371 377
 
372 378
 
373 379
 
374
-        if i==(NumFeatures-1):
375
-            axes[i].legend(loc='right')
376 380
         s=''
377 381
         s+=featureNames[features[indexesToPlot[i]]]
378 382
         s+=' '+unitNames[features[indexesToPlot[i]]]
379 383
         axes[i].set_ylabel(s)
380 384
         axes[i].grid()
385
+    for j in range(NumberOfFailures+1):
386
+        axes[0].plot(x[j],y[j] ,color=colordot[j],marker='.',markersize=10,linewidth=0,label="Fail detect  type "+str(j) )
387
+    axes[0].legend(ncol=4,loc=(0.1,0.98))
388
+
389
+        
381 390
     axes[NumFeaturesToPlot-1].set_xlabel("Sample number")
382 391
     plt.show()
383 392
 

Powered by TurnKey Linux.