Machine learning is a fundamental technology in the modern world.

But how does machine learning work and how can you use it yourself?

What Is Machine Learning?

A pair of glasses sat on a laptop, with the screen visible through the lenses.

Machine learning is a relatively simple concept.

Computer systems can learn and adapt by analyzing existing data patterns from pools of information.

This is usually done without explicit instructions from humans.

image classifier detecting a tiger

A good example comes in the form of virtual assistant tools.

Siri, Cortana, and Google Assistant all make extensive use of machine learning to understand human speech.

This enables them to improve on their own.

image classifier detecting a cricket

What Is ml5.js?

Most machine learning algorithms and tools use R or Python for their code, but ml5.js is different.

Getting Started With Machine Learning: The Learning Process

Training a machine learning algorithm takes time.

Computers learn far faster than humans, but they also learn in different ways.

Learninghow machine learning algorithms trainis a great way to better understand tools like this.

The HTML page in this example contains a file input field to select an image.

Uploaded images display inside a prepared HTML element to enable ml5.js to scan and identify them.

ml5.js is the machine learning library, while p5.js makes it possible to work with images properly.

The second calls a startImageScan() function that you will create in the next step.

Start by adding a const variable to store the imageResult element you created in the last step.

This function contains a simple if statement to check for any errors.

Now you’re free to test your script with some images!

ml5.js is great at classifying images of animals, like this cricket.

Unfortunately, the library can struggle when it comes to images with greater complexity.