DEV Community

Cover image for The best programming language for Artificial Intelligence and Machine Learning
Duomly
Duomly

Posted on • Updated on • Originally published at blog.duomly.com

The best programming language for Artificial Intelligence and Machine Learning

This article was originally published at: What is the best programming language for machine learning and artificial intelligence


Machine learning (ML) as the sphere of Artificial intelligence (AI) is not a new concept in computer science. However, ML has been experiencing its expansion and popularity only in recent years since it has been possible to use big data. Just think about how much data is available to us today than ten years ago.

All of us know, almost all social networks use AI. For example, Facebook and Instagram based on pages that users previously liked, generate page recommendations that might appeal to a user. These recommendations come automatically, or by a program that is first learned to recognize what a user likes, and then make recommendations to him to improve the knowledge of a given area.

By choosing a programming language, providing relevant data, and implementing an appropriate algorithm, we can create a program that will, like a man, learn how to respond to specific requirements.

Under the above, whether you are a programmer or you are interested in this field of programming and would like to learn, in this article, I will present you five prominent languages in the ML sphere through analysis and comparison. These are Python, R, Java, Lisp, and Javascript.

1. Python

Duomly - Programming Online Courses

Easy to learn (Python Course), simple syntax and a lot of frameworks and libraries. These are the reasons because Python presents one of the most popular languages. It is interpreted and dynamically typed program language.

Where is used?

Python has general usage, development of standard and web applications. However, what makes it unique is its usage in the spheres AI and data science.

Within the field of data science and ML, Python is increasingly advantages compared to other languages. The existence of a massive number of frameworks and libraries for machine learning, easy writing, and a big community have influenced the fact that this language is experiencing a real expansion in this area. Another thing I have to emphasize is asynchronous work. That is in the ML’s context convenient when we have more data sources.

Big projects/companies who use it?

Each of us must have had experience with purchasing products on Amazon. You could see the product recommendations. These recommendations generate on our previous purchases and product search, and it bases the Python ML model on it.

Google (Gmail) is one of the larger companies that use the TensorFlow Python framework for the prediction of spam mail. TensorFlow has been developed by Google and accordingly is used by several other “products” such as voice recognition and the similar.

What is the usage in Machine Learning and AI context and what can be built with it frameworks which may be used in the context of the language if any?

I already mentioned that Python has tremendous ML support in the form of libraries and frameworks.
TensorFlow is the most popular framework which covers all processes in ML. It is also used for deep learning. The areas in which they expose are detection and recommendations based applications (for example voice detection, image, and video recognition).

We can also use TensorFlow to develop Chatbots. But when talking about the chatbot, it’s important to emphasize that besides it there are several other libraries, such as Tweepy, for a Twitter chatbot.

When it comes to libraries, Scikit is a library that contains numerous algorithms. If you access the official website, you can see several examples from which I would like to highlight, for example, Face Recognition or recognize hand-written digits.

Pros
  • It’s easy to write, — Minimalism (application development with a smaller number of code lines compared to Java), — A lot of machine learning courses, — Large community, — A lot of libraries and frameworks
Cons
  • Slower execution compared to Java, — Not suitable for mobile development, — Not a good choice for game development

2. R Programming

Duomly - Programming Online Courses

R for many years is a synonym for data science. It is interpreted and dynamically typed language.

If you have already programmed in another language, you can quickly understand how R works. It does not take a lot of knowledge because R has lots of packages, libraries, and materials that can help you in the learning process (like Python).

Where is used?

R is created for statistics and predictive analysis, and we mostly find its usage in data science. Within ML, R is the most abundant in this field after Payton.

Big projects/companies that use it?

Many large companies use R for data analysis, big-data modeling, and visualization. Some of them are Google, Uber, the New York Times. R has wide usage in banking, especially in fields for predicting different risks. In this domain, I would mention Bank of America and ANZ Bank.
Facebook uses R for ML testing while Twitter created an R-language anomaly detection library.

What is the usage in Machine Learning and AI context and what can be built with it frameworks which may be used in the context of the language if any?

