I started to study machine learning and bought the book Machine Learning Quick Reference, in one of the samples I saw this code and decided to rewrite it, but in the end it give