+ 1

Is it okay to use C++ for programming an AI? instead of python

23rd Feb 2019, 10:26 AM
Jacqueline Cate Catley
Jacqueline Cate Catley - avatar
9 Réponses
+ 14
Jacqueline Cate Catley It depends on your needs. Like I said, Python might not be fast enough for rapid image recognition or instant object detection. But it is way easier and faster to prototype your AI algorithms in Python because of its syntax. So often the setup is that you make prototypes in Python and when you are satisfied with the results, you use C++ There are frameworks like tensorflow, for example, that support both Python and C++. Making the transition is then extremely easy and does not require re-writing from scratch.
23rd Feb 2019, 1:23 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 6
What makes an A.I. , an A.I. ? The ability to act intelligently and learn through mistakes is based on the algorithms applied. Algorithms are independent of programming languages, and can be implemented using any programming language. A lot of modules which facilitate the creation of a program which demonstrates A.I. can be found in Python. That said, other languages can be used to achieve the same results, albeit at the cost of more work.
23rd Feb 2019, 10:33 AM
Hatsy Rei
Hatsy Rei - avatar
+ 6
Kuba Siekierzyński sir, are you saying that once we code in python to get expected result then we will shift from python to java or c++ ?? But python also does a just in time compilation even though it is a interpreted language...
23rd Feb 2019, 11:33 AM
Aaditya Deshpande
Aaditya Deshpande - avatar
+ 5
Yes, but it is *too slow* for most of industrial applications. It won't be able to react in real-time when classifying wood planks on a production line or when deciding how to drive an autonomous car. You have to turn to faster languages then.
23rd Feb 2019, 11:39 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 4
Production-ready AI algorithms are almost always translated to a compiled language as most often the hardware which needs it does not understand Python. Most deployments are done in either Java or C++ Like Hatsy said, that is language-indepentent and your need or requirement is what is decisive here.
23rd Feb 2019, 10:39 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 4
Federico Corradini Depends on the setup but for most time-critical solutions every milisecond is precious :) Java is a compiled language, as it compiles to JVM byte code (it can then be interpreted or compiled, but the inital code is compiled first).
23rd Feb 2019, 2:43 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
0
Kuba Siekierzyński so do you mean that it is more ideal to use c++ for AI?
23rd Feb 2019, 1:04 PM
Jacqueline Cate Catley
Jacqueline Cate Catley - avatar
0
Kuba Siekierzyński So even with libraries like Cython or numba or with compiler modules like py2exe it would be too slow? Besides: why Java? Isn't it interpreted too?
23rd Feb 2019, 2:30 PM
Federico Corradini
Federico Corradini - avatar
0
It's compiled in byte code like python could be with its .pyc. 🤔 I know that Java is faster than Python, but AFAIK Java programs require a JVM, so that means it's interpreted at least partially. 🤔
23rd Feb 2019, 2:48 PM
Federico Corradini
Federico Corradini - avatar