mlr package has the most extensive usage because it takes part in all phases of the ML process. dmlc XGBoost differs from mlr only for better performance.

I need to emphasize two important libraries for data science. These are Dplyr and Ggplot.

Dplyr is a powerful R library that has a simple syntax and dominates the process of data manipulation. It is especially emphasized in the process of data decomposition.

Ggplot2 is another important library that serves for visualization and graphical representation of data. It is a very old library but thanks to that it contains many plots of different styles.

Pros
  • Good for statistics, — A large number of libraries and frameworks
Cons
  • Slower than Python, — Not beginner-friendly, — Poorly written

3. Java

Duomly - Programming Online Courses

Java is compiled and strongly typed language. In programming, it’s a standard, and it’s not falling for its popularity for years. The performance execution of the program is much better compared to Python. But learning and coding are more complex.

Where is used?

Java is like Python general-purpose language and has a wide range of usage: from game development to standard, web and mobile applications.
This programming language can be a good choice for ML, especially for businesses that bases on Java and need to be improved by including ML. However, heaving in mind that the ML area itself is complex, Java can make difficulties in this field, even senior developers. Because of this, Python and R are more dominant than in ML.

Big projects/companies that use it?

Numerous well-known companies use Java for server-side as one of the languages. Some of these companies are YouTube, Amazon, eBay and LinkedIn.

What is the usage in Machine Learning and AI context and what can be built with it frameworks which may be used in the context of the language if any?

When talking about deep learning based on pattern recognition, Deeplearning4j is the most frequently used library. It is in line with the area in which it works very suitable for text, face, image and voice recognition.

Weka and Massive online analysis (MOA) are the other two significant libraries that contain a large number of tools and algorithms. They are often used together and are supported by a vast community. The fields in which they apply are data science and recommendation systems.

Also, many AI games that need to learn how to play a game with a user, such as Chess and Tic-Tac-Toe, are developed with the help of this programming language. In the end, I would like to mention Chatbot applications. We can find many of them in medicine and companies that continuously provide services and maintain contact with users.

Pros
  • Big community, — Faster execution compared with Python, — An excellent choice for developing games, — Good choice for developing mobile applications
Cons
  • Not beginner-friendly, — Need JVM to run

4. Lisp

Duomly - Programming Online Courses

Lisp is a family of programming languages, of which the most popular dialects are Clojure and Common Lisp. Compared to other languages on this list, Lisp has the longest history. Therefore, it had a lot of influence on the development of R, Python, and Javascript. It is dynamically typed.

In the context of AI, Lisp was a popular language, but its AI concept differs from today’s concepts and needs. Within the level of learning difficulty, Lisp is one of the harder languages and is not recommended to beginners.

Where is used?

Lisp is a general-purpose language but has found its use most in the area of traditional, symbolic AI.

Big projects/companies that use it?

ELIZA is a dialogue (talk) program developed with LISP. It is the forerunner of today’s Chatbot app. As for the modern version, the use of ELIZA has not stopped, and you can use it to create Chatbot intended for e-commerce sites.

Also, Grammarly uses Common Lisp.

What is the usage in Machine Learning and AI context and what can be built with it frameworks which may be used in the context of the language if any?

I mentioned already that Lisp stands out in the traditional AI. Compared to Python and Java, which are used in a sphere such as a machine learning and deep learning, Lisp cannot handle modern requirements of this type.

The reason for this is primarily the lack of support in the form of libraries.
Regardless, Lisp’s background is still essential for understanding the concept of traditional AI.

Pros

— It’s fast with the appropriate compiler,
— It’s good to solve the problem

Cons

— Not beginner-friendly,
— There are not enough libraries,
— The community is not as big as the Python or Java community

5. Javascript

Duomly - Programming Online Courses

Javascript with Node.js makes this language special in web development because of full-stack features. Javascript is interpreted and dynamically typed language.

An essential element is that Javascript is easy to learn the basics. However, one must remember that the beginner’s understanding of the context of work is sometimes difficult and requires a lot of attention. Indeed, this language belongs to a group easy to learn.

