C++/TIPS
When Should You Learn Machine Learning using C++?
A guide for the Scientist, Developer, and User of Machine Learning.
A while ago, I decided to start implementing Machine learning using C++ to enhance my skills in both Machine learning and C++. I searched for a good online tutorial to guide me through the implementation, but the fact is there are not so many tutorials that can help you learn these two together. In fact, I found 99% of online Machine learning tutorials using Python, R or Matlab.

This article is part of a series that address the implementation of Machine learning algorithms in C++, throughout this series, We will be implementing basic Machine learning algorithms using C++ features.
- When Should You Learn Machine Learning using C++?
- Data Preprocessing And Visualization In C++.
- Machine Learning Data Manipulation Using C++.
- Naive Bayes From Scratch using C++.
- Linear Regression Implementation In C++.
- The 8 Books Each C++ Developer Must Read.
- The 9 Books Each Machine Learning Developer Must Read.
I agree that learning C++ and Machine learning is a very difficult mission, but as I said before, the target here was to learn both together.
I looked for a reason why most people recommend using python while learning ML, not C++, and here is the summary:
- Python is a more flexible language than C++.
- The library functions make the task trivially simple.
- Work interactively with data by running the Python interpreter in the command line.
- The main purpose is to learn about ML, not to practice programming.
- Debugging C++ code for ML algorithms is very difficult.
On the other hand, reasons support learning how to Implement ML in C++ are:
- C++ is more efficient than most other languages.
- You can control every single resource starting from memory, CPU, and many other things.
- Most frameworks are implemented in C++under the hood, like TensorFlow, Caffe, Vowpal, wabbit and libsvm.
- Learning machine learning in C++ makes you a very desirable hire target.
Most of the answers were directed toward people who are new to Machine learning, on the other hand, I was searching for a more detailed answer.
People working on machine learning can be divided into three categories:
- Scientists: they work with theoretical principles and work on advancing them.
- Developers: work on the implementation and development of technologies for high-tech companies.
- Users: use the technologies developed by other companies to achieve the goal of their application.

So it depends on where is your location in that pyramid and what technology you use. If you are a scientist, maybe then you don’t need to learn with C++; however, if you are a developer who works with C++ to implement Machine learning applications, it’s highly recommended that you implement these algorithms from scratch using C++.
In general, use C++ when:
- You need the speed, and there isn’t a Python library for what you need to do, or that library is still slower.
- You need to be able to control the memory usage because you’ll be pushing your system's limit.
Read the following article if you want to learn C++
The 8 Books Each C++ Developer Must Read.
Use Python when:
- Speed isn’t critical, or there is a library function that is fast enough.
- The library functions make the task trivially simple, and again, the task is not performance-critical.
- Work interactively with data by running the Python interpreter on the command line.
Recommended Books:
- The C++ Programming Language, by Bjarne Stroustrup
- The Hundred-Page Machine Learning Book, by Andriy Burkov
- Machine Learning For Absolute Beginners, by Oliver Theobald
References:
- I want to use C++ to learn Machine Learning instead of Python or R, is it fine?
- Why don’t deep learning researchers and professionals use C or C++ instead of slow language like Python? Will it reduce dependence on GPUs?
- Why should I use C++ instead of Python for scientific computing?
- Why is C++ not a good language for machine learning?
Hope you find this article useful. Please follow to get notified when a new article in this series is released.
Check my latest articles:






