diff --git a/d1/d4b/ordinary__least__squares__regressor_8cpp__incl.map b/d1/d4b/ordinary__least__squares__regressor_8cpp__incl.map index 020cd81ca..cee9012ba 100644 --- a/d1/d4b/ordinary__least__squares__regressor_8cpp__incl.map +++ b/d1/d4b/ordinary__least__squares__regressor_8cpp__incl.map @@ -1,6 +1,8 @@ - - - - + + + + + + diff --git a/d1/d4b/ordinary__least__squares__regressor_8cpp__incl.md5 b/d1/d4b/ordinary__least__squares__regressor_8cpp__incl.md5 index 05d572c7b..722ec6c02 100644 --- a/d1/d4b/ordinary__least__squares__regressor_8cpp__incl.md5 +++ b/d1/d4b/ordinary__least__squares__regressor_8cpp__incl.md5 @@ -1 +1 @@ -3342bed250275ada240abc86394a8bff \ No newline at end of file +868ad72095fe395df7c4d0862a42dea5 \ 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 5870dd927..35a9f8d32 100644 --- a/d1/d4b/ordinary__least__squares__regressor_8cpp__incl.svg +++ b/d1/d4b/ordinary__least__squares__regressor_8cpp__incl.svg @@ -4,18 +4,18 @@ - + numerical_methods/ordinary_least_squares_regressor.cpp - + Node1 - -numerical_methods/ordinary -_least_squares_regressor.cpp + +numerical_methods/ordinary +_least_squares_regressor.cpp @@ -23,46 +23,76 @@ Node2 - -iomanip + +cassert Node1->Node2 - - + + Node3 - -iostream + +cmath Node1->Node3 - - + + Node4 - -vector + +iomanip Node1->Node4 - - + + + + + +Node5 + + +iostream + + + + + +Node1->Node5 + + + + + +Node6 + + +vector + + + + + +Node1->Node6 + + diff --git a/d4/d68/qr__decompose_8h_source.html b/d4/d68/qr__decompose_8h_source.html index d5e14ed1b..d8661d5d3 100644 --- a/d4/d68/qr__decompose_8h_source.html +++ b/d4/d68/qr__decompose_8h_source.html @@ -312,7 +312,7 @@ $(document).ready(function(){initNavTree('d4/d68/qr__decompose_8h_source.html',' MAX_ITERATIONS#define MAX_ITERATIONSMaximum number of iterations to check.Definition: newton_raphson_method.cpp:21 semi_implicit_euler_stepvoid 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::clock_t -operator+std::vector< T > operator+(std::vector< T > const &A, std::vector< T > const &B)Definition: ordinary_least_squares_regressor.cpp:196 +operator+std::vector< T > operator+(std::vector< T > const &A, std::vector< T > const &B)Definition: ordinary_least_squares_regressor.cpp:198 eqstatic double eq(double i)Definition: newton_raphson_method.cpp:29 std::cosT cos(T... args) eq_derstatic double eq_der(double i)Definition: newton_raphson_method.cpp:39 @@ -323,14 +323,16 @@ $(document).ready(function(){initNavTree('d4/d68/qr__decompose_8h_source.html',' mainint main(int argc, char *argv[])Definition: ode_forward_euler.cpp:188 std::setfillT setfill(T... args) midpoint_euler_stepvoid 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 -is_squarebool is_square(std::vector< std::vector< T >> const &A)Definition: ordinary_least_squares_regressor.cpp:55 +is_squarebool is_square(std::vector< std::vector< T >> const &A)Definition: ordinary_least_squares_regressor.cpp:57 std::sqrtT sqrt(T... args) qr_algorithmFunctions to compute QR decomposition of any rectangular matrix. -operator*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:72 +operator*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 forward_euler_stepvoid 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 +testvoid test()Definition: ordinary_least_squares_regressor.cpp:358 std::clockT clock(T... args) -operator<<std::ostream & operator<<(std::ostream &out, std::vector< std::vector< T >> const &v)Definition: ordinary_least_squares_regressor.cpp:20 +operator<<std::ostream & operator<<(std::ostream &out, std::vector< std::vector< T >> const &v)Definition: ordinary_least_squares_regressor.cpp:22 save_exact_solutionvoid 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 +test1void test1(double eta=0.01)Definition: adaline_learning.cpp:204 qr_algorithm::vector_projstd::valarray< T > vector_proj(const std::valarray< T > &a, const std::valarray< T > &b)Definition: qr_decompose.h:104 std::cout std::ofstreamSTL class. @@ -338,8 +340,8 @@ $(document).ready(function(){initNavTree('d4/d68/qr__decompose_8h_source.html',' std::ofstream::closeT close(T... args) std::perrorT perror(T... args) std::valarraySTL class. -mainint main()Definition: ordinary_least_squares_regressor.cpp:358 -predict_OLS_regressorstd::vector< float > predict_OLS_regressor(std::vector< std::vector< T >> const &X, std::vector< float > const &beta)Definition: ordinary_least_squares_regressor.cpp:340 +mainint main()Definition: ordinary_least_squares_regressor.cpp:410 +predict_OLS_regressorstd::vector< float > predict_OLS_regressor(std::vector< std::vector< T >> const &X, std::vector< float > const &beta)Definition: ordinary_least_squares_regressor.cpp:342 std::ofstream::openT open(T... args) qr_algorithm::operator<<std::ostream & operator<<(std::ostream &out, std::valarray< std::valarray< T >> const &v)Definition: qr_decompose.h:33 forward_eulerdouble 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 @@ -349,10 +351,10 @@ $(document).ready(function(){initNavTree('d4/d68/qr__decompose_8h_source.html',' EPSILON#define EPSILONsystem accuracy limitDefinition: newton_raphson_method.cpp:20 problemvoid 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 dataint data[MAX]test dataDefinition: hash_search.cpp:24 -fit_OLS_regressorstd::vector< float > fit_OLS_regressor(std::vector< std::vector< T >> const &X, std::vector< T > const &Y)Definition: ordinary_least_squares_regressor.cpp:310 -operator-std::vector< T > operator-(std::vector< T > const &A, std::vector< T > const &B)Definition: ordinary_least_squares_regressor.cpp:175 +fit_OLS_regressorstd::vector< float > fit_OLS_regressor(std::vector< std::vector< T >> const &X, std::vector< T > const &Y)Definition: ordinary_least_squares_regressor.cpp:312 +operator-std::vector< T > operator-(std::vector< T > const &A, std::vector< T > const &B)Definition: ordinary_least_squares_regressor.cpp:177 std::endlT endl(T... args) -get_inversestd::vector< std::vector< float > > get_inverse(std::vector< std::vector< T >> const &A)Definition: ordinary_least_squares_regressor.cpp:218 +get_inversestd::vector< std::vector< float > > get_inverse(std::vector< std::vector< T >> const &A)Definition: ordinary_least_squares_regressor.cpp:220 qr_algorithm::vector_dotdouble vector_dot(const std::valarray< T > &a, const std::valarray< T > &b)Definition: qr_decompose.h:76 std::leftT left(T... args) problemvoid 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 @@ -366,13 +368,14 @@ $(document).ready(function(){initNavTree('d4/d68/qr__decompose_8h_source.html',' exact_solutionvoid 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 std::setwT setw(T... args) std::cin +test2void test2(double eta=0.01)Definition: adaline_learning.cpp:238 std::numeric_limits std::ofstream::is_openT is_open(T... args) exact_solutionvoid exact_solution(const double &x, std::valarray< double > *y)Exact solution of the problem. Used for solution comparison.Definition: ode_midpoint_euler.cpp:66 -operator/std::vector< float > operator/(std::vector< T > const &A, float const scalar)Definition: ordinary_least_squares_regressor.cpp:166 +operator/std::vector< float > operator/(std::vector< T > const &A, float const scalar)Definition: ordinary_least_squares_regressor.cpp:168 mainint main(int argc, char *argv[])Definition: ode_midpoint_euler.cpp:192 std::powT pow(T... args) -get_transposestd::vector< std::vector< T > > get_transpose(std::vector< std::vector< T >> const &A)Definition: ordinary_least_squares_regressor.cpp:289 +get_transposestd::vector< std::vector< T > > get_transpose(std::vector< std::vector< T >> const &A)Definition: ordinary_least_squares_regressor.cpp:291 diff --git a/dc/d38/ordinary__least__squares__regressor_8cpp.html b/dc/d38/ordinary__least__squares__regressor_8cpp.html index 7104acbb7..0c82d8614 100644 --- a/dc/d38/ordinary__least__squares__regressor_8cpp.html +++ b/dc/d38/ordinary__least__squares__regressor_8cpp.html @@ -99,13 +99,15 @@ $(document).ready(function(){initNavTree('dc/d38/ordinary__least__squares__regre Linear regression example using Ordinary least squares More... -#include <iomanip> +#include <cassert> +#include <cmath> +#include <iomanip> #include <iostream> #include <vector> Include dependency graph for ordinary_least_squares_regressor.cpp: -This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead. +This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead. @@ -153,6 +155,8 @@ Functions template<typename T > std::vector< float > predict_OLS_regressor (std::vector< std::vector< T >> const &X, std::vector< float > const &beta) +void test () + int main () @@ -199,24 +203,24 @@ template<typename T > Returnsfitted regression model polynomial coefficients - 311 { - 312 // NxF - 313 std::vector<std::vector<T>> X2 = X; - 314 for (size_t i = 0; i < X2.size(); i++) - 315 // add Y-intercept -> Nx(F+1) - 316 X2[i].push_back(1); - 317 // (F+1)xN - 318 std::vector<std::vector<T>> Xt = get_transpose(X2); - 319 // (F+1)x(F+1) - 320 std::vector<std::vector<T>> tmp = get_inverse(Xt * X2); - 321 // (F+1)xN - 322 std::vector<std::vector<float>> out = tmp * Xt; - 323 // cout << endl - 324 // << "Projection matrix: " << X2 * out << endl; - 325 - 326 // Fx1,1 -> (F+1)^th element is the independent constant - 327 return out * Y; - 328 } + 313 { + 314 // NxF + 315 std::vector<std::vector<T>> X2 = X; + 316 for (size_t i = 0; i < X2.size(); i++) + 317 // add Y-intercept -> Nx(F+1) + 318 X2[i].push_back(1); + 319 // (F+1)xN + 320 std::vector<std::vector<T>> Xt = get_transpose(X2); + 321 // (F+1)x(F+1) + 322 std::vector<std::vector<T>> tmp = get_inverse(Xt * X2); + 323 // (F+1)xN + 324 std::vector<std::vector<float>> out = tmp * Xt; + 325 // cout << endl + 326 // << "Projection matrix: " << X2 * out << endl; + 327 + 328 // Fx1,1 -> (F+1)^th element is the independent constant + 329 return out * Y; + 330 } Here is the call graph for this function: @@ -244,70 +248,70 @@ template<typename T > Get matrix inverse using Row-trasnformations. Given matrix must be a square and non-singular. Returnsinverse matrix - 219 { - 220 // Assuming A is square matrix - 221 size_t N = A.size(); - 222 - 223 std::vector<std::vector<float>> inverse(N); - 224 for (size_t row = 0; row < N; row++) { - 225 // preallocatae a resultant identity matrix - 226 inverse[row] = std::vector<float>(N); - 227 for (size_t col = 0; col < N; col++) - 228 inverse[row][col] = (row == col) ? 1.f : 0.f; - 229 } - 230 - 231 if (!is_square(A)) { - 232 std::cerr << "A must be a square matrix!" << std::endl; - 233 return inverse; - 234 } - 235 - 236 // preallocatae a temporary matrix identical to A - 237 std::vector<std::vector<float>> temp(N); - 238 for (size_t row = 0; row < N; row++) { - 239 std::vector<float> v(N); - 240 for (size_t col = 0; col < N; col++) - 241 v[col] = static_cast<float>(A[row][col]); - 242 temp[row] = v; - 243 } - 244 - 245 // start transformations - 246 for (size_t row = 0; row < N; row++) { - 247 for (size_t row2 = row; row2 < N && temp[row][row] == 0; row2++) { - 248 // this to ensure diagonal elements are not 0 - 249 temp[row] = temp[row] + temp[row2]; - 250 inverse[row] = inverse[row] + inverse[row2]; - 251 } - 252 - 253 for (size_t col2 = row; col2 < N && temp[row][row] == 0; col2++) { - 254 // this to further ensure diagonal elements are not 0 - 255 for (size_t row2 = 0; row2 < N; row2++) { - 256 temp[row2][row] = temp[row2][row] + temp[row2][col2]; - 257 inverse[row2][row] = inverse[row2][row] + inverse[row2][col2]; - 258 } - 259 } - 260 - 261 if (temp[row][row] == 0) { - 262 // Probably a low-rank matrix and hence singular - 263 std::cerr << "Low-rank matrix, no inverse!" << std::endl; - 264 return inverse; - 265 } - 266 - 267 // set diagonal to 1 - 268 float divisor = static_cast<float>(temp[row][row]); - 269 temp[row] = temp[row] / divisor; - 270 inverse[row] = inverse[row] / divisor; - 271 // Row transformations - 272 for (size_t row2 = 0; row2 < N; row2++) { - 273 if (row2 == row) - 274 continue; - 275 float factor = temp[row2][row]; - 276 temp[row2] = temp[row2] - factor * temp[row]; - 277 inverse[row2] = inverse[row2] - factor * inverse[row]; - 278 } - 279 } - 280 - 281 return inverse; - 282 } + 221 { + 222 // Assuming A is square matrix + 223 size_t N = A.size(); + 224 + 225 std::vector<std::vector<float>> inverse(N); + 226 for (size_t row = 0; row < N; row++) { + 227 // preallocatae a resultant identity matrix + 228 inverse[row] = std::vector<float>(N); + 229 for (size_t col = 0; col < N; col++) + 230 inverse[row][col] = (row == col) ? 1.f : 0.f; + 231 } + 232 + 233 if (!is_square(A)) { + 234 std::cerr << "A must be a square matrix!" << std::endl; + 235 return inverse; + 236 } + 237 + 238 // preallocatae a temporary matrix identical to A + 239 std::vector<std::vector<float>> temp(N); + 240 for (size_t row = 0; row < N; row++) { + 241 std::vector<float> v(N); + 242 for (size_t col = 0; col < N; col++) + 243 v[col] = static_cast<float>(A[row][col]); + 244 temp[row] = v; + 245 } + 246 + 247 // start transformations + 248 for (size_t row = 0; row < N; row++) { + 249 for (size_t row2 = row; row2 < N && temp[row][row] == 0; row2++) { + 250 // this to ensure diagonal elements are not 0 + 251 temp[row] = temp[row] + temp[row2]; + 252 inverse[row] = inverse[row] + inverse[row2]; + 253 } + 254 + 255 for (size_t col2 = row; col2 < N && temp[row][row] == 0; col2++) { + 256 // this to further ensure diagonal elements are not 0 + 257 for (size_t row2 = 0; row2 < N; row2++) { + 258 temp[row2][row] = temp[row2][row] + temp[row2][col2]; + 259 inverse[row2][row] = inverse[row2][row] + inverse[row2][col2]; + 260 } + 261 } + 262 + 263 if (temp[row][row] == 0) { + 264 // Probably a low-rank matrix and hence singular + 265 std::cerr << "Low-rank matrix, no inverse!" << std::endl; + 266 return inverse; + 267 } + 268 + 269 // set diagonal to 1 + 270 float divisor = static_cast<float>(temp[row][row]); + 271 temp[row] = temp[row] / divisor; + 272 inverse[row] = inverse[row] / divisor; + 273 // Row transformations + 274 for (size_t row2 = 0; row2 < N; row2++) { + 275 if (row2 == row) + 276 continue; + 277 float factor = temp[row2][row]; + 278 temp[row2] = temp[row2] - factor * temp[row]; + 279 inverse[row2] = inverse[row2] - factor * inverse[row]; + 280 } + 281 } + 282 + 283 return inverse; + 284 } Here is the call graph for this function: @@ -335,17 +339,17 @@ template<typename T > matrix transpose Returnsresultant matrix - 290 { - 291 std::vector<std::vector<T>> result(A[0].size()); - 292 - 293 for (size_t row = 0; row < A[0].size(); row++) { - 294 std::vector<T> v(A.size()); - 295 for (size_t col = 0; col < A.size(); col++) v[col] = A[col][row]; - 296 - 297 result[row] = v; - 298 } - 299 return result; - 300 } + 292 { + 293 std::vector<std::vector<T>> result(A[0].size()); + 294 + 295 for (size_t row = 0; row < A[0].size(); row++) { + 296 std::vector<T> v(A.size()); + 297 for (size_t col = 0; col < A.size(); col++) v[col] = A[col][row]; + 298 + 299 result[row] = v; + 300 } + 301 return result; + 302 } @@ -375,14 +379,14 @@ template<typename T > function to check if given matrix is a square matrix Returns1 if true, 0 if false - 55 { - 56 // Assuming A is square matrix - 57 size_t N = A.size(); - 58 for (size_t i = 0; i < N; i++) - 59 if (A[i].size() != N) - 60 return false; - 61 return true; - 62 } + 57 { + 58 // Assuming A is square matrix + 59 size_t N = A.size(); + 60 for (size_t i = 0; i < N; i++) + 61 if (A[i].size() != N) + 62 return false; + 63 return true; + 64 } @@ -401,60 +405,62 @@ template<typename T > main function - 358 { - 359 size_t N, F; - 360 - 361 std::cout << "Enter number of features: "; - 362 // number of features = columns - 363 std::cin >> F; - 364 std::cout << "Enter number of samples: "; - 365 // number of samples = rows - 366 std::cin >> N; - 367 - 368 std::vector<std::vector<float>> data(N); - 369 std::vector<float> Y(N); - 370 - 371 std::cout - 372 << "Enter training data. Per sample, provide features ad one output." - 373 << std::endl; - 374 - 375 for (size_t rows = 0; rows < N; rows++) { - 376 std::vector<float> v(F); - 377 std::cout << "Sample# " << rows + 1 << ": "; - 378 for (size_t cols = 0; cols < F; cols++) - 379 // get the F features - 380 std::cin >> v[cols]; - 381 data[rows] = v; - 382 // get the corresponding output - 383 std::cin >> Y[rows]; - 384 } - 385 - 386 std::vector<float> beta = fit_OLS_regressor(data, Y); - 387 std::cout << std::endl << std::endl << "beta:" << beta << std::endl; - 388 - 389 size_t T; - 390 std::cout << "Enter number of test samples: "; - 391 // number of test sample inputs - 392 std::cin >> T; - 393 std::vector<std::vector<float>> data2(T); - 394 // vector<float> Y2(T); - 395 - 396 for (size_t rows = 0; rows < T; rows++) { - 397 std::cout << "Sample# " << rows + 1 << ": "; - 398 std::vector<float> v(F); - 399 for (size_t cols = 0; cols < F; cols++) std::cin >> v[cols]; - 400 data2[rows] = v; - 401 } - 402 - 403 std::vector<float> out = predict_OLS_regressor(data2, beta); - 404 for (size_t rows = 0; rows < T; rows++) std::cout << out[rows] << std::endl; - 405 - 406 return 0; - 407 } + 410 { + 411 test(); + 412 + 413 size_t N, F; + 414 + 415 std::cout << "Enter number of features: "; + 416 // number of features = columns + 417 std::cin >> F; + 418 std::cout << "Enter number of samples: "; + 419 // number of samples = rows + 420 std::cin >> N; + 421 + 422 std::vector<std::vector<float>> data(N); + 423 std::vector<float> Y(N); + 424 + 425 std::cout + 426 << "Enter training data. Per sample, provide features and one output." + 427 << std::endl; + 428 + 429 for (size_t rows = 0; rows < N; rows++) { + 430 std::vector<float> v(F); + 431 std::cout << "Sample# " << rows + 1 << ": "; + 432 for (size_t cols = 0; cols < F; cols++) + 433 // get the F features + 434 std::cin >> v[cols]; + 435 data[rows] = v; + 436 // get the corresponding output + 437 std::cin >> Y[rows]; + 438 } + 439 + 440 std::vector<float> beta = fit_OLS_regressor(data, Y); + 441 std::cout << std::endl << std::endl << "beta:" << beta << std::endl; + 442 + 443 size_t T; + 444 std::cout << "Enter number of test samples: "; + 445 // number of test sample inputs + 446 std::cin >> T; + 447 std::vector<std::vector<float>> data2(T); + 448 // vector<float> Y2(T); + 449 + 450 for (size_t rows = 0; rows < T; rows++) { + 451 std::cout << "Sample# " << rows + 1 << ": "; + 452 std::vector<float> v(F); + 453 for (size_t cols = 0; cols < F; cols++) std::cin >> v[cols]; + 454 data2[rows] = v; + 455 } + 456 + 457 std::vector<float> out = predict_OLS_regressor(data2, beta); + 458 for (size_t rows = 0; rows < T; rows++) std::cout << out[rows] << std::endl; + 459 + 460 return 0; + 461 } Here is the call graph for this function: -This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead. +This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead. @@ -488,18 +494,18 @@ template<typename T > pre-multiplication of a vector by a scalar Returnsresultant vector - 131 { - 132 // Number of rows in A - 133 size_t N_A = A.size(); - 134 - 135 std::vector<float> result(N_A); + 133 { + 134 // Number of rows in A + 135 size_t N_A = A.size(); 136 - 137 for (size_t row = 0; row < N_A; row++) { - 138 result[row] += A[row] * static_cast<float>(scalar); - 139 } - 140 - 141 return result; - 142 } + 137 std::vector<float> result(N_A); + 138 + 139 for (size_t row = 0; row < N_A; row++) { + 140 result[row] += A[row] * static_cast<float>(scalar); + 141 } + 142 + 143 return result; + 144 } Here is the call graph for this function: @@ -538,32 +544,32 @@ template<typename T > Matrix multiplication such that if A is size (mxn) and B is of size (pxq) then the multiplication is defined only when n = p and the resultant matrix is of size (mxq) Returnsresultant matrix - 73 { - 74 // Number of rows in A - 75 size_t N_A = A.size(); - 76 // Number of columns in B - 77 size_t N_B = B[0].size(); - 78 - 79 std::vector<std::vector<T>> result(N_A); + 75 { + 76 // Number of rows in A + 77 size_t N_A = A.size(); + 78 // Number of columns in B + 79 size_t N_B = B[0].size(); 80 - 81 if (A[0].size() != B.size()) { - 82 std::cerr << "Number of columns in A != Number of rows in B (" - 83 << A[0].size() << ", " << B.size() << ")" << std::endl; - 84 return result; - 85 } - 86 - 87 for (size_t row = 0; row < N_A; row++) { - 88 std::vector<T> v(N_B); - 89 for (size_t col = 0; col < N_B; col++) { - 90 v[col] = static_cast<T>(0); - 91 for (size_t j = 0; j < B.size(); j++) - 92 v[col] += A[row][j] * B[j][col]; - 93 } - 94 result[row] = v; - 95 } - 96 - 97 return result; - 98 } + 81 std::vector<std::vector<T>> result(N_A); + 82 + 83 if (A[0].size() != B.size()) { + 84 std::cerr << "Number of columns in A != Number of rows in B (" + 85 << A[0].size() << ", " << B.size() << ")" << std::endl; + 86 return result; + 87 } + 88 + 89 for (size_t row = 0; row < N_A; row++) { + 90 std::vector<T> v(N_B); + 91 for (size_t col = 0; col < N_B; col++) { + 92 v[col] = static_cast<T>(0); + 93 for (size_t j = 0; j < B.size(); j++) + 94 v[col] += A[row][j] * B[j][col]; + 95 } + 96 result[row] = v; + 97 } + 98 + 99 return result; + 100 } Here is the call graph for this function: @@ -601,25 +607,25 @@ template<typename T > multiplication of a matrix with a column vector Returnsresultant vector - 106 { - 107 // Number of rows in A - 108 size_t N_A = A.size(); - 109 - 110 std::vector<T> result(N_A); + 108 { + 109 // Number of rows in A + 110 size_t N_A = A.size(); 111 - 112 if (A[0].size() != B.size()) { - 113 std::cerr << "Number of columns in A != Number of rows in B (" - 114 << A[0].size() << ", " << B.size() << ")" << std::endl; - 115 return result; - 116 } - 117 - 118 for (size_t row = 0; row < N_A; row++) { - 119 result[row] = static_cast<T>(0); - 120 for (size_t j = 0; j < B.size(); j++) result[row] += A[row][j] * B[j]; - 121 } - 122 - 123 return result; - 124 } + 112 std::vector<T> result(N_A); + 113 + 114 if (A[0].size() != B.size()) { + 115 std::cerr << "Number of columns in A != Number of rows in B (" + 116 << A[0].size() << ", " << B.size() << ")" << std::endl; + 117 return result; + 118 } + 119 + 120 for (size_t row = 0; row < N_A; row++) { + 121 result[row] = static_cast<T>(0); + 122 for (size_t j = 0; j < B.size(); j++) result[row] += A[row][j] * B[j]; + 123 } + 124 + 125 return result; + 126 } Here is the call graph for this function: @@ -657,17 +663,17 @@ template<typename T > post-multiplication of a vector by a scalar Returnsresultant vector - 149 { - 150 // Number of rows in A - 151 size_t N_A = A.size(); - 152 - 153 std::vector<float> result(N_A); + 151 { + 152 // Number of rows in A + 153 size_t N_A = A.size(); 154 - 155 for (size_t row = 0; row < N_A; row++) - 156 result[row] = A[row] * static_cast<float>(scalar); - 157 - 158 return result; - 159 } + 155 std::vector<float> result(N_A); + 156 + 157 for (size_t row = 0; row < N_A; row++) + 158 result[row] = A[row] * static_cast<float>(scalar); + 159 + 160 return result; + 161 } Here is the call graph for this function: @@ -705,21 +711,21 @@ template<typename T > addition of two vectors of identical lengths Returnsresultant vector - 196 { - 197 // Number of rows in A - 198 size_t N = A.size(); - 199 - 200 std::vector<T> result(N); + 198 { + 199 // Number of rows in A + 200 size_t N = A.size(); 201 - 202 if (B.size() != N) { - 203 std::cerr << "Vector dimensions shouldbe identical!" << std::endl; - 204 return A; - 205 } - 206 - 207 for (size_t row = 0; row < N; row++) result[row] = A[row] + B[row]; + 202 std::vector<T> result(N); + 203 + 204 if (B.size() != N) { + 205 std::cerr << "Vector dimensions shouldbe identical!" << std::endl; + 206 return A; + 207 } 208 - 209 return result; - 210 } + 209 for (size_t row = 0; row < N; row++) result[row] = A[row] + B[row]; + 210 + 211 return result; + 212 } Here is the call graph for this function: @@ -757,21 +763,21 @@ template<typename T > subtraction of two vectors of identical lengths Returnsresultant vector - 175 { - 176 // Number of rows in A - 177 size_t N = A.size(); - 178 - 179 std::vector<T> result(N); + 177 { + 178 // Number of rows in A + 179 size_t N = A.size(); 180 - 181 if (B.size() != N) { - 182 std::cerr << "Vector dimensions shouldbe identical!" << std::endl; - 183 return A; - 184 } - 185 - 186 for (size_t row = 0; row < N; row++) result[row] = A[row] - B[row]; + 181 std::vector<T> result(N); + 182 + 183 if (B.size() != N) { + 184 std::cerr << "Vector dimensions shouldbe identical!" << std::endl; + 185 return A; + 186 } 187 - 188 return result; - 189 } + 188 for (size_t row = 0; row < N; row++) result[row] = A[row] - B[row]; + 189 + 190 return result; + 191 } Here is the call graph for this function: @@ -809,9 +815,9 @@ template<typename T > division of a vector by a scalar Returnsresultant vector - 166 { - 167 return (1.f / scalar) * A; - 168 } + 168 { + 169 return (1.f / scalar) * A; + 170 } @@ -843,19 +849,19 @@ template<typename T > operator to print a matrix - 21 { - 22 const int width = 10; - 23 const char separator = ' '; - 24 - 25 for (size_t row = 0; row < v.size(); row++) { - 26 for (size_t col = 0; col < v[row].size(); col++) - 27 out << std::left << std::setw(width) << std::setfill(separator) - 28 << v[row][col]; - 29 out << std::endl; - 30 } - 31 - 32 return out; - 33 } + 23 { + 24 const int width = 10; + 25 const char separator = ' '; + 26 + 27 for (size_t row = 0; row < v.size(); row++) { + 28 for (size_t col = 0; col < v[row].size(); col++) + 29 out << std::left << std::setw(width) << std::setfill(separator) + 30 << v[row][col]; + 31 out << std::endl; + 32 } + 33 + 34 return out; + 35 } Here is the call graph for this function: @@ -893,16 +899,16 @@ template<typename T > operator to print a vector - 39 { - 40 const int width = 15; - 41 const char separator = ' '; - 42 - 43 for (size_t row = 0; row < v.size(); row++) - 44 out << std::left << std::setw(width) << std::setfill(separator) - 45 << v[row]; - 46 - 47 return out; - 48 } + 41 { + 42 const int width = 15; + 43 const char separator = ' '; + 44 + 45 for (size_t row = 0; row < v.size(); row++) + 46 out << std::left << std::setw(width) << std::setfill(separator) + 47 << v[row]; + 48 + 49 return out; + 50 } Here is the call graph for this function: @@ -950,19 +956,91 @@ template<typename T > Returnsvector with regression values for each sample - 342 { - 343 std::vector<float> result(X.size()); - 344 - 345 for (size_t rows = 0; rows < X.size(); rows++) { - 346 // -> start with constant term - 347 result[rows] = beta[X[0].size()]; - 348 for (size_t cols = 0; cols < X[0].size(); cols++) - 349 result[rows] += beta[cols] * X[rows][cols]; - 350 } - 351 // Nx1 - 352 return result; - 353 } + 344 { + 345 std::vector<float> result(X.size()); + 346 + 347 for (size_t rows = 0; rows < X.size(); rows++) { + 348 // -> start with constant term + 349 result[rows] = beta[X[0].size()]; + 350 for (size_t cols = 0; cols < X[0].size(); cols++) + 351 result[rows] += beta[cols] * X[rows][cols]; + 352 } + 353 // Nx1 + 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 + 364 std::vector<std::vector<float>> data1( + 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>> test1( + 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(test1, 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 + 385 std::vector<std::vector<float>> data2( + 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>> test2( + 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(test2, 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: + +This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead. + + + @@ -970,17 +1048,20 @@ template<typename T > std::vectorSTL class. std::vector::sizeT size(T... args) std::setfillT setfill(T... args) -is_squarebool is_square(std::vector< std::vector< T >> const &A)Definition: ordinary_least_squares_regressor.cpp:55 +is_squarebool is_square(std::vector< std::vector< T >> const &A)Definition: ordinary_least_squares_regressor.cpp:57 +testvoid test()Definition: ordinary_least_squares_regressor.cpp:358 +test1void test1(double eta=0.01)Definition: adaline_learning.cpp:204 std::cerr -predict_OLS_regressorstd::vector< float > predict_OLS_regressor(std::vector< std::vector< T >> const &X, std::vector< float > const &beta)Definition: ordinary_least_squares_regressor.cpp:340 +predict_OLS_regressorstd::vector< float > predict_OLS_regressor(std::vector< std::vector< T >> const &X, std::vector< float > const &beta)Definition: ordinary_least_squares_regressor.cpp:342 dataint data[MAX]test dataDefinition: hash_search.cpp:24 -fit_OLS_regressorstd::vector< float > fit_OLS_regressor(std::vector< std::vector< T >> const &X, std::vector< T > const &Y)Definition: ordinary_least_squares_regressor.cpp:310 +fit_OLS_regressorstd::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::endlT endl(T... args) -get_inversestd::vector< std::vector< float > > get_inverse(std::vector< std::vector< T >> const &A)Definition: ordinary_least_squares_regressor.cpp:218 +get_inversestd::vector< std::vector< float > > get_inverse(std::vector< std::vector< T >> const &A)Definition: ordinary_least_squares_regressor.cpp:220 std::leftT left(T... args) std::setwT setw(T... args) std::cin -get_transposestd::vector< std::vector< T > > get_transpose(std::vector< std::vector< T >> const &A)Definition: ordinary_least_squares_regressor.cpp:289 +test2void test2(double eta=0.01)Definition: adaline_learning.cpp:238 +get_transposestd::vector< std::vector< T > > get_transpose(std::vector< std::vector< T >> const &A)Definition: ordinary_least_squares_regressor.cpp:291 diff --git a/dc/d38/ordinary__least__squares__regressor_8cpp.js b/dc/d38/ordinary__least__squares__regressor_8cpp.js index bc815530d..107de6098 100644 --- a/dc/d38/ordinary__least__squares__regressor_8cpp.js +++ b/dc/d38/ordinary__least__squares__regressor_8cpp.js @@ -14,5 +14,6 @@ var ordinary__least__squares__regressor_8cpp = [ "operator/", "dc/d38/ordinary__least__squares__regressor_8cpp.html#a30acf52af3184bc22274234ef5a73536", null ], [ "operator<<", "dc/d38/ordinary__least__squares__regressor_8cpp.html#a98eb5807f21b783c341cab402ced6732", null ], [ "operator<<", "dc/d38/ordinary__least__squares__regressor_8cpp.html#aa799b4cec1681219887d89d037cfab50", null ], - [ "predict_OLS_regressor", "dc/d38/ordinary__least__squares__regressor_8cpp.html#a4bcaaf41c66da4d3a471dacef133def7", null ] + [ "predict_OLS_regressor", "dc/d38/ordinary__least__squares__regressor_8cpp.html#a4bcaaf41c66da4d3a471dacef133def7", null ], + [ "test", "dc/d38/ordinary__least__squares__regressor_8cpp.html#ae1a3968e7947464bee7714f6d43b7002", null ] ]; \ No newline at end of file diff --git a/dc/d38/ordinary__least__squares__regressor_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.map b/dc/d38/ordinary__least__squares__regressor_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.map new file mode 100644 index 000000000..82c34b406 --- /dev/null +++ b/dc/d38/ordinary__least__squares__regressor_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.map @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/dc/d38/ordinary__least__squares__regressor_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.md5 b/dc/d38/ordinary__least__squares__regressor_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.md5 new file mode 100644 index 000000000..48129d7e4 --- /dev/null +++ b/dc/d38/ordinary__least__squares__regressor_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.md5 @@ -0,0 +1 @@ +f516f3d9b3c83458e76475e3672f4836 \ No newline at end of file diff --git a/dc/d38/ordinary__least__squares__regressor_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.svg b/dc/d38/ordinary__least__squares__regressor_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.svg new file mode 100644 index 000000000..3bf29fd25 --- /dev/null +++ b/dc/d38/ordinary__least__squares__regressor_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.svg @@ -0,0 +1,433 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +test + + + +Node1 + + +test + + + + + +Node2 + + +std::endl + + + + + +Node1->Node2 + + + + + +Node3 + + +fit_OLS_regressor + + + + + +Node1->Node3 + + + + + +Node7 + + +std::vector::size + + + + + +Node1->Node7 + + + + + +Node8 + + +predict_OLS_regressor + + + + + +Node1->Node8 + + + + + +Node9 + + +test1 + + + + + +Node1->Node9 + + + + + +Node17 + + +test2 + + + + + +Node1->Node17 + + + + + +Node4 + + +get_inverse + + + + + +Node3->Node4 + + + + + +Node6 + + +get_transpose + + + + + +Node3->Node6 + + + + + +Node3->Node7 + + + + + +Node4->Node2 + + + + + +Node5 + + +is_square + + + + + +Node4->Node5 + + + + + +Node9->Node2 + + + + + +Node10 + + +machine_learning::adaline::fit + + + + + +Node9->Node10 + + + + + +Node12 + + +machine_learning::adaline +::predict + + + + + +Node9->Node12 + + + + + +Node10->Node7 + + + + + +Node11 + + +machine_learning::adaline +::check_size_match + + + + + +Node10->Node11 + + + + + +Node10->Node12 + + + + + +Node11->Node2 + + + + + +Node11->Node7 + + + + + +Node12->Node11 + + + + + +Node13 + + +std::vector::back + + + + + +Node12->Node13 + + + + + +Node14 + + +std::vector::begin + + + + + +Node12->Node14 + + + + + +Node15 + + +std::vector::end + + + + + +Node12->Node15 + + + + + +Node16 + + +std::inner_product + + + + + +Node12->Node16 + + + + + +Node17->Node2 + + + + + +Node17->Node10 + + + + + +Node17->Node12 + + + + + +Node18 + + +std::rand + + + + + +Node17->Node18 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dc/d38/ordinary__least__squares__regressor_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph_org.svg b/dc/d38/ordinary__least__squares__regressor_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph_org.svg new file mode 100644 index 000000000..e1060f9c6 --- /dev/null +++ b/dc/d38/ordinary__least__squares__regressor_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph_org.svg @@ -0,0 +1,345 @@ + + + + + + +test + + + +Node1 + + +test + + + + + +Node2 + + +std::endl + + + + + +Node1->Node2 + + + + + +Node3 + + +fit_OLS_regressor + + + + + +Node1->Node3 + + + + + +Node7 + + +std::vector::size + + + + + +Node1->Node7 + + + + + +Node8 + + +predict_OLS_regressor + + + + + +Node1->Node8 + + + + + +Node9 + + +test1 + + + + + +Node1->Node9 + + + + + +Node17 + + +test2 + + + + + +Node1->Node17 + + + + + +Node4 + + +get_inverse + + + + + +Node3->Node4 + + + + + +Node6 + + +get_transpose + + + + + +Node3->Node6 + + + + + +Node3->Node7 + + + + + +Node4->Node2 + + + + + +Node5 + + +is_square + + + + + +Node4->Node5 + + + + + +Node9->Node2 + + + + + +Node10 + + +machine_learning::adaline::fit + + + + + +Node9->Node10 + + + + + +Node12 + + +machine_learning::adaline +::predict + + + + + +Node9->Node12 + + + + + +Node10->Node7 + + + + + +Node11 + + +machine_learning::adaline +::check_size_match + + + + + +Node10->Node11 + + + + + +Node10->Node12 + + + + + +Node11->Node2 + + + + + +Node11->Node7 + + + + + +Node12->Node11 + + + + + +Node13 + + +std::vector::back + + + + + +Node12->Node13 + + + + + +Node14 + + +std::vector::begin + + + + + +Node12->Node14 + + + + + +Node15 + + +std::vector::end + + + + + +Node12->Node15 + + + + + +Node16 + + +std::inner_product + + + + + +Node12->Node16 + + + + + +Node17->Node2 + + + + + +Node17->Node10 + + + + + +Node17->Node12 + + + + + +Node18 + + +std::rand + + + + + +Node17->Node18 + + + + + diff --git a/dc/d38/ordinary__least__squares__regressor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map b/dc/d38/ordinary__least__squares__regressor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map index e4376148b..d6b93d4ab 100644 --- a/dc/d38/ordinary__least__squares__regressor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map +++ b/dc/d38/ordinary__least__squares__regressor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map @@ -1,10 +1,21 @@ - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/dc/d38/ordinary__least__squares__regressor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 b/dc/d38/ordinary__least__squares__regressor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 index c6d6ed277..50929d9f6 100644 --- a/dc/d38/ordinary__least__squares__regressor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 +++ b/dc/d38/ordinary__least__squares__regressor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 @@ -1 +1 @@ -3be803d1be527cedbaf861f9e381bfd1 \ No newline at end of file +456aff2915e1427888608ce5ceb90cf3 \ No newline at end of file diff --git a/dc/d38/ordinary__least__squares__regressor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg b/dc/d38/ordinary__least__squares__regressor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg index c55679f00..1cb923b97 100644 --- a/dc/d38/ordinary__least__squares__regressor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg +++ b/dc/d38/ordinary__least__squares__regressor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg @@ -4,17 +4,63 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + main - + Node1 - -main + +main @@ -22,112 +68,399 @@ Node2 - -std::endl + +std::endl Node1->Node2 - - + + Node3 - -fit_OLS_regressor + +fit_OLS_regressor Node1->Node3 - - + + Node8 - -predict_OLS_regressor + +predict_OLS_regressor Node1->Node8 - - + + + + + +Node9 + + +test + + + + + +Node1->Node9 + + Node4 - -get_inverse + +get_inverse Node3->Node4 - - + + Node6 - -get_transpose + +get_transpose Node3->Node6 - - + + Node7 - -std::vector::size + +std::vector::size Node3->Node7 - - + + Node4->Node2 - - + + Node5 - -is_square + +is_square Node4->Node5 - - + + + + + +Node9->Node2 + + + + + +Node9->Node3 + + + + + +Node9->Node7 + + + + + +Node9->Node8 + + + + + +Node10 + + +test1 + + + + + +Node9->Node10 + + + + + +Node18 + + +test2 + + + + + +Node9->Node18 + + + + + +Node10->Node2 + + + + + +Node11 + + +machine_learning::adaline::fit + + + + + +Node10->Node11 + + + + + +Node13 + + +machine_learning::adaline +::predict + + + + + +Node10->Node13 + + + + + +Node11->Node7 + + + + + +Node12 + + +machine_learning::adaline +::check_size_match + + + + + +Node11->Node12 + + + + + +Node11->Node13 + + + + + +Node12->Node2 + + + + + +Node12->Node7 + + + + + +Node13->Node12 + + + + + +Node14 + + +std::vector::back + + + + + +Node13->Node14 + + + + + +Node15 + + +std::vector::begin + + + + + +Node13->Node15 + + + + + +Node16 + + +std::vector::end + + + + + +Node13->Node16 + + + + + +Node17 + + +std::inner_product + + + + + +Node13->Node17 + + + + + +Node18->Node2 + + + + + +Node18->Node11 + + + + + +Node18->Node13 + + + + + +Node19 + + +std::rand + + + + + +Node18->Node19 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dc/d38/ordinary__least__squares__regressor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg b/dc/d38/ordinary__least__squares__regressor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg new file mode 100644 index 000000000..bc906d38b --- /dev/null +++ b/dc/d38/ordinary__least__squares__regressor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg @@ -0,0 +1,378 @@ + + + + + + +main + + + +Node1 + + +main + + + + + +Node2 + + +std::endl + + + + + +Node1->Node2 + + + + + +Node3 + + +fit_OLS_regressor + + + + + +Node1->Node3 + + + + + +Node8 + + +predict_OLS_regressor + + + + + +Node1->Node8 + + + + + +Node9 + + +test + + + + + +Node1->Node9 + + + + + +Node4 + + +get_inverse + + + + + +Node3->Node4 + + + + + +Node6 + + +get_transpose + + + + + +Node3->Node6 + + + + + +Node7 + + +std::vector::size + + + + + +Node3->Node7 + + + + + +Node4->Node2 + + + + + +Node5 + + +is_square + + + + + +Node4->Node5 + + + + + +Node9->Node2 + + + + + +Node9->Node3 + + + + + +Node9->Node7 + + + + + +Node9->Node8 + + + + + +Node10 + + +test1 + + + + + +Node9->Node10 + + + + + +Node18 + + +test2 + + + + + +Node9->Node18 + + + + + +Node10->Node2 + + + + + +Node11 + + +machine_learning::adaline::fit + + + + + +Node10->Node11 + + + + + +Node13 + + +machine_learning::adaline +::predict + + + + + +Node10->Node13 + + + + + +Node11->Node7 + + + + + +Node12 + + +machine_learning::adaline +::check_size_match + + + + + +Node11->Node12 + + + + + +Node11->Node13 + + + + + +Node12->Node2 + + + + + +Node12->Node7 + + + + + +Node13->Node12 + + + + + +Node14 + + +std::vector::back + + + + + +Node13->Node14 + + + + + +Node15 + + +std::vector::begin + + + + + +Node13->Node15 + + + + + +Node16 + + +std::vector::end + + + + + +Node13->Node16 + + + + + +Node17 + + +std::inner_product + + + + + +Node13->Node17 + + + + + +Node18->Node2 + + + + + +Node18->Node11 + + + + + +Node18->Node13 + + + + + +Node19 + + +std::rand + + + + + +Node18->Node19 + + + + + diff --git a/globals_func_t.html b/globals_func_t.html index b14566ce5..70b3ae585 100644 --- a/globals_func_t.html +++ b/globals_func_t.html @@ -99,14 +99,16 @@ $(document).ready(function(){initNavTree('globals_func_t.html',''); initResizabl test() : armstrong_number.cpp , double_factorial.cpp +, heap_sort.cpp , sum_of_digits.cpp , check_amicable_pair.cpp +, ordinary_least_squares_regressor.cpp , smallest_circle.cpp -, heap_sort.cpp test1() -: adaline_learning.cpp +: golden_search_extrema.cpp , lu_decompose.cpp +, adaline_learning.cpp , qr_eigen_values.cpp , kohonen_som_topology.cpp , kohonen_som_trace.cpp @@ -114,7 +116,6 @@ $(document).ready(function(){initNavTree('globals_func_t.html',''); initResizabl , sum_of_digits.cpp , brent_method_extrema.cpp , durand_kerner_roots.cpp -, golden_search_extrema.cpp test2() : adaline_learning.cpp @@ -134,8 +135,8 @@ $(document).ready(function(){initNavTree('globals_func_t.html',''); initResizabl , brent_method_extrema.cpp , golden_search_extrema.cpp , smallest_circle.cpp -, adaline_learning.cpp , kohonen_som_topology.cpp +, adaline_learning.cpp test_2d_classes() : kohonen_som_topology.cpp @@ -165,11 +166,11 @@ $(document).ready(function(){initNavTree('globals_func_t.html',''); initResizabl : kohonen_som_trace.cpp tests() -: comb_sort.cpp -, double_factorial.cpp -, complex_numbers.cpp +: complex_numbers.cpp +, comb_sort.cpp , least_common_multiple.cpp , miller_rabin.cpp +, double_factorial.cpp TH() : tower_of_hanoi.cpp diff --git a/globals_t.html b/globals_t.html index 878149bde..c00503304 100644 --- a/globals_t.html +++ b/globals_t.html @@ -99,14 +99,16 @@ $(document).ready(function(){initNavTree('globals_t.html',''); initResizable(); test() : armstrong_number.cpp , double_factorial.cpp +, heap_sort.cpp , sum_of_digits.cpp , check_amicable_pair.cpp +, ordinary_least_squares_regressor.cpp , smallest_circle.cpp -, heap_sort.cpp test1() -: adaline_learning.cpp +: golden_search_extrema.cpp , lu_decompose.cpp +, adaline_learning.cpp , qr_eigen_values.cpp , kohonen_som_topology.cpp , kohonen_som_trace.cpp @@ -114,7 +116,6 @@ $(document).ready(function(){initNavTree('globals_t.html',''); initResizable(); , sum_of_digits.cpp , brent_method_extrema.cpp , durand_kerner_roots.cpp -, golden_search_extrema.cpp test2() : adaline_learning.cpp @@ -130,12 +131,12 @@ $(document).ready(function(){initNavTree('globals_t.html',''); initResizable(); , smallest_circle.cpp test3() -: brent_method_extrema.cpp +: kohonen_som_trace.cpp +, brent_method_extrema.cpp , golden_search_extrema.cpp , smallest_circle.cpp -, kohonen_som_trace.cpp -, adaline_learning.cpp , kohonen_som_topology.cpp +, adaline_learning.cpp test_2d_classes() : kohonen_som_topology.cpp @@ -168,11 +169,11 @@ $(document).ready(function(){initNavTree('globals_t.html',''); initResizable(); : brute_force_string_searching.cpp tests() -: complex_numbers.cpp -, double_factorial.cpp +: double_factorial.cpp +, complex_numbers.cpp , comb_sort.cpp -, least_common_multiple.cpp , miller_rabin.cpp +, least_common_multiple.cpp TH() : tower_of_hanoi.cpp diff --git a/navtreedata.js b/navtreedata.js index 8f8b2f5dc..187d47efa 100644 --- a/navtreedata.js +++ b/navtreedata.js @@ -103,7 +103,7 @@ var NAVTREEINDEX = "d5/d15/classcll.html#abb6fb5834563d077a4eaff1b7fdc5b44", "d8/dab/classstatistics_1_1stats__computer2.html#ae1bfd81bd7bbbd4b0d51d7d956e532d2", "db/da9/classqueue.html#ae2a7a36270f5d15218a180fa59e5b3a5", -"globals_func_t.html" +"globals_func_s.html" ]; var SYNCONMSG = 'click to disable panel synchronisation'; diff --git a/navtreeindex1.js b/navtreeindex1.js index d87177a61..51fcf4b39 100644 --- a/navtreeindex1.js +++ b/navtreeindex1.js @@ -15,8 +15,8 @@ var NAVTREEINDEX1 = "d5/d4c/group__sorting.html#ga29d28b140174dbdde7c9f5157758435f":[5,2,1], "d5/d4c/group__sorting.html#ga460c61cd948203b4816bef2accb3fc73":[5,2,3], "d5/d4c/group__sorting.html#ga460c61cd948203b4816bef2accb3fc73":[8,0,10,3,1], -"d5/d4c/group__sorting.html#gab6b14fea48d9841e29b9fc26be6e05d7":[5,2,4], "d5/d4c/group__sorting.html#gab6b14fea48d9841e29b9fc26be6e05d7":[8,0,10,3,2], +"d5/d4c/group__sorting.html#gab6b14fea48d9841e29b9fc26be6e05d7":[5,2,4], "d5/d4c/group__sorting.html#gabd9a93f241c5c86f2ec0abf8b66b4145":[8,0,10,2,0], "d5/d4c/group__sorting.html#gae66f6b31b5ad750f1fe042a706a4e3d4":[8,0,10,3,0], "d5/d4c/group__sorting.html#gae66f6b31b5ad750f1fe042a706a4e3d4":[5,2,2], diff --git a/navtreeindex2.js b/navtreeindex2.js index 2903d1734..0c6205360 100644 --- a/navtreeindex2.js +++ b/navtreeindex2.js @@ -68,8 +68,8 @@ var NAVTREEINDEX2 = "d9/d66/group__machine__learning.html#gab53c14440b2b2dd3172c66afc5c2f63f":[5,0,5], "d9/d66/group__machine__learning.html#gab53c14440b2b2dd3172c66afc5c2f63f":[8,0,3,1,4], "d9/d66/group__machine__learning.html#gacd517c6f195c75b9dd0f3aad65326f3b":[8,0,3,0,1], -"d9/d66/group__machine__learning.html#gaf5ce14f026d6d231bef29161bac2b485":[5,0,4], "d9/d66/group__machine__learning.html#gaf5ce14f026d6d231bef29161bac2b485":[8,0,3,2,1], +"d9/d66/group__machine__learning.html#gaf5ce14f026d6d231bef29161bac2b485":[5,0,4], "d9/d66/group__machine__learning.html#gaf5ce14f026d6d231bef29161bac2b485":[8,0,3,1,2], "d9/d69/median__search_8cpp.html":[8,0,9,7], "d9/d69/median__search_8cpp.html#a3a66390d0e407dce4fcbf63a169c6c8f":[8,0,9,7,1], diff --git a/navtreeindex3.js b/navtreeindex3.js index 940b177cb..2558dfac7 100644 --- a/navtreeindex3.js +++ b/navtreeindex3.js @@ -27,6 +27,7 @@ var NAVTREEINDEX3 = "dc/d38/ordinary__least__squares__regressor_8cpp.html#a9b2b5da35a6ba8ae203c33739ef0b91d":[8,0,5,12,5], "dc/d38/ordinary__least__squares__regressor_8cpp.html#aa799b4cec1681219887d89d037cfab50":[8,0,5,12,13], "dc/d38/ordinary__least__squares__regressor_8cpp.html#ab6171f4db68a5e50ae0f3500a63acd26":[8,0,5,12,6], +"dc/d38/ordinary__least__squares__regressor_8cpp.html#ae1a3968e7947464bee7714f6d43b7002":[8,0,5,12,15], "dc/d38/ordinary__least__squares__regressor_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4":[8,0,5,12,4], "dc/d38/ordinary__least__squares__regressor_8cpp.html#aecef32c2a4f39a3f7398949256d180a6":[8,0,5,12,8], "dc/d93/trie__modern_8cpp.html":[8,0,0,9], @@ -82,9 +83,9 @@ var NAVTREEINDEX3 = "dd/d2f/class_trie.html#afd8b79959009b554e98ea7128b2886f2":[7,0,34,3], "dd/d3b/struct_entry.html":[7,0,9], "dd/d3b/struct_entry.html#acef39096ad1bc616755a4c120a713cea":[7,0,9,3], -"dd/d3b/struct_entry.html#aeda5da9d6e79cb91d566e85af94fc372":[7,0,9,0], "dd/d3b/struct_entry.html#aeda5da9d6e79cb91d566e85af94fc372":[7,0,9,1], "dd/d3b/struct_entry.html#aeda5da9d6e79cb91d566e85af94fc372":[7,0,9,2], +"dd/d3b/struct_entry.html#aeda5da9d6e79cb91d566e85af94fc372":[7,0,9,0], "dd/d4f/class_solution.html":[7,0,29], "dd/d4f/class_solution.html#a0a92d4ba2a822ae87e4c8a7c321024c0":[7,0,29,7], "dd/d4f/class_solution.html#a29d19d87d54fe43d3f22221b8fe1b0bc":[7,0,29,0], @@ -222,8 +223,8 @@ var NAVTREEINDEX3 = "functions_func.html":[7,2,1], "functions_rela.html":[7,2,3], "functions_vars.html":[7,2,2], -"globals.html":[8,1,0], "globals.html":[8,1,0,0], +"globals.html":[8,1,0], "globals_a.html":[8,1,0,1], "globals_b.html":[8,1,0,2], "globals_c.html":[8,1,0,3], @@ -248,6 +249,5 @@ var NAVTREEINDEX3 = "globals_func_n.html":[8,1,1,13], "globals_func_o.html":[8,1,1,14], "globals_func_p.html":[8,1,1,15], -"globals_func_r.html":[8,1,1,16], -"globals_func_s.html":[8,1,1,17] +"globals_func_r.html":[8,1,1,16] }; diff --git a/navtreeindex4.js b/navtreeindex4.js index 6e069e771..a43820b81 100644 --- a/navtreeindex4.js +++ b/navtreeindex4.js @@ -1,5 +1,6 @@ var NAVTREEINDEX4 = { +"globals_func_s.html":[8,1,1,17], "globals_func_t.html":[8,1,1,18], "globals_func_u.html":[8,1,1,19], "globals_g.html":[8,1,0,7], @@ -17,8 +18,8 @@ var NAVTREEINDEX4 = "globals_type.html":[8,1,3], "globals_u.html":[8,1,0,19], "globals_vars.html":[8,1,2], -"index.html":[0], "index.html":[], +"index.html":[0], "index.html#autotoc_md33":[0], "index.html#autotoc_md34":[1], "modules.html":[5], diff --git a/search/all_14.js b/search/all_14.js index 270d88c7c..7b19c9ad3 100644 --- a/search/all_14.js +++ b/search/all_14.js @@ -13,7 +13,7 @@ var searchData= ['terminate_5fhandler_1537',['terminate_handler',['http://en.cppreference.com/w/cpp/error/terminate_handler.html',0,'std']]], ['ternary_5fsearch_1538',['ternary_search',['../dc/dfe/ternary__search_8cpp.html#aef655a27eb82efa299bf9d0becf6e9c8',1,'ternary_search.cpp']]], ['ternary_5fsearch_2ecpp_1539',['ternary_search.cpp',['../dc/dfe/ternary__search_8cpp.html',1,'']]], - ['test_1540',['test',['http://en.cppreference.com/w/cpp/utility/bitset/test.html',0,'std::bitset::test()'],['../db/d82/classlarge__number.html#a959c5c1a982949bbf98e1ea0f9afe6a9',1,'large_number::test()'],['../d4/d5d/math_2armstrong__number_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): armstrong_number.cpp'],['../d5/df6/check__amicable__pair_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): check_amicable_pair.cpp'],['../d7/d89/double__factorial_8cpp.html#abbbcebf3a2d0c67f4c3cfb5511a97981',1,'test(uint64_t n, uint64_t expected): double_factorial.cpp'],['../d4/d83/sum__of__digits_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): sum_of_digits.cpp'],['../d0/d01/smallest__circle_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): smallest_circle.cpp'],['../d2/d52/heap__sort_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): heap_sort.cpp']]], + ['test_1540',['test',['http://en.cppreference.com/w/cpp/utility/bitset/test.html',0,'std::bitset::test()'],['../db/d82/classlarge__number.html#a959c5c1a982949bbf98e1ea0f9afe6a9',1,'large_number::test()'],['../d4/d5d/math_2armstrong__number_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): armstrong_number.cpp'],['../d5/df6/check__amicable__pair_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): check_amicable_pair.cpp'],['../d7/d89/double__factorial_8cpp.html#abbbcebf3a2d0c67f4c3cfb5511a97981',1,'test(uint64_t n, uint64_t expected): double_factorial.cpp'],['../d4/d83/sum__of__digits_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): sum_of_digits.cpp'],['../dc/d38/ordinary__least__squares__regressor_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): ordinary_least_squares_regressor.cpp'],['../d0/d01/smallest__circle_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): smallest_circle.cpp'],['../d2/d52/heap__sort_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): heap_sort.cpp']]], ['test1_1541',['test1',['../d5/db0/adaline__learning_8cpp.html#a52053d88ea1bcbbed9aca67ab4eeb499',1,'test1(double eta=0.01): adaline_learning.cpp'],['../d4/def/kohonen__som__topology_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): kohonen_som_topology.cpp'],['../d9/d49/kohonen__som__trace_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): kohonen_som_trace.cpp'],['../d6/d9d/large__factorial_8cpp.html#a3f93b60e229b6683e24c4754a7106ee8',1,'test1(): large_factorial.cpp'],['../d4/d83/sum__of__digits_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): sum_of_digits.cpp'],['../db/d01/brent__method__extrema_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): brent_method_extrema.cpp'],['../da/df2/durand__kerner__roots_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): durand_kerner_roots.cpp'],['../d6/d7a/golden__search__extrema_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): golden_search_extrema.cpp'],['../dd/d65/lu__decompose_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): lu_decompose.cpp'],['../de/d75/qr__eigen__values_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): qr_eigen_values.cpp']]], ['test2_1542',['test2',['../d5/db0/adaline__learning_8cpp.html#a379f7488a305f2571f2932b319931f82',1,'test2(double eta=0.01): adaline_learning.cpp'],['../d4/def/kohonen__som__topology_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): kohonen_som_topology.cpp'],['../d9/d49/kohonen__som__trace_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): kohonen_som_trace.cpp'],['../d6/d9d/large__factorial_8cpp.html#a76aae4778fbe89a3d59fd61fbc050cfa',1,'test2(): large_factorial.cpp'],['../d4/d83/sum__of__digits_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): sum_of_digits.cpp'],['../db/d01/brent__method__extrema_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): brent_method_extrema.cpp'],['../da/df2/durand__kerner__roots_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): durand_kerner_roots.cpp'],['../d6/d7a/golden__search__extrema_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): golden_search_extrema.cpp'],['../dd/d65/lu__decompose_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): lu_decompose.cpp'],['../de/d75/qr__eigen__values_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): qr_eigen_values.cpp'],['../d0/d01/smallest__circle_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): smallest_circle.cpp']]], ['test3_1543',['test3',['../d5/db0/adaline__learning_8cpp.html#a992bdf1fdb0b9d414bcf7981d2d87aa9',1,'test3(double eta=0.01): adaline_learning.cpp'],['../d4/def/kohonen__som__topology_8cpp.html#a6d0455dd5c30adda100e95f0423c786e',1,'test3(): kohonen_som_topology.cpp'],['../d9/d49/kohonen__som__trace_8cpp.html#a6d0455dd5c30adda100e95f0423c786e',1,'test3(): kohonen_som_trace.cpp'],['../db/d01/brent__method__extrema_8cpp.html#a6d0455dd5c30adda100e95f0423c786e',1,'test3(): brent_method_extrema.cpp'],['../d6/d7a/golden__search__extrema_8cpp.html#a6d0455dd5c30adda100e95f0423c786e',1,'test3(): golden_search_extrema.cpp'],['../d0/d01/smallest__circle_8cpp.html#a6d0455dd5c30adda100e95f0423c786e',1,'test3(): smallest_circle.cpp']]], diff --git a/search/functions_14.js b/search/functions_14.js index e14f5d89c..d4e861fe8 100644 --- a/search/functions_14.js +++ b/search/functions_14.js @@ -9,7 +9,7 @@ var searchData= ['tellp_3682',['tellp',['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::basic_ofstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::fstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::wostream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::basic_ostringstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::ostringstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::basic_fstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::iostream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::stringstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::ostream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::strstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::basic_stringstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::wostringstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::basic_ostream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::wiostream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::ofstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::ostrstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::wfstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::basic_iostream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::wofstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::wstringstream::tellp()']]], ['terminate_3683',['terminate',['http://en.cppreference.com/w/cpp/error/terminate.html',0,'std']]], ['ternary_5fsearch_3684',['ternary_search',['../dc/dfe/ternary__search_8cpp.html#aef655a27eb82efa299bf9d0becf6e9c8',1,'ternary_search.cpp']]], - ['test_3685',['test',['http://en.cppreference.com/w/cpp/utility/bitset/test.html',0,'std::bitset::test()'],['../db/d82/classlarge__number.html#a959c5c1a982949bbf98e1ea0f9afe6a9',1,'large_number::test()'],['../d4/d5d/math_2armstrong__number_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): armstrong_number.cpp'],['../d5/df6/check__amicable__pair_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): check_amicable_pair.cpp'],['../d7/d89/double__factorial_8cpp.html#abbbcebf3a2d0c67f4c3cfb5511a97981',1,'test(uint64_t n, uint64_t expected): double_factorial.cpp'],['../d4/d83/sum__of__digits_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): sum_of_digits.cpp'],['../d0/d01/smallest__circle_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): smallest_circle.cpp'],['../d2/d52/heap__sort_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): heap_sort.cpp']]], + ['test_3685',['test',['http://en.cppreference.com/w/cpp/utility/bitset/test.html',0,'std::bitset::test()'],['../db/d82/classlarge__number.html#a959c5c1a982949bbf98e1ea0f9afe6a9',1,'large_number::test()'],['../d4/d5d/math_2armstrong__number_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): armstrong_number.cpp'],['../d5/df6/check__amicable__pair_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): check_amicable_pair.cpp'],['../d7/d89/double__factorial_8cpp.html#abbbcebf3a2d0c67f4c3cfb5511a97981',1,'test(uint64_t n, uint64_t expected): double_factorial.cpp'],['../d4/d83/sum__of__digits_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): sum_of_digits.cpp'],['../dc/d38/ordinary__least__squares__regressor_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): ordinary_least_squares_regressor.cpp'],['../d0/d01/smallest__circle_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): smallest_circle.cpp'],['../d2/d52/heap__sort_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): heap_sort.cpp']]], ['test1_3686',['test1',['../d5/db0/adaline__learning_8cpp.html#a52053d88ea1bcbbed9aca67ab4eeb499',1,'test1(double eta=0.01): adaline_learning.cpp'],['../d4/def/kohonen__som__topology_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): kohonen_som_topology.cpp'],['../d9/d49/kohonen__som__trace_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): kohonen_som_trace.cpp'],['../d6/d9d/large__factorial_8cpp.html#a3f93b60e229b6683e24c4754a7106ee8',1,'test1(): large_factorial.cpp'],['../d4/d83/sum__of__digits_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): sum_of_digits.cpp'],['../db/d01/brent__method__extrema_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): brent_method_extrema.cpp'],['../da/df2/durand__kerner__roots_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): durand_kerner_roots.cpp'],['../d6/d7a/golden__search__extrema_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): golden_search_extrema.cpp'],['../dd/d65/lu__decompose_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): lu_decompose.cpp'],['../de/d75/qr__eigen__values_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): qr_eigen_values.cpp']]], ['test2_3687',['test2',['../d5/db0/adaline__learning_8cpp.html#a379f7488a305f2571f2932b319931f82',1,'test2(double eta=0.01): adaline_learning.cpp'],['../d4/def/kohonen__som__topology_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): kohonen_som_topology.cpp'],['../d9/d49/kohonen__som__trace_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): kohonen_som_trace.cpp'],['../d6/d9d/large__factorial_8cpp.html#a76aae4778fbe89a3d59fd61fbc050cfa',1,'test2(): large_factorial.cpp'],['../d4/d83/sum__of__digits_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): sum_of_digits.cpp'],['../db/d01/brent__method__extrema_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): brent_method_extrema.cpp'],['../da/df2/durand__kerner__roots_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): durand_kerner_roots.cpp'],['../d6/d7a/golden__search__extrema_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): golden_search_extrema.cpp'],['../dd/d65/lu__decompose_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): lu_decompose.cpp'],['../de/d75/qr__eigen__values_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): qr_eigen_values.cpp'],['../d0/d01/smallest__circle_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): smallest_circle.cpp']]], ['test3_3688',['test3',['../d5/db0/adaline__learning_8cpp.html#a992bdf1fdb0b9d414bcf7981d2d87aa9',1,'test3(double eta=0.01): adaline_learning.cpp'],['../d4/def/kohonen__som__topology_8cpp.html#a6d0455dd5c30adda100e95f0423c786e',1,'test3(): kohonen_som_topology.cpp'],['../d9/d49/kohonen__som__trace_8cpp.html#a6d0455dd5c30adda100e95f0423c786e',1,'test3(): kohonen_som_trace.cpp'],['../db/d01/brent__method__extrema_8cpp.html#a6d0455dd5c30adda100e95f0423c786e',1,'test3(): brent_method_extrema.cpp'],['../d6/d7a/golden__search__extrema_8cpp.html#a6d0455dd5c30adda100e95f0423c786e',1,'test3(): golden_search_extrema.cpp'],['../d0/d01/smallest__circle_8cpp.html#a6d0455dd5c30adda100e95f0423c786e',1,'test3(): smallest_circle.cpp']]],
Linear regression example using Ordinary least squares More...
#include <iomanip>
#include <cassert>
#include <cmath>
#include <iostream>
#include <vector>
This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.
Get matrix inverse using Row-trasnformations. Given matrix must be a square and non-singular.
matrix transpose
function to check if given matrix is a square matrix
main function
pre-multiplication of a vector by a scalar
Matrix multiplication such that if A is size (mxn) and B is of size (pxq) then the multiplication is defined only when n = p and the resultant matrix is of size (mxq)
multiplication of a matrix with a column vector
post-multiplication of a vector by a scalar
addition of two vectors of identical lengths
subtraction of two vectors of identical lengths
division of a vector by a scalar
operator to print a matrix
operator to print a vector
Self test checks