Once you have 30 days of data from your freezer, you're ready to train a custom Machine Learning (ML) model! The goal of this model is to warn you before a freezer fails, giving you time to address the failure prior to losing critical work. To do this we'll use an auto-encoder algorithm.
We'll use Python to train the model. If you're new to Python, check out this guide for a quick introduction.
We'll also use several machine learning Python libraries. We recommend using these in a virtual environment as this will keep your global installation of Python clean and keep all the dependencies for this project in one place.
Download the autoencoder_training.ipynb and either the win_python_venv.bat file for Windows or the mac_linux_python_venv.sh for Mac or Linux files from this repo. You may already have them if you cloned the repo in the previous step.
You'll also need to install Python. Follow the links below to install Python for your appropriate operating system.
You can use VS Code to view and run the Jupyter notebook that contains the anomaly detection training code. The notebook uses interactive Python, which walks you through the steps of the training the model. This guide will walk you through how to navigate Jupyter notebooks in VS Code Use this link to download and install VS Code. After you install VS Code you will also need to install the Python extension.
First open the Jupyter notebook in VS Code. Then open the terminal by pressing
ctrl + shift + ` in the new terminal window type
mac_linux_python_venv.sh and press enter.
The rest of the tutorial is in the Jupyter notebook, make sure the new virtual environment you created is activated.
An autoencoder is a type of compression algorithm that works well on the type of data it's trained on, but not so well on any other data. For anomaly detection, you can use this characteristic of the algorithm to check whether new data is similar to or different than the training data used.
The model is built using two parts: 1) an encoder, which compresses the data, and 2) a decoder, which decompresses the data. Decompression allows you to check the accuracy of the re-created data. A high error rate in re-created data is likely an anomaly.