%! Author = alex %! Date = 3/6/25 \section{Introduction}\label{sec:introduction} Reproductive health and fertility prediction are of increasing importance at both the individual and societal level. Globally, maternal age at first pregnancy continues to rise, driven by social and economic factors~\cite{sauer_reproduction_2015}. This trend increases the prevalence of cycle irregularity and subfertility, amplifying the need for reliable, non-invasive methods of fertility tracking. At the same time, many individuals seek alternatives to hormonal contraception, fueling the growth of so-called \emph{FemTech} applications for digital health. Accurate fertility prediction thus carries implications not only for individual reproductive autonomy, but also for public health, demographic trends, and the development of safe, data-driven fertility support tools. While textbooks often describe a menstrual cycle as lasting 28 to 30 days with ovulation around day 14~\cite{owen_physiology_1975}, such regularity is the exception rather than the rule~\cite{munster_length_1992, bull_real-world_2019}. For individuals with consistent cycle patterns, simple calendar-based predictions may suffice. However, for the majority, especially with increasing age and associated irregularity, more sophisticated methods are necessary. This, combined with the rising maternal age in industrialized and industrializing countries, underscores the growing demand for accurate, individualized menstrual cycle prediction methods~\cite{sauer_reproduction_2015}. For many individuals, the practical use cases of menstrual cycle monitoring are \emph{Natural Family Planning} (NFP) and contraception~\cite{earle_use_2021}. For these use cases, it is essential to identify the ovulation and its corresponding fertile and infertile days in a cycle, to either avoid or achieve pregnancy more effectively. Ovulation, the release of an egg cell from the ovaries, is triggered by hormonal changes and accompanied by physiological shifts such as changes in cervical mucus and a rise in body temperature~\cite{wallach_prediction_1980}. These processes remain incompletely understood and are influenced by lifestyle factors such as stress, diet, exercise, or health-related conditions such as Polycystic Ovary Syndrome (PCOS), making ovulation difficult to predict. In theory, these physiological changes provide a basis for predicting ovulation and the surrounding fertile window. In practice, however, many of these signals are difficult to measure continuously, as they require invasive procedures, manual tracking, or costly equipment. Body temperature, by contrast, is a non-invasive marker that can be measured continuously using intravaginal, wrist-worn, or ear-worn thermometers. While some studies have deemed body temperature unusable for predictive analysis~\cite{bauman_basal_1981}, others suggest its predictive value for ovulation~\cite{sato_novel_2024, royston_identifying_1991, luo_detection_2020, alexander_fertilitatsmonitoring_2014, luz_improved_2024, yu_tracking_2022, pratikno_pdf_2024}. However, most existing studies rely on small, idealized datasets that exclude cycles with irregular lengths or late ovulation. While such restrictions simplify the prediction task and yield high accuracy, they give a misleading impression of real-world model performance. It is thus not yet fully clear whether temperature can reliably be used as a predictive marker for ovulation or fertility. Additionally, other studies have focused on peripheral temperature measurements of skin or in-ear temperature, which are subject to many sources of noise that can significantly affect the quality of the resulting predictions. To date, no study has systematically evaluated machine learning architectures on a large-scale, high-resolution dataset of intravaginal core body temperature across both regular and irregular cycles. Such an evaluation is crucial to determine whether temperature-based models can provide robust predictions under real-world variability, rather than only on highly regular, curated subsets of data. Intravaginal temperature reflects true core body temperature and offers higher resolution and stability, as it is largely unaffected by external circumstances. This allows for more reliable detection of subtle thermal shifts associated with ovulation, especially in irregular cycles. This study aims to advance fertility prediction by leveraging an extensive database of more than 40,000 menstrual cycles, covering cycle lengths 11 to 149 days and ovulation days ranging from 7 to 136, recorded using an intravaginal wearable device that continuously measures core body temperature at a resolution of 288 measurements per day. The objective is to develop a machine learning model that predicts the fertility for any given day and performs reliably across diverse cycle types, including irregular ones. To this end, I will compare a set of time series-based machine learning architectures and evaluate their performance for NFP and contraception. This thesis addresses this gap by providing the first large-scale, systematic comparison of LSTM and Transformer architectures on high-resolution intravaginal temperature data. It evaluates robustness across diverse cycle types and demonstrates their practical relevance for contraception and NFP\@. The main research objective is to evaluate the fundamental feasibility of predicting fertility and ovulation from body temperature data using machine learning, with a focus on how prediction performance varies across menstrual cycle types and real-world use cases. These objectives support the broader question of whether temperature-based models can provide robust predictions across real-world variability in cycle patterns and user needs: \begin{itemize} \item To train and evaluate a set of machine learning models for ovulation and fertility prediction, using standard performance metrics such as MAE and MSE\@. \item To identify influential factors and patterns that affect the prediction. \item To compare prediction performance across regular and irregular cycles to assess how cycle variability affects feasibility. \item To evaluate model outputs in the context of practical use cases, such as contraception and natural family planning, using task-specific evaluation criteria. \end{itemize}