From 9e60784cecb7d4c8db5906ae1420be06045c6a62 Mon Sep 17 00:00:00 2001 From: Kieran Elmes Date: Fri, 25 Mar 2022 17:59:08 +1300 Subject: [PATCH] fix intercept always resetting to 0 --- src/regression.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/regression.cpp b/src/regression.cpp index 90cd6d5..8bd1fdc 100644 --- a/src/regression.cpp +++ b/src/regression.cpp @@ -44,7 +44,7 @@ void check_beta_order(robin_hood::unordered_flat_map* beta, } float update_intercept(float *rowsum, float *Y, int n, float lambda, float intercept) { - float sumn = 0.0; + float sumn = intercept*n; for (int i = 0; i < n; i++) { sumn -= rowsum[i]; }