From 367face635c4ab9c6b854a6174213d656e9ad593 Mon Sep 17 00:00:00 2001
From: Caroline DE POURTALES <cdepourt@montana.irit.fr>
Date: Mon, 16 May 2022 17:21:01 +0200
Subject: [PATCH] update

---
 data_retriever.json                                 |  1 -
 .../RandomForest/RandomForestComponent.py           | 13 +++++--------
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/data_retriever.json b/data_retriever.json
index c85d663..5a1a78b 100644
--- a/data_retriever.json
+++ b/data_retriever.json
@@ -16,7 +16,6 @@
             "solvers" : [],
             "xtypes" : {
                 "AXp": "Abductive Explanation", "CXp": "Contrastive explanation"}
-
         },
         {
             "ml_type" : "RandomForest",
diff --git a/pages/application/RandomForest/RandomForestComponent.py b/pages/application/RandomForest/RandomForestComponent.py
index c02c75e..97deaee 100644
--- a/pages/application/RandomForest/RandomForestComponent.py
+++ b/pages/application/RandomForest/RandomForestComponent.py
@@ -31,13 +31,10 @@ class RandomForestComponent:
         # Conversion model
         options = {}
         if info is not None and '.csv' in type_info:
-            self.data = Dataset(info)
-            self.data.mapping_features()
-            options["n_classes"] = self.data.num_class
-            options["feature_names"] = self.data.feature_names
-            options["n_features"] = self.data.nb_features
-            if isinstance(model, RandomForestClassifier) or isinstance(model, VotingClassifier)\
+            if isinstance(model, RandomForestClassifier) or isinstance(model, VotingClassifier) \
                     or isinstance(model, xrf.rndmforest.RF2001):
+                self.data = Dataset(info)
+                self.data.mapping_features()
                 self.random_forest = XRF(model, self.data)
             elif isinstance(model, XGBRFClassifier):
                 self.random_forest = XGBRandomForest(options, from_model=model)
@@ -70,9 +67,9 @@ class RandomForestComponent:
         self.network = html.Div([])
 
         # Creating a clean and nice text component
-        compt=0
+        compt = 0
         for sample_expl in explanation_result:
-            compt+=1
+            compt += 1
             self.explanation.append(html.H4("Sample{0} : \n".format(compt)))
             for k in sample_expl.keys():
                 self.explanation.append(html.H5(k))
-- 
GitLab