Getting Started with ml5.js

In this page I will try to expalin what's ml5.js, how you can use it...
Also, I will try to explain why is machine learning usefull and some examples of how you can use it.
Finally I'll show you an example of a program that uses ml5.js.

What's ml5.js?

According to the official website:
ml5.js is a friendly Machine Learning for the Web.
It also says that:
ml5.js aims to make machine learning approachable for a broad audience of artists, creative coders, and students.

But it doesn't really gives us lot of usefull information. The official website says that it's a machine learning but, what's a machine learning?
According to an adjunct professor of Stanford's University, machine learning is the science of getting computers to learn without being explicity programmed.
ml5.js is a library that provides macine learning algorithms and models in the broswer without needing any other exernal dependences. ml5.js is based on TensorFlow.js.

Why is machine learning usefull?

Machine learning is too usefull andyou use it dozens of times a day without knowing it. You use a machine learning:

Image classification using MobileNet

 
      executaClasificador(); //This line executes the "executaClasificador" function 
      
      //This function classify the images
      function executaClasificador(){ 
      //Now we declare all the variables that we will use
        var image = document.getElementById('image');   // The image we want to classify
        var result = document.getElementById('result'); // The result tag in the HTML 
        var probability = document.getElementById('probability');   // The probability tag in the HTML
        
        const classifier = ml5.imageClassifier('MobileNet');    // Initialize the Image Classifier method with MobileNet

        var fileUploader = document.getElementById('fileUploader');//The element to upload images

        // Make a prediction with the selected image
        // This will return an array with a default of 10 options with their probabilities
        classifier.predict(image, function(results) {
          result.innerText = results[0].className;
          probability.innerText = results[0].probability.toFixed(4);
        });
      }
      
      //This function changes the image after selecting it
      fileUploader.onchange = function (event) {
        input = event.target;
        if (input.files && input.files[0]) {
            var reader = new FileReader();

            reader.onload = function (e) {
                image.src = e.target.result;
                executaClasificador();
            }

            reader.readAsDataURL(input.files[0]);
        }
      }
      

The MobileNet model labeled this as ... with a confidence of ...