Where is used?

The use of Javascript is limited to web development only, and this distinguishes this language from others on the list. I can say this feature is advantageous if your area of work and interest is purely web. This language is used to dynamics and interaction of the website, then to build standard web applications and progressive web applications.

Since Javascript is increasingly developing and thus extending the limits of its application, apart from the above, it uses in data science and ML. The interest of the community for these spheres is becoming more intense, which is a very positive fact.

Big projects/companies that use it?

In the front-end domain, there are rare companies that did not choose Javascript for their primary language. I will only mention Wikipedia, WordPress, and Facebook. On the other hand, except for front-end, LinkedIn and eBay, Javascript has been included among the languages and back-end pages.

What is the usage in Machine Learning and AI context and what can be built with it frameworks which may be used in the context of the language if any?

There are many libraries and frameworks of which Google and Facebook have developed some.

When we talk about ML in Javascript, I first need to mention DialogFlow. That is neither a library nor a framework but a powerful technology developed by Google on the basis of AI. DialogFlow makes it easy to create and train human-computer interaction. With DialogFlow and Node.js, you can quickly develop voice or text Chatbot for a messenger, Slack, Twitter, and similar networks. Also, this technology combines often with a framework such as Angular for the development of Chatbot within web applications.

TenserFlow.js library is now one of the most popular ML development and training libraries and a deep learning model with Javascript. If you access the site, you will see a few exciting projects. I would mark off the Emoji Scavenger Hunt, which gives you certain emoji and you need to identify them with the help of the camera in as many numbers as possible in a short time.

For the field of neural networks, I would emphasize the brain.js library. There is also a short course on it.

Pros
  • Beginner friendly,
  • Full-stack,
  • It‘s fast
Cons
  • It is necessary to have a good knowledge of JS before using the Node.js platform, — Certain programming language concepts can confuse beginners

The rank of the languages with the highest amount of jobs

  1. JavaScript — 12,620
  2. Java — 11,505
  3. Python — 7,928
  4. R — 936
  5. Lisp — 3

The rank of the languages with the highest salary

To estimate the most paid technology we have taken the median salary for the last three months. I must say that the results are impressive.

  1. Lisp — $73k
  2. Python — $67k
  3. Java — $65k
  4. R — $65k
  5. JavaScript — $56k

The easy to learn rank

  1. Python
  2. JavaScript
  3. Java
  4. R
  5. Lisp

General

If you look at the statistics, you can see that no language is superior to the other. For example, Lisp is the most paid, but the demand for Lisp experts is small. Many factors affect the popularity of the language, and this changes rapidly from year to year. But, if we guide by these criteria and the facts I have provided in this article, Python is a language which is essential in the ML compares to others.

It became part of the scientific and academic community, and in the ML sphere, Python has a much more extensive use than all other languages. It is also indispensable that for larger ML projects the advantages over R, especially for the ease of writing. Compared to Lisp, Python is undermined by several deep learning libraries, while Lisp is not recommended for this area.

When talking about Java, it is better than Python for developing desktop, mobile applications, and games. Also, the demand for Java developers is higher. So, you certainly will not make a mistake with Java, its a stable and accessible language for many years. However, it is much more difficult to learn from Python, especially for beginners and have to devote a lot of time and attention before realizing your first serious ML projects.

Finally, you should not ignore Javascript. It is now in the lowest position on the list of highest pay but, considers that the demand for Javascript developers is the largest. As the youngest language in ML, which is developing at an extraordinary rate and is focused on web development, it is not excluded that ML will intensify salaries over time.

Winner: Python and Javascript

Thank you for reading!


Duomly - Programming Online Courses

Top comments (10)

Collapse
 
cbarrick profile image
Chris Barrick

JavaScript but not Prolog? It seems like the author is neither an expert in AI/ML nor programming languages.

There is nothing in ML or AI for which JavaScript is suitable. It's a frontend language

Prolog on the other hand is crazy powerful for things like knowledge based systems, constraint solving, rule engines, symbolic programming, parsing, and search.

Collapse
 
