A deep learning approach for intrusion detection in Internet of Things using focal loss function

Ayesha S. Dina, A. B. Siddique, D. Manivannan

Research output: Contribution to journalArticlepeer-review

34 Scopus citations


Internet of Things (IoT) is likely to revolutionize healthcare, energy, education, transportation, manufacturing, military, agriculture, and other industries. However, for the successful deployment of IoT in various industries, methods for detecting and preventing security breaches need to be designed and implemented. Over the past decade, a number of researchers in academia and industry have used Machine Learning (ML) techniques to design and implement Intrusion Detection Systems (IDSes) for computer networks in general; however, not much work has been done for intrusion detection in IoT. Datasets collected by various organizations were used by many of these researchers to train ML models for predicting intrusions. It is common for datasets used in such systems to be imbalanced (i.e., not all classes have equal number of samples). Predictive models developed using machine learning algorithms can produce unsatisfactory results if imbalanced datasets are used for training the models. To remedy this problem, techniques such as random oversampling and undersampling do not produce robust models. Furthermore, ML models trained using traditional loss functions, such as cross-entropy loss, fail to accurately predict minority class instances. To overcome the data imbalance problem for intrusion detection in IoT, we leverage the specialized loss function, called focal loss, that automatically down-weighs easy examples and focuses on the hard negatives by facilitating dynamically scaled-gradient updates for training effective ML models. We implemented our approach using two well-known Deep Learning (DL) neural network architectures. We conducted extensive experimental evaluations using three datasets from diverse IoT domains and compared our proposed approach with state-of-the-art intrusion detection models. We found that, our approach (training DL models using focal loss function) performed better with respect to accuracy, precision, F1 score and MCC score by as much as 24%, 39%, 39%, and 60%, respectively, compared to training them on the same datasets using cross-entropy loss function. We also compare our approach with two other state-of-the-art approaches and show that our approach performs better than these state-of-the-art approaches.

Original languageEnglish
Article number100699
JournalInternet of Things (Netherlands)
StatePublished - Jul 2023

Bibliographical note

Publisher Copyright:
© 2023 Elsevier B.V.


  • Cyber security
  • Data imbalance problem
  • Deep learning
  • Internet of Things
  • Intrusion detection
  • Loss functions

ASJC Scopus subject areas

  • Software
  • Computer Science (miscellaneous)
  • Information Systems
  • Engineering (miscellaneous)
  • Hardware and Architecture
  • Computer Science Applications
  • Artificial Intelligence
  • Management of Technology and Innovation


Dive into the research topics of 'A deep learning approach for intrusion detection in Internet of Things using focal loss function'. Together they form a unique fingerprint.

Cite this