Machine Learning in Google Sheets

October 31, 2024

We often hear about artificial intelligence and machine learning, and the common perception is that integrating these technologies into your business is complicated and not immediate. While it is true that implementing such technologies requires significant technological skills and is not easy at all, it is equally true that today there are many very powerful tools available, often free of charge, that can take your business to the next level.

Machine learning is a form of artificial intelligence that allows computers to learn from data. This ability allows them to recognize patterns and make predictions or make decisions based on that data.

Today I want to talk to you about a machine learning tool developed by Google for Google Sheets: Simple ML for Sheets. This tool allows you to use machine learning on your data to make predictions about missing values, identify outliers and predict future values, without the need to be an expert in algorithms.

Installation

Sign in to this link or to the Google Sheets add-ons marketplace from any Google sheet. Click on the 'Extensions' menu, select 'Add-ons' and then 'Download add-ons'. At this point, search for the “Simple ML for Sheets” extension and install it.

To start using Simple ML for Sheets, go to the 'Extensions' menu, click on 'Simple ML for Sheets' and then select 'Start'.

At this point, a sidebar will open and you can start exploiting the full potential of machine learning.

Before you start

This add-on uses U.S.-style data formatting. Therefore, if your Google Sheet uses different regional settings, such as European ones, you must set the regional settings to United States to avoid errors when using the add-on.

  1. Click on the 'File' menu
  2. Click on 'Settings'
  3. On Regional Settings, select 'United States'
  4. Save

Predict missing values

I created a table with fictitious house prices and some data such as surface area, number of rooms, number of bathrooms, year of construction and area. The only missing value is the price of a house. In this case, the machine learning algorithm will estimate the price of the house based on available data from other homes.

Accessing the Simple ML for Sheets sidebar, click on 'Predict missing values'. The algorithm will have already identified the value to predict. Otherwise, you can independently select both the column containing the value to predict (column with empty cells) and the factors to consider to train the machine learning model (source column).

At this point, you can select the algorithm to use and click on 'Predict' to obtain the missing values.

N.B. This example is based on 10 lines, the higher the values and the greater the accuracy of the output.

Once the prediction is complete, a column will be created containing the predicted values.

Identify abnormal values

In statistics, 'outliers' are outliers that differ significantly from other data. Identifying them is critical to ensuring data accuracy, improving statistical analysis, and making informed decisions.

In the Simple ML for Sheets sidebar, by selecting “Spot abnormal values” you will be able to identify the abnormal values. For example, in the case of houses, I set the price of a house significantly higher than the average of the other values.

At this point, as with the prediction of missing values, you must select the column in which to search for the abnormal value (Column with abnormal values) and indicate the columns that influence the determination of the value to search for (Source columns). All unselected columns will be excluded from training the machine learning model to identify the outlier.

By clicking on “Spot abnormal values”, the algorithm will generate two columns: the first column returns a value between 0 and 1, where 0 indicates that the value is normal and 1 that the value is abnormal; the second column indicates the most probable value according to the algorithm. In this case, our outlier has been classified as 80% abnormal and its most likely value is 424,000 dollars.

Predict Future Values

This case study is particularly interesting and slightly more complex than the previous ones, since the algorithm requires more details.

In the Simple ML for Sheets sidebar, by selecting 'Forecast future values' you can get forecasts of future data based on the historical results collected so far. For example, I created a table with fictitious hypothetical sales data for a certain period of time, leaving the sales value unfilled in some rows, which represent precisely the values I want to predict.

In this example, we have the following columns: dates, number of sales, price, number of promotional campaigns carried out, season and any special events.

In 'Columns to forecast', indicate the columns you want to predict; in this case, I selected the 'Price' column. Next, if you are not an expert in machine learning, I recommend that you set the advanced options as shown in the image below. In this way, the algorithm will be able to choose most of the parameters independently, based on the dataset.

A final value that is important to pay attention to is the 'Holiday' field. From the drop-down menu, select the region where your data comes from: if the data is global, choose 'Global'; otherwise, select the appropriate region. In my case, I chose 'Europe'.

Once you click on 'Forecast', a column will be generated containing the forecast values assumed by the machine learning model.

In addition, the tool generates an intuitive graph that shows sales made in blue and sales forecasts in red. This allows you to clearly view the prediction made by the algorithm.

In conclusion

As we have seen, there are very simple tools to use that can help you make strategic decisions using advanced technologies such as machine learning and artificial intelligence. For example, you can use a database with data from a year of sales to predict how the number of sales would change as the price changes, or estimate the best price to propose to achieve a certain number of sales. The use cases are endless, and the technology is now available to everyone.

Good work

🚀 Ti potrebbe interessare anche questo articolo: