From 1ab7e5228774250130aed258b01316658857a106 Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 27 Dec 2023 16:12:09 +0100 Subject: [PATCH] Small otpimization to MLPPLinReg::normal_equation(). --- mlpp/lin_reg/lin_reg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlpp/lin_reg/lin_reg.cpp b/mlpp/lin_reg/lin_reg.cpp index 33beb28..c509a9b 100644 --- a/mlpp/lin_reg/lin_reg.cpp +++ b/mlpp/lin_reg/lin_reg.cpp @@ -673,7 +673,7 @@ void MLPPLinReg::normal_equation() { Ref temp; //temp.resize(_k); - temp = _input_set->transposen()->multn(_input_set)->inverse()->mult_vec(_input_set->transposen()->mult_vec(_output_set)); + temp = input_set_t->multn(_input_set)->inverse()->mult_vec(input_set_t->mult_vec(_output_set)); ERR_FAIL_COND_MSG(Math::is_nan(temp->element_get(0)), "ERR: Resulting matrix was noninvertible/degenerate, and so the normal equation could not be performed. Try utilizing gradient descent.");