From 2e0a50b6f52cd158bc9b51d5e5e1336905d8dc25 Mon Sep 17 00:00:00 2001 From: Krishna Vedala Date: Thu, 28 May 2020 23:11:39 -0400 Subject: [PATCH] added file brief --- .../ordinary_least_squares_regressor.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/computer_oriented_statistical_methods/ordinary_least_squares_regressor.cpp b/computer_oriented_statistical_methods/ordinary_least_squares_regressor.cpp index 06bd4ea52..de02b27bb 100644 --- a/computer_oriented_statistical_methods/ordinary_least_squares_regressor.cpp +++ b/computer_oriented_statistical_methods/ordinary_least_squares_regressor.cpp @@ -1,11 +1,13 @@ /** * @file + * \brief Linear regression example using [Ordinary least + * squares](https://en.wikipedia.org/wiki/Ordinary_least_squares) * * Program that gets the number of data samples and number of features per * sample along with output per sample. It applies OLS regression to compute * the regression output for additional test data samples. */ -#include +#include // for print formatting #include #include @@ -52,7 +54,8 @@ inline bool is_square(std::vector> const &A) { // Assuming A is square matrix size_t N = A.size(); for (size_t i = 0; i < N; i++) - if (A[i].size() != N) return false; + if (A[i].size() != N) + return false; return true; } @@ -265,7 +268,8 @@ std::vector> get_inverse( inverse[row] = inverse[row] / divisor; // Row transformations for (size_t row2 = 0; row2 < N; row2++) { - if (row2 == row) continue; + if (row2 == row) + continue; float factor = temp[row2][row]; temp[row2] = temp[row2] - factor * temp[row]; inverse[row2] = inverse[row2] - factor * inverse[row];