diff --git a/toolkit.py b/toolkit.py
index d0f44ce251f16a17a026f310bcc404ed54b23e9f..a6b3a0c2304a800b5455e43ddaeb42bda449f49d 100755
--- a/toolkit.py
+++ b/toolkit.py
@@ -823,7 +823,7 @@ class ClassificationProject(object):
         else:
             class_weight = self.balanced_class_weight
         if not self.data_loaded:
-            self._w_train_tot = None
+            raise ValueError("Data not loaded! can't calculate total weight")
         if self._w_train_tot is None:
             if self.apply_class_weight:
                 self._w_train_tot = self.w_train*np.array(class_weight)[self.y_train.astype(int)]