cesar 2 weeks ago
parent
commit
321b3a7fa7
1 changed files with 19 additions and 10 deletions
  1. 19
    10
      v4_class.py

+ 19
- 10
v4_class.py View File

344
 test_mae_loss_average=np.mean(test_mae_loss,axis=2)  # average over features
344
 test_mae_loss_average=np.mean(test_mae_loss,axis=2)  # average over features
345
 classes=np.argmin(test_mae_loss_average,axis=0)
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
 def plotData4():
360
 def plotData4():
349
     NumFeaturesToPlot=len(indexesToPlot)
361
     NumFeaturesToPlot=len(indexesToPlot)
360
                 init=end
372
                 init=end
361
                 end+=(testRanges[j+1][1]-testRanges[j+1][0])
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
         s=''
380
         s=''
377
         s+=featureNames[features[indexesToPlot[i]]]
381
         s+=featureNames[features[indexesToPlot[i]]]
378
         s+=' '+unitNames[features[indexesToPlot[i]]]
382
         s+=' '+unitNames[features[indexesToPlot[i]]]
379
         axes[i].set_ylabel(s)
383
         axes[i].set_ylabel(s)
380
         axes[i].grid()
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
     axes[NumFeaturesToPlot-1].set_xlabel("Sample number")
390
     axes[NumFeaturesToPlot-1].set_xlabel("Sample number")
382
     plt.show()
391
     plt.show()
383
 
392
 

Powered by TurnKey Linux.