The increasing prevalence of Internet of Things (IoT) systems has brought about significant security concerns. Cyber-attacks, including denial-of-service attacks, malware infections, and phishing attempts, pose serious threats to the integrity and functionality of IoT networks. To ensure comprehensive protection, it is essential to develop machine learning-based security measures that employ robust models and integrate multiple security mechanisms. In this study, a Ridge Classifier is utilized as a powerful model to detect anomalies in IoT systems. By leveraging this approach, the proposed security system can accurately identify and predict cyber-attacks in real-time, utilizing secure and up-to-date information from the network. The integration of machine learning techniques enhances the system's ability to detect and mitigate threats effectively. Experimental results demonstrate the high accuracy of the proposed system in detecting and mitigating network threats in IoT systems, achieving a remarkable accuracy rate of 97 percent. This level of accuracy not only improves the security and resilience of government and business networks but also ensures the protection of valuable data from malicious threats. The development of machine learning-based security measures, such as the system presented in this study, is crucial for addressing the security challenges faced by IoT systems. By accurately detecting and predicting cyber-attacks, these measures play a pivotal role in safeguarding the integrity, confidentiality, and availability of IoT networks. Furthermore, the integration of robust models and the incorporation of multiple security measures provide a comprehensive defense against a wide range of threats. In conclusion, the implementation of machine learning-based security measures, particularly utilizing the Ridge Classifier model, offers significant benefits in protecting IoT systems. By effectively detecting and mitigating network threats with high accuracy, these measures contribute to improving the security and resilience of government and business networks. Moreover, the protection of data from malicious threats ensures the integrity and confidentiality of IoT systems, fostering trust and reliability in the rapidly expanding IoT landscape.