zhuxi 2 years ago
parent
commit
cc4d8edb99
1 changed files with 4 additions and 2 deletions
  1. 4 2
      LIB/MIDDLE/FaultDetection/V1_0_2/aelstm.py

+ 4 - 2
LIB/MIDDLE/FaultDetection/V1_0_2/aelstm.py

@@ -112,8 +112,8 @@ def ref(test_loss,new_test):
     test_loss_sum=test_loss.sum(axis=1)
     test_loss_max=test_loss.max(axis=1)
     ref_test=new_test[['n_split','window_step']].reset_index(drop=True)
-    ref_test['test_loss_sum']=test_loss_sum
-    ref_test['test_loss_max']=test_loss_max
+    ref_test['test_loss_sum']=list(map(lambda x: round(x,3),test_loss_sum))
+    ref_test['test_loss_max']=list(map(lambda x: round(x,3),test_loss_max))
     return ref_test
 
 def prediction(df_stand,scaler,scaler2,model,model2):
@@ -237,6 +237,8 @@ def threshold(res,group,end_time):
     df_res=df_res.rename(columns = {"product_id_x": "product_id"})
     df_res=df_res.rename(columns = {"SOC[%]": "SOC"})
     df_res2=df_res[['product_id','start_time','end_time','diff_min','SOC','AnoScoreV_sum_max','AnoScoreV_max_max','AnoScoreT_sum_max','AnoScoreT_max_max']]
+    df_res2['start_time']=list(map(lambda x:str(x),list(df_res2['start_time'])))
+    df_res2['end_time']=list(map(lambda x:str(x),list(df_res2['end_time'])))
     return df_res2,diff
 
 def arrange(result,result_final,start_time,diff):