Photo: Connect world – shutterstock.com
Artificial intelligence (AI) opens up completely new possibilities for software developers: using machine and deep learning, better user profiles and recommendations, a higher degree of personalization, smarter search options or more intelligent interfaces can be implemented. This inevitably raises the question of which programming language to use for this. The requirements that an AI coding language must meet are diverse: a large number of machine and deep learning libraries must be available, as well as a powerful runtime environment, extensive tool support, a large developer community and a healthy ecosystem.
While this catalog of requirements is extensive, you have some good options to choose from when it comes to artificial intelligence programming. We show you a selection of the best AI programming languages.
When you work with artificial intelligence as a developer, there is a chance that borders on certainty that there is no way out Python about. In the meantime, almost all mainstream libraries support Python 3.x – the days when the conversion from Python 2.x to 3.x brought compatibility issues are pretty much over. In other words, you can finally take advantage of Python 3.x’s numerous new features in practice. That’s not to say the packaging hurdles aren’t an issue anymore in Python – but most of the problems can be circumvented using Anaconda. Nevertheless, it would be nice if the Python community could finally be completely rid of these hurdles.
That said, Python’s available math and statistics libraries are way ahead of other programming languages: NumPy has become so ubiquitous that it can almost be called the standard API for tensor operations, while pandas brings R’s flexible data frames into the Python world. When it comes to Natural Language Processing (NLP) you have the choice of the time-honoured NLTK and the super fast SpaCywhile the tried and tested version is best for machine learning purposes scikit learning recommends. On the other hand, when it comes to deep learning, all current libraries (TensowFlow, PyTorch, Chains, Apache MXNet, Theanoetc.) are in fact “Python-first” projects.
If you are a regular visitor to arXiv you will have noticed by now that most deep learning research projects that provide source code rely on Python for this purpose. When it comes to deployment models, microservice architectures and technologies such as: SeldonCore the delivery of Python models in production environments is greatly simplified.
Python is undoubtedly the programming language of choice when it comes to AI research: it offers the largest selection of machine and deep learning frameworks and is the coding language that sets the tone in the AI world.
C++ is unlikely to be the first choice for your AI project. However, deep learning at the edge is becoming an increasingly common scenario. In this case, you need to run your models on systems with very limited resources. To squeeze the last bit of performance out of the system, it may be necessary to delve back into the depths of the pointer world.
Fortunately, modern C++ code can be really fun to write. You have several approaches to choose from: Or you use libraries like Nvidia’s CUDA to write your own program code that flows directly to the GPU – or you can use TensorFlow or PyTorch to access flexible high-performance APIs. Both PyTorch and TensorFlow allow you to integrate models written in Python into a C++ runtime environment. This brings you much closer to productive use, while remaining flexible in development.
As AI applications spread across devices ranging from embedded systems to massive clusters, C++ is an important part of the AI coding toolkit. Implementing artificial intelligence in the edge area is not only a matter of precise programming, but also good quality and speed.
The family of JVM programming languages (Java, Scala, Kotlin, Clojure, etc.) continues to be a good choice when it comes to developing AI applications. There is a rich selection of libraries available for almost all aspects – be it natural language processing (CoreNLP), tensor operations (ND4J) or GPU-accelerated deep learning (DL4J). In addition, these coding languages also provide easy access to big data platforms such as: Apache Spark and Apache Hadoop.
For most companies, Java is the lingua franca – and with Java 8 and newer, creating Java code is no longer daunting. Programming an AI application in Java can feel a bit boring, but it usually produces satisfying results and allows you to use all existing parts of a Java infrastructure for development, implementation, and monitoring.
javascript learning exclusively for the development of AI applications is a highly unlikely scenario. However, Google’s TensorFlow.js still a good way to control your Keras and TensorFlow models via browser or Node.js.
Nevertheless, the big rush of JavaScript developers in the field of artificial intelligence has so far failed to materialize. This may be because the JavaScript ecosystem has thus far lacked depth when it comes to available libraries – at least compared to programming languages like Python. Furthermore, on the server side, there are no real benefits to be expected from deployment models with Node.js (again compared to the Python options). JavaScript-based AI applications are therefore likely to remain browser-based.
Swift for TensorFlow combines the latest and greatest features of TensorFlow with the benefits of Python libraries that integrate easily – just like using Python yourself.
That fastingteam is currently working on a Swift version of its popular library – promising plenty of optimizations, especially related to the LLVM compiler. While it’s far from ready for production, it could be the foundation for the next generation of deep learning development work, so keep an eye out for Swift.
R is the programming language of choice for data scientists. However, developers from other areas may find the coding language confusing due to its data-frame-oriented approach.
For a team of passionate R developers, it can make a lot of sense to integrate with TensorFlow, Keras or H2O for research and prototypes. However, in terms of performance, R can only be recommended to a limited extent for productive use. While high-quality R code can be used productively, in most cases it should be easier to reprogram the R prototype in Java or Python.
Of course, the four programming languages mentioned are not the only options for programming artificial intelligence. Depending on the intended use, the following two coding languages may also be of interest to your AI projects:
lua
A few years ago lua traded as the “next big thing” in artificial intelligence. This was mainly due to Torch Frame – one of the most popular machine learning libraries – for both productive use and research purposes. If you dig into older Deep Learning models, you’ll often find numerous references to Torch and Lua’s source code.
It might be helpful to learn a bit more about the Torch API, which has some similarities with PyTorch’s base API. However, if you don’t feel a greater need to do historical research for your applications, you can easily do without Lua.
Julia
Bee Julia is a powerful programming language that focuses on numerical calculations. As a result, it also fits perfectly into the mathematically oriented world of artificial intelligence. Julia may not be the most popular coding language right now, but wrappers love TensorFlow.jl and mocha good support for deep learning. If the relatively small ecosystem is not an exclusion criterion for you and you want to take advantage of Julia’s focus on high-performance calculations, then you should take a look.
This post is based on an article from our US sister publication InfoWorld.