Machine Learning Meets Internet of Things: From Theory to Practice