From 2edc6b65078c258963730997a237e7279cb91710 Mon Sep 17 00:00:00 2001 From: Jedges Date: Thu, 15 Aug 2024 14:46:34 +0800 Subject: [PATCH 1/2] fix caculate the MAPE --- models/qor/SynthNetV1/utils.py | 2 +- models/qor/SynthNetV2/utils.py | 2 +- models/qor/SynthNetV3/utils.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/models/qor/SynthNetV1/utils.py b/models/qor/SynthNetV1/utils.py index 416f547..a72c205 100644 --- a/models/qor/SynthNetV1/utils.py +++ b/models/qor/SynthNetV1/utils.py @@ -255,7 +255,7 @@ def doScatterAndTopKRanking(batchLen,batchSize,batchData,dumpDir,trainMode): accuracyFileWriter.write(endDelim) desDF1.to_csv(osp.join(dumpDir,"desDF1_"+trainMode+"_"+d+".csv"),index=False) desDF2.to_csv(osp.join(dumpDir,"desDF2_"+trainMode+"_"+d+".csv"),index=False) - mapeScore = mean_absolute_percentage_error(designDF.prediction.to_list(),designDF.actual.to_list()) + mapeScore = mean_absolute_percentage_error(designDF.actual.to_list(),designDF.prediction.to_list()) print("MAPE ("+d+"): "+str(mapeScore)) accuracyFileWriter.close() diff --git a/models/qor/SynthNetV2/utils.py b/models/qor/SynthNetV2/utils.py index 416f547..a72c205 100644 --- a/models/qor/SynthNetV2/utils.py +++ b/models/qor/SynthNetV2/utils.py @@ -255,7 +255,7 @@ def doScatterAndTopKRanking(batchLen,batchSize,batchData,dumpDir,trainMode): accuracyFileWriter.write(endDelim) desDF1.to_csv(osp.join(dumpDir,"desDF1_"+trainMode+"_"+d+".csv"),index=False) desDF2.to_csv(osp.join(dumpDir,"desDF2_"+trainMode+"_"+d+".csv"),index=False) - mapeScore = mean_absolute_percentage_error(designDF.prediction.to_list(),designDF.actual.to_list()) + mapeScore = mean_absolute_percentage_error(designDF.actual.to_list(),designDF.prediction.to_list()) print("MAPE ("+d+"): "+str(mapeScore)) accuracyFileWriter.close() diff --git a/models/qor/SynthNetV3/utils.py b/models/qor/SynthNetV3/utils.py index 416f547..a72c205 100644 --- a/models/qor/SynthNetV3/utils.py +++ b/models/qor/SynthNetV3/utils.py @@ -255,7 +255,7 @@ def doScatterAndTopKRanking(batchLen,batchSize,batchData,dumpDir,trainMode): accuracyFileWriter.write(endDelim) desDF1.to_csv(osp.join(dumpDir,"desDF1_"+trainMode+"_"+d+".csv"),index=False) desDF2.to_csv(osp.join(dumpDir,"desDF2_"+trainMode+"_"+d+".csv"),index=False) - mapeScore = mean_absolute_percentage_error(designDF.prediction.to_list(),designDF.actual.to_list()) + mapeScore = mean_absolute_percentage_error(designDF.actual.to_list(),designDF.prediction.to_list()) print("MAPE ("+d+"): "+str(mapeScore)) accuracyFileWriter.close() From 7055c5142bba017b9e7b8de46126e9bf897d07ec Mon Sep 17 00:00:00 2001 From: Jedges Date: Thu, 15 Aug 2024 14:49:47 +0800 Subject: [PATCH 2/2] fix caculate the MAPE --- models/qor/SynthNetV1/utils.py | 2 +- models/qor/SynthNetV2/utils.py | 2 +- models/qor/SynthNetV3/utils.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/models/qor/SynthNetV1/utils.py b/models/qor/SynthNetV1/utils.py index a72c205..e39d25a 100644 --- a/models/qor/SynthNetV1/utils.py +++ b/models/qor/SynthNetV1/utils.py @@ -255,7 +255,7 @@ def doScatterAndTopKRanking(batchLen,batchSize,batchData,dumpDir,trainMode): accuracyFileWriter.write(endDelim) desDF1.to_csv(osp.join(dumpDir,"desDF1_"+trainMode+"_"+d+".csv"),index=False) desDF2.to_csv(osp.join(dumpDir,"desDF2_"+trainMode+"_"+d+".csv"),index=False) - mapeScore = mean_absolute_percentage_error(designDF.actual.to_list(),designDF.prediction.to_list()) + mapeScore = mean_absolute_percentage_error(designDF.actual.to_list(),designDF.prediction.to_list()) print("MAPE ("+d+"): "+str(mapeScore)) accuracyFileWriter.close() diff --git a/models/qor/SynthNetV2/utils.py b/models/qor/SynthNetV2/utils.py index a72c205..e39d25a 100644 --- a/models/qor/SynthNetV2/utils.py +++ b/models/qor/SynthNetV2/utils.py @@ -255,7 +255,7 @@ def doScatterAndTopKRanking(batchLen,batchSize,batchData,dumpDir,trainMode): accuracyFileWriter.write(endDelim) desDF1.to_csv(osp.join(dumpDir,"desDF1_"+trainMode+"_"+d+".csv"),index=False) desDF2.to_csv(osp.join(dumpDir,"desDF2_"+trainMode+"_"+d+".csv"),index=False) - mapeScore = mean_absolute_percentage_error(designDF.actual.to_list(),designDF.prediction.to_list()) + mapeScore = mean_absolute_percentage_error(designDF.actual.to_list(),designDF.prediction.to_list()) print("MAPE ("+d+"): "+str(mapeScore)) accuracyFileWriter.close() diff --git a/models/qor/SynthNetV3/utils.py b/models/qor/SynthNetV3/utils.py index a72c205..e39d25a 100644 --- a/models/qor/SynthNetV3/utils.py +++ b/models/qor/SynthNetV3/utils.py @@ -255,7 +255,7 @@ def doScatterAndTopKRanking(batchLen,batchSize,batchData,dumpDir,trainMode): accuracyFileWriter.write(endDelim) desDF1.to_csv(osp.join(dumpDir,"desDF1_"+trainMode+"_"+d+".csv"),index=False) desDF2.to_csv(osp.join(dumpDir,"desDF2_"+trainMode+"_"+d+".csv"),index=False) - mapeScore = mean_absolute_percentage_error(designDF.actual.to_list(),designDF.prediction.to_list()) + mapeScore = mean_absolute_percentage_error(designDF.actual.to_list(),designDF.prediction.to_list()) print("MAPE ("+d+"): "+str(mapeScore)) accuracyFileWriter.close()