Wolfram Computation Meets Knowledge

1.00 What Is Machine Learning?

The traditional way to make a computer accomplish something is to give it explicit instructions (if this happens, do this, otherwise do that, etc.) that are written by hand in a given programming language. This computer programming method is extremely successful, and it has been used to develop just about all software running on our computers, phones, or even cars. However, this method is not always the most practical.

For example, let’s consider developing a program to identify images, such as what the ImageIdentify function does:


It would be almost impossible to write such a program “by hand” because of the high number of possibilities to consider (various object orientations, lighting conditions, occlusions, etc.). Instead, it would be easier to use the machine learning method, which is a method, as well as a scientific discipline, used to program computers using data instead of explicit instructions. In the case of image identification, the machine learning method would consist in giving the computer a set of images labeled by what they are, and then letting the computer figure out by itself how to identify new images.

Here is an example where the function Classify is used to learn to distinguish boletes from morels:


The computer has been given eight images of boletes and eight images of morels, each labeled by what they are. These labeled images are called examples (a.k.a. data points or observations), and they form a dataset. The result is a program called a model in the sense of a mathematical model (see Chapter 5, How It Works) that is represented here by a classifier function.

This program is the result of the learning process, and it can be used to identify new images:


In a sense, machine learning is programming by examples. The computer (i.e. the machine) learns to perform a task from examples of this task. In this context, “learns” broadly means that information from some data is used to create the program.

Image identification is not the only application for which machine learning is useful; it is used nowadays to perform a variety of tasks, from identifying spam emails, to forecasting stock prices, to playing video games. Machine learning is not a drop-in replacement for traditional programming though. To understand better what machine learning can be used for, let’s review some of its current domains of application.

One general domain of application has to do with imitating human abilities. This includes perception tasks, such as understanding visual and audio data; intuition tasks, such as game playing; and the very important task of understanding text. Here are examples of applications that fall into this domain.

Detect road objects from an image or a video stream:

Enhance the resolution of images:

Translate text:

Predict which word might follow:

Detect the sentiment of a sentence:

Transcribe audio speech into written text:

Play a game:

These tasks are generally considered to be part of artificial intelligence (although “human intelligence” would be more appropriate), and they are typically tackled using artificial neural networks, a field known as deep learning (presented in Chapter 11, Deep Learning Methods). Such tasks used to be hard or impossible to solve in the past, but things have been changing since the 2010s due to faster computers and a regaining of interest in neural networks. Nowadays, machine learning is heavily used to solve these tasks, for example, social media uses machine learning to analyze large amounts of images and texts in order to select relevant content for users. Note that the kind of data involved in such tasks (image, audio, text, etc.) is more complex and “fuzzy” than numbers arranged in a spreadsheet, which is why it is called unstructured data.

Another important domain of application concerns the utilization of large amounts of structured data. Structured datasets are what usually comes to mind when talking about data: numbers and labels stored in spreadsheets or databases. Structured data could, for example, be sales data gathered by a retail company: type of product, dates of sale, price, etc. The most common task when dealing with structured data is predicting the value of a variable (a.k.a. attribute) of interest, such as future sales numbers, but it can also be about making sense of the data, such as identifying clusters. Here are examples of such tasks.

Forecast sales of retail stores:

Detect fraudulent bank transactions:

Diagnose diseases based on medical data:

Predict if someone is likely to click on an advertisement:

Select which content should be recommended to users:

Separate customers into groups for marketing purposes:

These tasks are typically what a data scientist would be working on, and they would be tackled using classic machine learning algorithms (presented in Chapter 10, Classic Machine Learning Methods). While many of these tasks are not inherently “hard,” machine learning shines by its ability to automate things and to handle larger datasets than what humans would be able to, both in terms of the number of examples and the number of features. Although not new, these applications still have the potential for growth given the ubiquity of data and the current lack of data science expertise.

The examples in this chapter only give a general idea of where machine learning can be applied. Many other tasks would also benefit from its use. Imagination, expertise, and proper data are the limiting factors. Machine learning is a generic technique. It can be used in any field or industry that produces data: medicine, science, education, retail, etc. Of course, machine learning is not magic. It cannot solve every problem, and traditional programming is often the best solution. Nevertheless, machine learning is a useful tool that is still underused. Moreover, as computers are getting faster and data more widely available, the scope of machine learning is growing, unlocking more applications. We can expect the machine learning method to become a commodity in the near future, and, possibly, to be the key to developing artificial, human-like intelligence.

Machine learning allows for the programming of computers using data instead of explicit instructions.
Machine learning does not replace traditional programming but complements it.
Machine learning can be used to imitate the perception and intuition abilities of humans.
Machine learning can be used to make predictions.
Machine learning can be used to automate things.
Machine learning allows for the use of large amounts of structured data.
1.1Try to create a simple classic program that can differentiate between boletes and morels. How does it compare with the learned model?
1.2Think about three tasks for which machine learning could be useful for you or your organization.
1.3Before reading the rest of this book, try to imagine simple ways to learn to make predictions from data.
Tech Notes
Machine Learning vs. Statistics
  • Machine learning is often confused with statistics. There are a lot of similarities between the two disciplines because machine learning models are statistical models. In a sense, machine learning could be considered a subfield of statistics. However, these two fields differ in their goals and practices. The goal of machine learning is generally to predict something while the goal of statistics is generally to understand something (e.g. “Does this drug help cure this disease?”). As a consequence, machine learning models are often complex (e.g. ensemble of trees, neural networks) and “black box,” which means it is hard to interpret what they do. On the other hand, models in statistics are generally simple in order to be interpretable (e.g. logistic regression, generalized linear models). Finally, machine learning often deals with large amounts of data and of various types (structured data, images, texts, etc.) while statistics often deals with smaller and “simpler” datasets.
  • Copyright 2024