From 4eeb72ea42da862b7fc5a2f865e23b2cddfbd947 Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Sun, 28 Jun 2020 01:04:44 +0000 Subject: [PATCH] Documentation for b79445ff82a3764f258c807df18c6dc40881bc70 --- ...__least__squares__regressor_8cpp__incl.map | 2 +- ...__least__squares__regressor_8cpp__incl.md5 | 2 +- ...__least__squares__regressor_8cpp__incl.svg | 6 +- d4/d68/qr__decompose_8h_source.html | 19 +- d4/d86/large__number_8h_source.html | 14 + d5/d88/md__d_i_r_e_c_t_o_r_y.html | 2 +- ...inary__least__squares__regressor_8cpp.html | 160 ++++--- ...rdinary__least__squares__regressor_8cpp.js | 4 +- ...261f3c3c3dfdb86f3004eb8aaffea8d_cgraph.map | 10 + ...261f3c3c3dfdb86f3004eb8aaffea8d_cgraph.md5 | 1 + ...261f3c3c3dfdb86f3004eb8aaffea8d_cgraph.svg | 139 ++++++ ...1a3968e7947464bee7714f6d43b7002_cgraph.map | 20 - ...1a3968e7947464bee7714f6d43b7002_cgraph.md5 | 1 - ...1a3968e7947464bee7714f6d43b7002_cgraph.svg | 433 ------------------ ...68e7947464bee7714f6d43b7002_cgraph_org.svg | 345 -------------- ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map | 28 +- ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 | 2 +- ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg | 330 +++---------- ...b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg | 330 +++---------- dir_3343723ae086de42ee4ca9774da3a13f.html | 3 + dir_3343723ae086de42ee4ca9774da3a13f.js | 3 +- dir_9c6faab82c22511b50177aa2e38e2780.html | 3 - dir_9c6faab82c22511b50177aa2e38e2780.js | 1 - files.html | 10 +- globals_func_m.html | 34 +- globals_func_o.html | 10 +- globals_func_t.html | 15 +- globals_i.html | 10 +- globals_m.html | 56 +-- globals_o.html | 10 +- globals_t.html | 19 +- navtreeindex0.js | 20 +- navtreeindex1.js | 2 +- navtreeindex2.js | 2 +- navtreeindex3.js | 62 +-- navtreeindex4.js | 2 +- search/all_10.js | 188 ++++---- search/all_11.js | 30 +- search/all_12.js | 190 ++++---- search/all_13.js | 410 ++++++++--------- search/all_14.js | 186 ++++---- search/all_15.js | 122 ++--- search/all_16.js | 68 +-- search/all_17.js | 158 +++---- search/all_18.js | 8 +- search/all_19.js | 8 +- search/all_1a.js | 4 +- search/all_1b.js | 182 ++++---- search/all_9.js | 2 +- search/all_d.js | 4 +- search/all_f.js | 115 ++--- search/classes_0.js | 36 +- search/classes_1.js | 78 ++-- search/classes_10.js | 6 +- search/classes_11.js | 78 ++-- search/classes_12.js | 80 ++-- search/classes_13.js | 44 +- search/classes_14.js | 66 +-- search/classes_15.js | 22 +- search/classes_16.js | 62 +-- search/classes_17.js | 4 +- search/classes_18.js | 2 +- search/classes_2.js | 68 +-- search/classes_3.js | 30 +- search/classes_4.js | 34 +- search/classes_5.js | 34 +- search/classes_6.js | 12 +- search/classes_7.js | 10 +- search/classes_8.js | 196 ++++---- search/classes_9.js | 2 +- search/classes_a.js | 4 +- search/classes_b.js | 34 +- search/classes_c.js | 72 +-- search/classes_d.js | 34 +- search/classes_e.js | 24 +- search/classes_f.js | 34 +- search/defines_0.js | 4 +- search/defines_1.js | 4 +- search/defines_2.js | 4 +- search/defines_3.js | 2 +- search/defines_4.js | 4 +- search/defines_5.js | 8 +- search/defines_6.js | 4 +- search/files_0.js | 8 +- search/files_1.js | 22 +- search/files_10.js | 8 +- search/files_11.js | 4 +- search/files_12.js | 22 +- search/files_13.js | 8 +- search/files_14.js | 2 +- search/files_2.js | 10 +- search/files_3.js | 12 +- search/files_4.js | 6 +- search/files_5.js | 16 +- search/files_6.js | 10 +- search/files_7.js | 6 +- search/files_8.js | 4 +- search/files_9.js | 2 +- search/files_a.js | 6 +- search/files_b.js | 18 +- search/files_c.js | 10 +- search/files_d.js | 6 +- search/files_e.js | 8 +- search/files_f.js | 18 +- search/functions_0.js | 4 +- search/functions_1.js | 152 +++--- search/functions_10.js | 144 +++--- search/functions_11.js | 12 +- search/functions_12.js | 140 +++--- search/functions_13.js | 338 +++++++------- search/functions_14.js | 148 +++--- search/functions_15.js | 80 ++-- search/functions_16.js | 44 +- search/functions_17.js | 146 +++--- search/functions_18.js | 6 +- search/functions_19.js | 2 +- search/functions_1a.js | 2 +- search/functions_1b.js | 182 ++++---- search/functions_2.js | 112 ++--- search/functions_3.js | 140 +++--- search/functions_4.js | 152 +++--- search/functions_5.js | 100 ++-- search/functions_6.js | 202 ++++---- search/functions_7.js | 106 ++--- search/functions_8.js | 28 +- search/functions_9.js | 170 +++---- search/functions_a.js | 6 +- search/functions_b.js | 16 +- search/functions_c.js | 86 ++-- search/functions_d.js | 158 +++---- search/functions_e.js | 92 ++-- search/functions_f.js | 111 ++--- search/groups_0.js | 2 +- search/groups_1.js | 2 +- search/groups_2.js | 2 +- search/namespaces_0.js | 2 +- search/namespaces_1.js | 2 +- search/namespaces_2.js | 18 +- search/pages_0.js | 2 +- search/pages_1.js | 2 +- search/pages_2.js | 2 +- search/pages_3.js | 4 +- search/related_0.js | 10 +- search/typedefs_0.js | 2 +- search/typedefs_1.js | 2 +- search/typedefs_2.js | 2 +- search/variables_0.js | 2 +- search/variables_1.js | 6 +- search/variables_10.js | 2 +- search/variables_11.js | 2 +- search/variables_12.js | 2 +- search/variables_2.js | 4 +- search/variables_3.js | 2 +- search/variables_4.js | 2 +- search/variables_5.js | 4 +- search/variables_6.js | 6 +- search/variables_7.js | 2 +- search/variables_8.js | 2 +- search/variables_9.js | 2 +- search/variables_a.js | 2 +- search/variables_b.js | 4 +- search/variables_c.js | 4 +- search/variables_d.js | 8 +- search/variables_e.js | 4 +- search/variables_f.js | 2 +- 165 files changed, 3506 insertions(+), 4576 deletions(-) create mode 100644 dc/d38/ordinary__least__squares__regressor_8cpp_a4261f3c3c3dfdb86f3004eb8aaffea8d_cgraph.map create mode 100644 dc/d38/ordinary__least__squares__regressor_8cpp_a4261f3c3c3dfdb86f3004eb8aaffea8d_cgraph.md5 create mode 100644 dc/d38/ordinary__least__squares__regressor_8cpp_a4261f3c3c3dfdb86f3004eb8aaffea8d_cgraph.svg delete mode 100644 dc/d38/ordinary__least__squares__regressor_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.map delete mode 100644 dc/d38/ordinary__least__squares__regressor_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.md5 delete mode 100644 dc/d38/ordinary__least__squares__regressor_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.svg delete mode 100644 dc/d38/ordinary__least__squares__regressor_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph_org.svg diff --git a/d1/d4b/ordinary__least__squares__regressor_8cpp__incl.map b/d1/d4b/ordinary__least__squares__regressor_8cpp__incl.map index cee9012ba..543159b7c 100644 --- a/d1/d4b/ordinary__least__squares__regressor_8cpp__incl.map +++ b/d1/d4b/ordinary__least__squares__regressor_8cpp__incl.map @@ -1,4 +1,4 @@ - + diff --git a/d1/d4b/ordinary__least__squares__regressor_8cpp__incl.md5 b/d1/d4b/ordinary__least__squares__regressor_8cpp__incl.md5 index 722ec6c02..7af9c75ee 100644 --- a/d1/d4b/ordinary__least__squares__regressor_8cpp__incl.md5 +++ b/d1/d4b/ordinary__least__squares__regressor_8cpp__incl.md5 @@ -1 +1 @@ -868ad72095fe395df7c4d0862a42dea5 \ No newline at end of file +aeca54c7c366fb2ba509eb865c3e6b19 \ No newline at end of file diff --git a/d1/d4b/ordinary__least__squares__regressor_8cpp__incl.svg b/d1/d4b/ordinary__least__squares__regressor_8cpp__incl.svg index 35a9f8d32..1f68ce594 100644 --- a/d1/d4b/ordinary__least__squares__regressor_8cpp__incl.svg +++ b/d1/d4b/ordinary__least__squares__regressor_8cpp__incl.svg @@ -3,18 +3,18 @@ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> - + -numerical_methods/ordinary_least_squares_regressor.cpp +machine_learning/ordinary_least_squares_regressor.cpp Node1 -numerical_methods/ordinary +machine_learning/ordinary _least_squares_regressor.cpp diff --git a/d4/d68/qr__decompose_8h_source.html b/d4/d68/qr__decompose_8h_source.html index d8661d5d3..23034d7f4 100644 --- a/d4/d68/qr__decompose_8h_source.html +++ b/d4/d68/qr__decompose_8h_source.html @@ -312,27 +312,19 @@ $(document).ready(function(){initNavTree('d4/d68/qr__decompose_8h_source.html','
#define MAX_ITERATIONS
Maximum number of iterations to check.
Definition: newton_raphson_method.cpp:21
void semi_implicit_euler_step(const double dx, const double &x, std::valarray< double > *y, std::valarray< double > *dy)
Compute next step approximation using the semi-implicit-Euler method.
Definition: ode_semi_implicit_euler.cpp:82
-
std::vector< T > operator+(std::vector< T > const &A, std::vector< T > const &B)
Definition: ordinary_least_squares_regressor.cpp:198
static double eq(double i)
Definition: newton_raphson_method.cpp:29
T cos(T... args)
static double eq_der(double i)
Definition: newton_raphson_method.cpp:39
void exact_solution(const double &x, std::valarray< double > *y)
Exact solution of the problem. Used for solution comparison.
Definition: ode_forward_euler.cpp:67
T atof(T... args)
-
STL class.
-
T size(T... args)
int main(int argc, char *argv[])
Definition: ode_forward_euler.cpp:188
T setfill(T... args)
void midpoint_euler_step(const double dx, const double &x, std::valarray< double > *y, std::valarray< double > *dy)
Compute next step approximation using the midpoint-Euler method.
Definition: ode_midpoint_euler.cpp:85
-
bool is_square(std::vector< std::vector< T >> const &A)
Definition: ordinary_least_squares_regressor.cpp:57
T sqrt(T... args)
Functions to compute QR decomposition of any rectangular matrix.
-
std::vector< std::vector< T > > operator*(std::vector< std::vector< T >> const &A, std::vector< std::vector< T >> const &B)
Definition: ordinary_least_squares_regressor.cpp:74
void forward_euler_step(const double dx, const double &x, std::valarray< double > *y, std::valarray< double > *dy)
Compute next step approximation using the forward-Euler method.
Definition: ode_forward_euler.cpp:86
-
void test()
Definition: ordinary_least_squares_regressor.cpp:358
T clock(T... args)
-
std::ostream & operator<<(std::ostream &out, std::vector< std::vector< T >> const &v)
Definition: ordinary_least_squares_regressor.cpp:22
void save_exact_solution(const double &X0, const double &X_MAX, const double &step_size, const std::valarray< double > &Y0)
Definition: ode_forward_euler.cpp:152
-
void test1(double eta=0.01)
Definition: adaline_learning.cpp:204
std::valarray< T > vector_proj(const std::valarray< T > &a, const std::valarray< T > &b)
Definition: qr_decompose.h:104
STL class.
@@ -340,8 +332,6 @@ $(document).ready(function(){initNavTree('d4/d68/qr__decompose_8h_source.html','
T close(T... args)
T perror(T... args)
STL class.
-
int main()
Definition: ordinary_least_squares_regressor.cpp:410
-
std::vector< float > predict_OLS_regressor(std::vector< std::vector< T >> const &X, std::vector< float > const &beta)
Definition: ordinary_least_squares_regressor.cpp:342
T open(T... args)
std::ostream & operator<<(std::ostream &out, std::valarray< std::valarray< T >> const &v)
Definition: qr_decompose.h:33
double forward_euler(double dx, double x0, double x_max, std::valarray< double > *y, bool save_to_file=false)
Compute approximation using the forward-Euler method in the given limits.
Definition: ode_forward_euler.cpp:102
@@ -350,13 +340,9 @@ $(document).ready(function(){initNavTree('d4/d68/qr__decompose_8h_source.html','
T sin(T... args)
#define EPSILON
system accuracy limit
Definition: newton_raphson_method.cpp:20
void problem(const double &x, std::valarray< double > *y, std::valarray< double > *dy)
Problem statement for a system with first-order differential equations. Updates the system differenti...
Definition: ode_forward_euler.cpp:54
-
int data[MAX]
test data
Definition: hash_search.cpp:24
-
std::vector< float > fit_OLS_regressor(std::vector< std::vector< T >> const &X, std::vector< T > const &Y)
Definition: ordinary_least_squares_regressor.cpp:312
-
std::vector< T > operator-(std::vector< T > const &A, std::vector< T > const &B)
Definition: ordinary_least_squares_regressor.cpp:177
T endl(T... args)
-
std::vector< std::vector< float > > get_inverse(std::vector< std::vector< T >> const &A)
Definition: ordinary_least_squares_regressor.cpp:220
double vector_dot(const std::valarray< T > &a, const std::valarray< T > &b)
Definition: qr_decompose.h:76
-
T left(T... args)
+
T right(T... args)
void problem(const double &x, std::valarray< double > *y, std::valarray< double > *dy)
Problem statement for a system with first-order differential equations. Updates the system differenti...
Definition: ode_midpoint_euler.cpp:53
int main()
Definition: newton_raphson_method.cpp:44
double midpoint_euler(double dx, double x0, double x_max, std::valarray< double > *y, bool save_to_file=false)
Compute approximation using the midpoint-Euler method in the given limits.
Definition: ode_midpoint_euler.cpp:107
@@ -368,14 +354,11 @@ $(document).ready(function(){initNavTree('d4/d68/qr__decompose_8h_source.html','
void exact_solution(const double &x, std::valarray< double > *y)
Exact solution of the problem. Used for solution comparison.
Definition: ode_semi_implicit_euler.cpp:66
T setw(T... args)
-
void test2(double eta=0.01)
Definition: adaline_learning.cpp:238
T is_open(T... args)
void exact_solution(const double &x, std::valarray< double > *y)
Exact solution of the problem. Used for solution comparison.
Definition: ode_midpoint_euler.cpp:66
-
std::vector< float > operator/(std::vector< T > const &A, float const scalar)
Definition: ordinary_least_squares_regressor.cpp:168
int main(int argc, char *argv[])
Definition: ode_midpoint_euler.cpp:192
T pow(T... args)
-
std::vector< std::vector< T > > get_transpose(std::vector< std::vector< T >> const &A)
Definition: ordinary_least_squares_regressor.cpp:291

main function

410  {
-
411  test();
+
411  ols_test();
412 
413  size_t N, F;
414 
@@ -460,7 +460,79 @@ template<typename T >
Here is the call graph for this function:
-
+
+
+
+ +
+ + +

◆ ols_test()

+ +
+
+ + + + + + + +
void ols_test ()
+
+

Self test checks

+
358  {
+
359  int F = 3, N = 5;
+
360 
+
361  /* test function = x^2 -5 */
+
362  std::cout << "Test 1 (quadratic function)....";
+
363  // create training data set with features = x, x^2, x^3
+ +
365  {{-5, 25, -125}, {-1, 1, -1}, {0, 0, 0}, {1, 1, 1}, {6, 36, 216}});
+
366  // create corresponding outputs
+
367  std::vector<float> Y1({20, -4, -5, -4, 31});
+
368  // perform regression modelling
+
369  std::vector<float> beta1 = fit_OLS_regressor(data1, Y1);
+
370  // create test data set with same features = x, x^2, x^3
+
371  std::vector<std::vector<float>> test_data1(
+
372  {{-2, 4, -8}, {2, 4, 8}, {-10, 100, -1000}, {10, 100, 1000}});
+
373  // expected regression outputs
+
374  std::vector<float> expected1({-1, -1, 95, 95});
+
375  // predicted regression outputs
+
376  std::vector<float> out1 = predict_OLS_regressor(test_data1, beta1);
+
377  // compare predicted results are within +-0.01 limit of expected
+
378  for (size_t rows = 0; rows < out1.size(); rows++)
+
379  assert(std::abs(out1[rows] - expected1[rows]) < 0.01);
+
380  std::cout << "passed\n";
+
381 
+
382  /* test function = x^3 + x^2 - 100 */
+
383  std::cout << "Test 2 (cubic function)....";
+
384  // create training data set with features = x, x^2, x^3
+ +
386  {{-5, 25, -125}, {-1, 1, -1}, {0, 0, 0}, {1, 1, 1}, {6, 36, 216}});
+
387  // create corresponding outputs
+
388  std::vector<float> Y2({-200, -100, -100, 98, 152});
+
389  // perform regression modelling
+
390  std::vector<float> beta2 = fit_OLS_regressor(data2, Y2);
+
391  // create test data set with same features = x, x^2, x^3
+
392  std::vector<std::vector<float>> test_data2(
+
393  {{-2, 4, -8}, {2, 4, 8}, {-10, 100, -1000}, {10, 100, 1000}});
+
394  // expected regression outputs
+
395  std::vector<float> expected2({-104, -88, -1000, 1000});
+
396  // predicted regression outputs
+
397  std::vector<float> out2 = predict_OLS_regressor(test_data2, beta2);
+
398  // compare predicted results are within +-0.01 limit of expected
+
399  for (size_t rows = 0; rows < out2.size(); rows++)
+
400  assert(std::abs(out2[rows] - expected2[rows]) < 0.01);
+
401  std::cout << "passed\n";
+
402 
+
403  std::cout << std::endl; // ensure test results are displayed on screen
+
404  // (flush stdout)
+
405 }
+
+Here is the call graph for this function:
+
+
@@ -969,78 +1041,6 @@ template<typename T >
354  return result;
355 }
- - - -

◆ test()

- -
-
- - - - - - - -
void test ()
-
-

Self test checks

-
358  {
-
359  int F = 3, N = 5;
-
360 
-
361  /* test function = x^2 -5 */
-
362  std::cout << "Test 1 (quadratic function)....";
-
363  // create training data set with features = x, x^2, x^3
- -
365  {{-5, 25, -125}, {-1, 1, -1}, {0, 0, 0}, {1, 1, 1}, {6, 36, 216}});
-
366  // create corresponding outputs
-
367  std::vector<float> Y1({20, -4, -5, -4, 31});
-
368  // perform regression modelling
-
369  std::vector<float> beta1 = fit_OLS_regressor(data1, Y1);
-
370  // create test data set with same features = x, x^2, x^3
- -
372  {{-2, 4, -8}, {2, 4, 8}, {-10, 100, -1000}, {10, 100, 1000}});
-
373  // expected regression outputs
-
374  std::vector<float> expected1({-1, -1, 95, 95});
-
375  // predicted regression outputs
- -
377  // compare predicted results are within +-0.01 limit of expected
-
378  for (size_t rows = 0; rows < out1.size(); rows++)
-
379  assert(std::abs(out1[rows] - expected1[rows]) < 0.01);
-
380  std::cout << "passed\n";
-
381 
-
382  /* test function = x^3 + x^2 - 100 */
-
383  std::cout << "Test 2 (cubic function)....";
-
384  // create training data set with features = x, x^2, x^3
- -
386  {{-5, 25, -125}, {-1, 1, -1}, {0, 0, 0}, {1, 1, 1}, {6, 36, 216}});
-
387  // create corresponding outputs
-
388  std::vector<float> Y2({-200, -100, -100, 98, 152});
-
389  // perform regression modelling
-
390  std::vector<float> beta2 = fit_OLS_regressor(data2, Y2);
-
391  // create test data set with same features = x, x^2, x^3
- -
393  {{-2, 4, -8}, {2, 4, 8}, {-10, 100, -1000}, {10, 100, 1000}});
-
394  // expected regression outputs
-
395  std::vector<float> expected2({-104, -88, -1000, 1000});
-
396  // predicted regression outputs
- -
398  // compare predicted results are within +-0.01 limit of expected
-
399  for (size_t rows = 0; rows < out2.size(); rows++)
-
400  assert(std::abs(out2[rows] - expected2[rows]) < 0.01);
-
401  std::cout << "passed\n";
-
402 
-
403  std::cout << std::endl; // ensure test results are displayed on screen
-
404  // (flush stdout)
-
405 }
-
-Here is the call graph for this function:
-
-
-
-
-
@@ -1049,8 +1049,6 @@ Here is the call graph for this function:
T size(T... args)
T setfill(T... args)
bool is_square(std::vector< std::vector< T >> const &A)
Definition: ordinary_least_squares_regressor.cpp:57
-
void test()
Definition: ordinary_least_squares_regressor.cpp:358
-
void test1(double eta=0.01)
Definition: adaline_learning.cpp:204
std::vector< float > predict_OLS_regressor(std::vector< std::vector< T >> const &X, std::vector< float > const &beta)
Definition: ordinary_least_squares_regressor.cpp:342
int data[MAX]
test data
Definition: hash_search.cpp:24
@@ -1058,14 +1056,14 @@ Here is the call graph for this function:
T endl(T... args)
std::vector< std::vector< float > > get_inverse(std::vector< std::vector< T >> const &A)
Definition: ordinary_least_squares_regressor.cpp:220
T left(T... args)
+
void ols_test()
Definition: ordinary_least_squares_regressor.cpp:358
T setw(T... args)
-
void test2(double eta=0.01)
Definition: adaline_learning.cpp:238
std::vector< std::vector< T > > get_transpose(std::vector< std::vector< T >> const &A)
Definition: ordinary_least_squares_regressor.cpp:291