Congratulations, you have created your very own machine learning model! Machine learning requires an enormous amount of computation, which is why it has only been developed since computers became cheap and fast. The calculations used by the Google Teachable Machine models and other machine learning models are far larger and more complex than what we have done here, but the idea is pretty similar. To make a prediction, the teachable machine looks through all the data and determines which class is “closest” to the current observation. Machine learning algorithms differ by how they separate the classes and how they compute what is “closest.”
Since you have used the getOrientation() method in Python, you may be wondering if that function uses a similar model. That method does not use machine learning, it uses if statements and thresholds to determine the position of the Finch from the acceleration values. This is less computationally intensive and doesn’t require training data. However, even though the model used here is not the easiest way to determine the position of the Finch, it does provide a good simple example of how the nearest neighbor algorithm works.