From 20d629f3bc55fe757f422d16123bcbe043cce66f Mon Sep 17 00:00:00 2001
From: Thomas <purcell@fhi-berlin.mpg.de>
Date: Sun, 4 Jul 2021 13:39:40 +0200
Subject: [PATCH] Bug Fix: LossFunction _n_project set too late

fix that bug
---
 src/loss_function/LossFunctionPearsonRMSE.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/loss_function/LossFunctionPearsonRMSE.cpp b/src/loss_function/LossFunctionPearsonRMSE.cpp
index 3860eb22..820b48ac 100644
--- a/src/loss_function/LossFunctionPearsonRMSE.cpp
+++ b/src/loss_function/LossFunctionPearsonRMSE.cpp
@@ -48,7 +48,7 @@ void LossFunctionPearsonRMSE::set_nfeat(int n_feat)
 
 void LossFunctionPearsonRMSE::reset_projection_prop(const std::vector<std::vector<model_node_ptr>>& models)
 {
-
+    _n_project_prop = models.size();
     _projection_prop.resize(_n_samp * _n_project_prop);
     for(int mm = 0; mm < _n_project_prop; ++mm)
     {
@@ -57,7 +57,6 @@ void LossFunctionPearsonRMSE::reset_projection_prop(const std::vector<std::vecto
     }
 
     set_nfeat(models.back().size() + 1);
-    _n_project_prop = models.size();
     prepare_project();
 }
 
@@ -116,6 +115,7 @@ double LossFunctionPearsonRMSE::project(const node_ptr& feat)
 
 double LossFunctionPearsonRMSE::calc_max_pearson(double* feat_val_ptr)
 {
+    std::cout << "TEST IN" << std::endl;
     int start = 0;
     for(int tt = 0; tt < _task_sizes_train.size(); ++tt)
     {
@@ -145,6 +145,7 @@ double LossFunctionPearsonRMSE::calc_max_pearson(double* feat_val_ptr)
 
         start += _task_sizes_train[tt];
     }
+    std::cout << "TEST OUT" << std::endl;
     return *std::max_element(_scores.begin(), _scores.end()) / static_cast<double>(-1 * _n_task);
 }
 
-- 
GitLab