Pārlūkot izejas kodu

Update fonction score

Jérôme BUISINE 3 gadi atpakaļ
vecāks
revīzija
8b377d896f
1 mainītis faili ar 5 papildinājumiem un 1 dzēšanām
  1. 5 1
      find_best_attributes_surrogate_svm.py

+ 5 - 1
find_best_attributes_surrogate_svm.py

@@ -7,6 +7,7 @@ import numpy as np
 import logging
 import datetime
 import random
+import math
 
 # model imports
 from sklearn.model_selection import train_test_split
@@ -181,7 +182,10 @@ def main():
             # model = model.fit(x_train_filters, y_train_filters)
             
             y_test_model = model.predict(x_test_filters)
+            y_train_model = model.predict(x_train_filters)
+
             test_roc_auc = roc_auc_score(self._data['y_test'], y_test_model)
+            train_roc_auc = roc_auc_score(y_train_filters, y_train_model)
 
             end = datetime.datetime.now()
 
@@ -190,7 +194,7 @@ def main():
             print('----')
             print("Real evaluation took: {}, score found: {}".format(divmod(diff.days * 86400 + diff.seconds, 60), test_roc_auc))
 
-            return test_roc_auc
+            return test_roc_auc * (1 - math.pow(test_roc_auc - train_roc_auc), 2)
 
 
     # build all output folder and files based on `output` name