togakangaroo profile image
George Mauer • Edited

I'll point out that for decades many computer science departments would start students off with scheme - a LISP. I'm really not sure where you get that it's all that hard. The rules are far, far simpler than most other languages and so is the programming model. I can teach someone the basics in 15 minutes. Of course advanced use takes longer to master, but is mastering metaprogramming in Python quick?

Yes, there is a dearth of jobs and fewer modern libraries, that is worth considering. But do any of those jobs disallow the use of lisp where appropriate? And there is over half a century of stuff, more than twice as long as anything else in the list.

You are right that lisp's focus on ai is different. It does not focus on statistics and analysis or mass data processing. The focus is on writing programs that can modify themselves and grow. That is actually far more interesting, is it not?

The language lost popularity in the ai winter as the tech was too slow to support the fantastic things people were trying to do at the time. But we've got much faster hardware now. Personally, I would love to see it make a resurgence. (And racket is awesome)

Collapse
 
drdougtheman profile image
drdougtheman

"It does not focus on statistics and analysis or mass data processing" please show an example, I'm curious

Collapse
 
togakangaroo profile image
George Mauer

Please show an example of lisp languages not focusing on that stuff? I'm not sure that's how examples work 😉

Collapse
 
andrewflee profile image
Andrew

Lisp’s age is not its appeal. Don’t forget lest someone suggest FORTRAN.

Collapse
 
shadow1349 profile image
shadow1349

I've been looking to get into mine learning and I have been wondering which language to use. I already have a decent amount of experience with Java and Python but I see most of the ML stuff is all Python based though I hadn't thought of using Java so I may give that a go.

What are your thoughts on dotnet core with Microsoft's ML.NET library?

Collapse
 
rctatman profile image
Rachael Tatman

My two cents: I'm a data scientist and I generally use Python for NLP work and R for working with tabular data, statistical analysis or visualization.

I'd personally recommend caret over MLR for R (I believe MLR is actually no longer under active development as the maintainers work on MLR3). I also don't know that R is actually slower than Python, especially since a lot of well-optimized libraries are actually C or C++. It can definitely feel slower if you're writing a lot of loops, however. This blog post has a nice overview of why loops in R are slow and how to avoid them :).

Collapse
 
andrewflee profile image
Andrew

Do ignore JavaScript!

While it has progressed beyond the toy phase it still has all the vestigial remnants.

What? There is no integer type? But I need a sparse matrix of integers to create ...

What? JavaScript coerces types silently??? Oof. I do not want this!

Most of the libraries are buggy and most users don’t know programming fundamentals? Good luck getting help when you are trying to do SVD or k-means clustering!

Scoping rules that make little or no sense? You mean there are global floating around in my code that I don’t know about?? Sometimes ‘use strict’ means I can’t use a library — because the library is so badly written it assumes global scope is ok.

There is == and there is also ===. Whoa! Someone really misunderstands data types!

No exception for going past the end of an array? In fact JavaScript likes to fail silently on all kinds of obvious screwups.

Objects are instances of classes, right? Well no they are associative arrays. Classes aren’t really classes either.

Async program leads to callback hell. Compare it to Go or Python’s async library.

Nah. Forget it. It is a language broken by design that has been abused by history.

It is a necessary evil for the front end — until something better comes along.

Also, what does mobile programming have to do with learning ML? You want to do this in an environment where you have as many tools as possible. Once you are on to something, then start porting it to mobile.

Collapse
 
paulcook159 profile image
Paul Cook • Edited

Thanks for sharing informative article. AI and ML are seeping into nearly every aspect of our lives, helping us in ways that augment our abilities and make us better at what we do. There are many programming languages for AI and ML. But Python is a more popular language over C++ for AI and leads with among developers. Python offers concise and readable code. With its many libraries, they can also be used for data analysis, C++ also creates more compact and faster runtime code. There are many benefits of python. Found one blog on Why Choose Python for AI and ML check out here bit.ly/33EINCr

Collapse
 
firefoxcyber profile image
FoXy

JavaScript and No C++? What an expert!