Machine Learning for the Internet of Things: Applications, Implementation, and Security