From d02f832298ecacf25f919389e2ab86e093b3ba80 Mon Sep 17 00:00:00 2001
From: Thomas <purcell@fhi-berlin.mpg.de>
Date: Sat, 18 Sep 2021 17:06:00 +0200
Subject: [PATCH] Update FeatureSpace to fix bug

The bug shown was argsort on a vector of size 0
---
 src/feature_creation/feature_space/FeatureSpace.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/feature_creation/feature_space/FeatureSpace.cpp b/src/feature_creation/feature_space/FeatureSpace.cpp
index 64a1cfd8..21eb4352 100644
--- a/src/feature_creation/feature_space/FeatureSpace.cpp
+++ b/src/feature_creation/feature_space/FeatureSpace.cpp
@@ -579,6 +579,10 @@ void FeatureSpace::remove_duplicate_features(std::vector<node_ptr>& feat_set, in
     project_funcs::project_r(_prop_train.data(), scores.data(), feat_set, _task_sizes_train, 1);
 
     scores.erase(scores.begin(), scores.begin() + start);
+    if(scores.size() == 0)
+    {
+        throw std::logic_error("No features created during this rung (" + std::to_string(feat_set.back()->rung() + 1) + ")");
+    }
     std::vector<int> inds = util_funcs::argsort<double>(scores);
 
     std::vector<int> del_inds;
-- 
GitLab