Csar Fdez 1 week ago
parent
commit
4fce44680b
1 changed files with 10 additions and 4 deletions
  1. 10
    4
      v5_class.py

+ 10
- 4
v5_class.py View File

125
     dftemp=[]
125
     dftemp=[]
126
     for f in datafiles[1][i]:
126
     for f in datafiles[1][i]:
127
         print("                 ", f)
127
         print("                 ", f)
128
-        #df1 = pd.read_csv('./data/'+f+'.csv', parse_dates=['datetime'], dayfirst=True, index_col='datetime')
129
         df1 = pd.read_csv('./data/'+f+'.csv')
128
         df1 = pd.read_csv('./data/'+f+'.csv')
130
         dftemp.append(df1)
129
         dftemp.append(df1)
131
     df_list[1][i]=pd.concat(dftemp)
130
     df_list[1][i]=pd.concat(dftemp)
152
     dataframe[1][i].dropna(inplace=True)
151
     dataframe[1][i].dropna(inplace=True)
153
 
152
 
154
 
153
 
155
-# Train data is first 2/3 of data. Not exactly. L
156
-# Test data is: last 1/3 of data 
154
+# Train data i [0] and test data is [1]
157
 dataTrain=[]
155
 dataTrain=[]
158
 dataTest=[]
156
 dataTest=[]
159
 for i in range(NumberOfFailures+1):
157
 for i in range(NumberOfFailures+1):
161
     dataTest.append(dataframe[1][i])
159
     dataTest.append(dataframe[1][i])
162
 
160
 
163
 # Calculate means and stdev
161
 # Calculate means and stdev
162
+
163
+
164
+
165
+
164
 a=dataTrain[0]
166
 a=dataTrain[0]
165
 for i in range(1,NumberOfFailures+1):
167
 for i in range(1,NumberOfFailures+1):
166
     a=np.vstack((a,dataTrain[i]))
168
     a=np.vstack((a,dataTrain[i]))
298
         s+=featureNames[features[indexesToPlot[i]]]
300
         s+=featureNames[features[indexesToPlot[i]]]
299
         s+=' '+unitNames[features[indexesToPlot[i]]]
301
         s+=' '+unitNames[features[indexesToPlot[i]]]
300
         if NumFeaturesToPlot==1:
302
         if NumFeaturesToPlot==1:
303
+
304
+
305
+
306
+
301
             axes.set_ylabel(s)
307
             axes.set_ylabel(s)
302
             axes.grid()
308
             axes.grid()
303
         else:
309
         else:
347
 
353
 
348
 test_mae_loss=np.array((test_mae_loss))
354
 test_mae_loss=np.array((test_mae_loss))
349
 test_mae_loss_average=np.mean(test_mae_loss,axis=2)  # average over features
355
 test_mae_loss_average=np.mean(test_mae_loss,axis=2)  # average over features
350
-classes=np.argmin(test_mae_loss_average,axis=0)
356
+classes=np.argmin(test_mae_loss_average,axis=0)    # Choose the minimum loss
351
 
357
 
352
 x=[]
358
 x=[]
353
 y=[]
359
 y=[]

Powered by TurnKey Linux.