Subscribe to DSC Newsletter

Machine Learning with C++ - Polynomial regression with Eigen

Hello, this is my third article about how to use modern C++ for solving machine learning problems. This time I will show how to make a model for polynomial regression problem , with well known linear algebra library called Eigen.

Eigen was chosen because it is widely used and has a long history, it is highly optimized for CPUs, and it is a header only library. One of the famous project using it is TensorFlow. I found Eigen as the most useful library for linear algebra in C++. It has intuitive interfaces and implements modern C++ approaches, for example you can use std::move to eliminate matrix coping in some cases. Also it has great documentation with examples and search engine. It supports Intel® Math Kernel Library (MKL), which provides highly optimized multi-threaded mathematical routines for x86-compatible architectures. And it can be used in CUDA kernels, but this is still an experimental feature.

Content

  1. Preparations
  2. Loading data to Eigen data-structures
  3. Standardization
  4. Generating additional polynomial components
  5. Batch gradient descent implementation
  6. Generating new data for testing model predictions
  7. Making predictions
  8. Plotting

It is the last article about linear algebra libraries for C++, I'm going to continue with articles about full featured ML frameworks for C++.

Continue reading the article and source code here

Views: 461

Comment

You need to be a member of Data Science Central to add comments!

Join Data Science Central

Follow Us

Videos

  • Add Videos
  • View All

Resources

© 2018   Data Science Central™   Powered by

Badges  |  Report an Issue  |  Privacy Policy  |  Terms of Service