liu.seSearch for publications in DiVA
Change search
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • oxford
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf
Improved Contrastive Predictive Coding for Time Series Out-Of-Distribution Detection Applied to Human Activity Data
Linköping University, Department of Computer and Information Science, The Division of Statistics and Machine Learning. Linköping University, Faculty of Science & Engineering.ORCID iD: 0000-0001-7411-2177
Linköping University, Department of Computer and Information Science, The Division of Statistics and Machine Learning. Linköping University, Faculty of Science & Engineering.ORCID iD: 0000-0003-3749-5820
2025 (English)In: Pattern Recognition Letters, ISSN 0167-8655, E-ISSN 1872-7344, Vol. 197, p. 132-138Article in journal (Refereed) Published
Abstract [en]

Contrastive Predictive Coding (CPC) is a well-established self-supervised learning method that naturally fits time series data. This method has been recently leveraged to detect anomalous inputs, viewed as the task of classifying positive pairs of context-feature representations versus negative ones in order to employ classifier uncertainty measures. In this paper, by taking a different perspective, we propose a CPC-based Out-Of-Distribution (OOD) detection method for time series data that does not require any negative samples at test time and is theoretically related to a probabilistic type of uncertainty estimation in the latent representation space. Our method extends the standard CPC by using a radial (distance-based) score function both in the training loss and as the OOD measure, in addition to quantizing the context (replacing it by cluster prototypes) during inference. The proposed method is applied to detecting OOD human activities with smartphone sensors data and shows promising performance on two primary datasets without using activity labels in training.

Place, publisher, year, edition, pages
ELSEVIER , 2025. Vol. 197, p. 132-138
Keywords [en]
Out-Of-Distribution/anomaly/novelty; detection; Self-supervised machine learning; Contrastive learning; Human activity recognition; Time series analysis; Deep learning
National Category
Computer Sciences
Identifiers
URN: urn:nbn:se:liu:diva-217248DOI: 10.1016/j.patrec.2025.07.011ISI: 001545804100001Scopus ID: 2-s2.0-105012301703OAI: oai:DiVA.org:liu-217248DiVA, id: diva2:1994850
Note

Funding Agencies|Swedish Research Council [2024-05011]; Wallenberg AI, Autonomous Systems and Software Program (WASP) - Knut and Alice Wallenberg Foundation; Excellence Center at Linkoeping-Lund in Information Technology (ELLIIT)

Available from: 2025-09-03 Created: 2025-09-03 Last updated: 2025-12-18
In thesis
1. Handling Novel and Out-Of-Distribution Data in Deep Learning: OOD Detection and Shortcut Mitigation
Open this publication in new window or tab >>Handling Novel and Out-Of-Distribution Data in Deep Learning: OOD Detection and Shortcut Mitigation
2025 (English)Doctoral thesis, comprehensive summary (Other academic)
Abstract [en]

Advancements in machine learning, and particularly deep learning, have revolutionized the real-world applications of artificial intelligence in recent years. A main property of deep neural models is their ability to learn a task based on a set of examples, that is, the training data. Although the state-of-the-art performance of such models is promising in many tasks, this of-ten holds only as long as the inputs to the model are “sufficiently similar” to the training data. Mathematically, a ubiquitous assumption in machine learning studies is that the test data used for evaluating a model are sampled from the same probability distribution as the training data. It is challenging to approach any problem where this assumption is violated, as it requires handling Out-Of-Distribution (OOD) data, i.e., data points that are systematically different from the training (in-distribution) data. In particular, one might be interested in detecting OOD inputs at test time given an unlabeled training set, which is the main problem explored in this thesis. This type of OOD detection (a.k.a. novelty/anomaly detection) has various applications in discovering unusual events and phenomena as well as improving safety in AI systems. Another challenging problem in deep learning is that a model might rely on certain trivial relations (spurious correlations) existing in training data to solve a task. Such “shortcuts” can bring a high performance on in-distribution data, but they may collapse on more realistic OOD data. It is therefore vital to mitigate the shortcut learning effects in deep models, which is the second topic studied in this thesis.

A part of the present thesis is concerned with leveraging pretrained deep models for OOD detection on images, without modifying their standard training algorithms. A method is proposed to use invertible (flow-based) generative models based on null hypothesis testing ideas, leading to an OOD detection method that is fast and more reliable than the traditional likelihood-based method. Diffusion (score-based) models are another type of modern generative models used for OOD detection in this thesis, in combination with pretrained deep encoders. Another contribution of the thesis is in leveraging the power of large self-supervised models in fully unsupervised fine-grained OOD detection. It is shown that the simple k-nearest neighbor distance in the representation space of such models results in a reasonable performance but can be boosted substantially through the proposed adjustments, without any model fine-tuning. The local geometry of representations and background (irrelevant) features are considered to this end.

OOD detection with time series data is another problem studied in this thesis. Specifically, a method is proposed based on Contrastive Predictive Coding (CPC) self-supervised learning, and applied to detect novel categories in human activity data. It is demonstrated, both empirically and through theoretical motivation, that modifying the CPC to use a radial basis function instead of the conventional log-bilinear function is a requirement for reliable and efficient OOD detection. This extension is combined with quantization of representation vectors to achieve better performance.

This thesis also addresses the problem of learning deep representations (transfer learning) in a situation where a shortcut exists in data. In this problem, a deep model is trained on a shortcut-biased image dataset to solve a self-supervised or supervised classification task. The representations learned by this model are used to train a smaller model on a related but different downstream task, and the adverse effect of the shortcut is verified empirically there. Moreover, a method is proposed to enhance the representation learning in this scenario, based on an auxiliary model trained in an adversarial manner along with the upstream classifier.

Place, publisher, year, edition, pages
Linköping: Linköping University Electronic Press, 2025. p. 76
Series
Linköping Studies in Science and Technology. Dissertations, ISSN 0345-7524 ; 2445
National Category
Artificial Intelligence
Identifiers
urn:nbn:se:liu:diva-212978 (URN)10.3384/9789181180749 (DOI)9789181180732 (ISBN)9789181180749 (ISBN)
Public defence
2025-05-16, Ada Lovelace, B-building, Campus Valla, Linköping, 09:30 (English)
Opponent
Supervisors
Available from: 2025-04-14 Created: 2025-04-14 Last updated: 2025-09-09Bibliographically approved

Open Access in DiVA

fulltext(1125 kB)139 downloads
File information
File name FULLTEXT01.pdfFile size 1125 kBChecksum SHA-512
dac0261ba2069760af58fc7ec7424c27b2785ae564a4e3edffc71862696979374ff82bdfa27571718c1108d38fbecf4ef8fd0ba91f19adf5259d75df6b551c47
Type fulltextMimetype application/pdf

Other links

Publisher's full textScopus

Authority records

Ahmadian, AmirhosseinLindsten, Fredrik

Search in DiVA

By author/editor
Ahmadian, AmirhosseinLindsten, Fredrik
By organisation
The Division of Statistics and Machine LearningFaculty of Science & Engineering
In the same journal
Pattern Recognition Letters
Computer Sciences

Search outside of DiVA

GoogleGoogle Scholar
Total: 139 downloads
The number of downloads is the sum of all downloads of full texts. It may include eg previous versions that are now no longer available

doi
urn-nbn

Altmetric score

doi
urn-nbn
Total: 257 hits
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • oxford
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf