Why is artificial intelligence driven by Python and not C++?

In short, for Productivity.

If you want to know further , you have to go through all of it.
Python is not the one and only solution for Artificial Intelligence , Data Science , Deep Learning , Neural Network etc. Rather C++ , .NET , Java , JavaScript , Prolog , Julia are some frequently used Ecosystems for those. But we heard too much about Python that nowadays we assume Artificial Intelligence , Data Science , Deep Learning - these things only run on the top of Python. Truth is far from this.
Basically there are two types of languages.

  • Performant Language e.g. C , C++ , Asm , B.
  • Productive Language e.g. Python , JS , Java , Kotlin , Swift.

Python is a Glue Language which combines the higher level API's of different libraries & makes easy to use. Under the hood , those Libraries are mostly written in C/C++. The history of using Glue Languages for scientific research are more older than we actually think. Programmers used to write their code using Perl & TCL back. Python is more popular nowadays.
Now you might ask
"Why Glue Languages ?"
Assume you are working on a Neural Network project which requires you to solve a few hundred problems or you might need to solve the same problem multiple times using multiple ways to figure out which one is the most efficient. For such tasks you need to choose a language in which you can turn your ideas into code , see results and make changes if you need as fast as you can. The more you are faster in this testing step , the more productive you will be. This is the reason why programmers don't want to mess with Low level stuffs here.
Think what will be the impacts (both advantages & disadvantages) of using C/C++ for such projects.
Advantages:-
  • Performance will be grate if code is well optimized.
  • You can manage memory however you want.
  • You will have control over every single line of low level code base.
  • Data processing rate will be much faster.

Disadvantages:-
  • Low level stuffs like Memory Management , Data Type , Pointer will require a great attention and huge time which is a red mark for faster development.
  • Events like Exception handling will be a headache in this case , cause C/C++ is unmanaged language.
  • You might need to re-write some parts or the whole of some useful libraries or frameworks for C/C++.
  • You need to mess with things like Memory Leak / Overflow , Garbage Management.
  • You will need more time & development cost might rise.
  • Maintaining your codebase will be a nightmare.
Optimizations such as performance or others can be done at Deployment Stage. But programmers usually don't bother with those at Development Stage. They basically chose languages keeping two primary keys in mind , they are:-
  • How much productive the language is.
  • Whether plenty of useful libraries / frameworks are available to use with that language or not.
Python satisfies those conditions well. Considering those , other language ecosystems are not even closer to Python.
But admit it or not , truth is
A programmer spends 90% of his time in Python while writing code for AI. On the other hand 99% of CPU time is spent on C/C++. Cause Python , its interpreter & most of the used Libraries are just abstraction over C/C++ under the hood.
Why is artificial intelligence driven by Python and not C++? Why is artificial intelligence driven by Python and not C++? Reviewed by Tejkiran Kushwaha on July 06, 2020 Rating: 5

No comments:

Provide Your Reviews

Theme images by Flashworks. Powered by Blogger.