瀏覽代碼

Added CSV generation

Kristian Schultz 4 年之前
父節點
當前提交
640c32ea86
共有 2 個文件被更改,包括 10 次插入14 次删除
  1. 4 8
      Example Exercise.ipynb
  2. 6 6
      library/testers.py

文件差異過大導致無法顯示
+ 4 - 8
Example Exercise.ipynb


+ 6 - 6
library/testers.py

@@ -57,7 +57,7 @@ class TestResult:
         return text
 
 
-    def csvHeading():
+    def csvHeading(self):
         r = [
             "F1 score",
             "balanced accuracy",
@@ -68,22 +68,22 @@ class TestResult:
             ]
 
         if self.aps is not None:
-            r.append(self.aps)
+            r.append("Aps")
 
         return ";".join(r)
 
-    def toCSV():
-        r = [
+    def toCSV(self):
+        r = map(str, [
             self.f1,
             self.bal_acc,
             self.con_mat[0] if len(self.con_mat) > 0 else float(self.con_mat),
             self.con_mat[1] if len(self.con_mat) > 1 else 0,
             self.con_mat[2] if len(self.con_mat) > 2 else 0,
             self.con_mat[3] if len(self.con_mat) > 3 else 0
-            ]
+            ])
 
         if self.aps is not None:
-            r.append(self.aps)
+            r.append(str(self.aps))
 
         return ";".join(r)
 

部分文件因文件數量過多而無法顯示