diff --git a/thesis/main.tex b/thesis/main.tex index 932625a..d76805f 100644 --- a/thesis/main.tex +++ b/thesis/main.tex @@ -25,25 +25,25 @@ \includegraphics[width=7cm]{leipzig_university_logo}\\[1cm] % Adjust size as needed - {\huge \textbf{Finding Predictors for Human Ovulation with Attention Mechanisms}}\\[1.5cm] + {\huge \textbf{Ovulation Prediction with Machine Learning}}\\[1.5cm] \textbf{Master’s Thesis}\\[1cm] \textbf{Author:}\\ Alexander Blank\\[0.5cm] - \textbf{Supervisor(s):}\\ - Prof. XYZ, Dr. ABC\\[1.5cm] + \textbf{Supervisor:}\\ + Prof. Bogdan Franczyk\\[1.5cm] - \textbf{Date:} 2025\\[2cm] + \textbf{Date:} September 2025\\[2cm] - \textbf{Department of XYZ}\\ + \textbf{Master of Science: Data Science}\\ \textbf{Leipzig University} \end{titlepage} \pagebreak \begin{abstract} - This paper investigates the use of attention mechanisms to predict human ovulation. The results show that the attention mechanism is able to predict human ovulation with an accuracy of 95\%. + This could be your abstract - call 0800 - ABSTRACT to get your personal quote. \end{abstract} \pagebreak diff --git a/thesis/resources/figures/methodology_padding_example.png b/thesis/resources/figures/methodology_padding_example.png new file mode 100644 index 0000000..e72a462 Binary files /dev/null and b/thesis/resources/figures/methodology_padding_example.png differ diff --git a/thesis/resources/figures/methodology_target_features.png b/thesis/resources/figures/methodology_target_features.png new file mode 100644 index 0000000..a8e045c Binary files /dev/null and b/thesis/resources/figures/methodology_target_features.png differ diff --git a/thesis/sections/background.tex b/thesis/sections/background.tex index d9e7229..240fed4 100644 --- a/thesis/sections/background.tex +++ b/thesis/sections/background.tex @@ -48,12 +48,12 @@ However, variations, particularly in the follicular phase length, are common and Figure~\ref{fig:background_menstrual_cycle_physiology} provides a detailed overview of the hormonal and physiological changes throughout the menstrual cycle. -\begin{figure}[htb] - \centering - \includegraphics[width=0.9\textwidth]{background_labeled_cycle} - \caption{A cycles temperature curve with its phases and ovulation} - \label{fig:background_labeled_cycle} -\end{figure} +%\begin{figure}[htb] +% \centering +% \includegraphics[width=0.9\textwidth]{background_labeled_cycle} +% \caption{A cycles temperature curve with its phases and ovulation} +% \label{fig:background_labeled_cycle} +%\end{figure} Figure~\ref{fig:background_labeled_cycle} shows the temperature curve over the course of a menstrual cycle with the menstruation, fertile phase and ovulation marked. diff --git a/thesis/sections/discussion.tex b/thesis/sections/discussion.tex index 4c19be2..d053ac6 100644 --- a/thesis/sections/discussion.tex +++ b/thesis/sections/discussion.tex @@ -8,6 +8,7 @@ % talk about whether bbt / temperature can be used for such a task, discuss bbt doubt papers % While previous work has argued against the predictive value of BBT~\cite{some_author_2010}, our findings suggest otherwise. %Using continuous core body temperature data from 40,000 cycles, we demonstrate that temperature-based models can reliably detect ovulatory patterns, even in the presence of physiological noise or mild irregularity. +% explain the need for further medical interpretation of the results of either model \section{Future Work}\label{sec:future_work} diff --git a/thesis/sections/methodology.tex b/thesis/sections/methodology.tex index 2f941ae..44accb2 100644 --- a/thesis/sections/methodology.tex +++ b/thesis/sections/methodology.tex @@ -125,12 +125,12 @@ These help the model place each observation in temporal context: Except for \textit{time since cycle start}, all features are encoded using sine and cosine transforms to preserve their cyclical nature and make them more interpretable for the model. -\begin{figure}[htbp] - \centering - \includegraphics[width=0.9\textwidth]{methodology_time_feature_sine_encoded} - \caption{Sine and cosine encoding of the day-of-week feature.} - \label{fig:methodology_time_feature_encoding} -\end{figure} +%\begin{figure}[htbp] +% \centering +% \includegraphics[width=0.9\textwidth]{methodology_time_feature_sine_encoded} +% \caption{Sine and cosine encoding of the day-of-week feature.} +% \label{fig:methodology_time_feature_encoding} +%\end{figure} Figure~\ref{fig:methodology_time_feature_encoding} illustrates the sine and cosine encoding of the day-of-week feature. The cyclical nature of the variable is clearly visible in the transformation. @@ -144,16 +144,53 @@ Including this information could therefore improve the predictive quality of the \subsubsection{Observable Features}\label{subsubsec:observable_features} -The observable features constitute the input features that are directly observable, but only until the current moment. +Observable features include all time-series inputs available up to the current time step. +They represent real-time physiological signals from which the model must infer ovulatory status. \begin{itemize} - \item \textbf{Temperature} - the raw temperature as recorded by the OvulaRing sensor - \item \textbf{Rolling Average Temperature} - the rolling average of the temperature over 1 day (288 measurements) - \item \textbf{Rolling Window Temperature Minimum} - the minimum temperature over a rolling window of 1 day - \item \textbf{Rolling Window Temperature Maximum} - the maximum temperature over a rolling window of 1 day + \item \textbf{Temperature} — Raw intravaginal temperature as recorded by the OvulaRing sensor, sampled every 5 minutes. + \item \textbf{Rolling Average Temperature} — The mean temperature over a 1-day (288-sample) sliding window, linearly interpolated to preserve the original input resolution. + \item \textbf{Rolling Window Temperature Minimum} — The minimum temperature observed within a 1-day window, highlighting potential overnight lows or phase-specific dips. + \item \textbf{Rolling Window Temperature Maximum} — The maximum temperature within a 1-day window, capturing transient peaks or elevated plateaus. \end{itemize} -% table with all features +These derived features are intended to reduce model complexity by providing smoothed or extremal summaries of the raw signal. +The \textit{rolling average} allows the model to capture broader trends without having to learn temporal aggregation from scratch. +The \textit{rolling minimum} and \textit{maximum} support the detection of boundary behavior (e.g., temperature shifts, sustained elevation, extreme values) +without requiring explicit memory or aggregation. + +The 1-day window length reflects the expected circadian cycle and strikes a balance between temporal sensitivity and signal stability. + +\subsubsection{Target Features} + +Target features represent the outputs that the models are trained to predict. +These can include exogenous biological outcomes or interpretable derivatives of input features. + +\begin{itemize} + \item \textbf{Fertility / Pregnancy Probability} — The estimated probability of conception from unprotected intercourse on the current day. + \item \textbf{Ovulation-Over Indicator} — A binary variable indicating whether ovulation has already occurred in the current cycle. +\end{itemize} + +\begin{figure}[htbp] + \centering + \includegraphics[width=0.9\textwidth]{methodology_target_features} + \caption{ + Target features plotted for a single cycle. + The ovulation-over indicator switches on the day of ovulation; + the fertility probability follows a curve based on known day-specific fecundability~\cite{dunson_day-specific_1999}. + } + \label{fig:methodology_target_features} +\end{figure} + +The combination of these two targets is intended to provide the user with both physiological and practical insight: +\textit{Fertility probability} conveys the likelihood of conception, but alone does not indicate whether ovulation is yet to come or has already passed. +A fertility probability near zero could mean that ovulation is either in the past or still ahead—information the model alone cannot disambiguate. + +The \textit{ovulation-over indicator}, by contrast, explicitly marks the post-ovulatory phase, but does not describe conception risk. +Together, the two outputs offer complementary information and improve interpretability for real-time user-facing applications. + +As discussed in Section~\ref{sec:discussion}, all predictions are subject to further interpretation before presentation in the product interface. +The model outputs represent data-driven estimates and do not constitute medical advice or diagnostic statements. \subsection{Time-Series Modeling Approach}\label{subsec:time-series_modeling_approach} @@ -161,6 +198,51 @@ The observable features constitute the input features that are directly observab % build in the probability curve for the pregnancy chance +\subsubsection{Sequence Representation and Sampling} +\label{subsubsec:input_sequence_construction} + +Due to the high temporal resolution of the temperature data (288 measurements per day), raw input sequences can become prohibitively long for most model types. + +To manage input size and evaluate the impact of temporal resolution on predictive performance, a parameterized resampling strategy is applied. +Consecutive time steps are aggregated into bins of configurable size, and each bin is reduced to a single value using a feature-specific aggregation function. + +For most continuous features, the \texttt{mean} is used. +For cyclic or categorical features—such as \textit{day of the week}— the \texttt{max} or \texttt{mode} is applied to avoid introducing +artifacts at bin boundaries, where values from distinct categories (e.g., hours 23 and 0) might otherwise be averaged into a nonexistent intermediate state. + +The effect of different sampling resolutions and aggregation strategies is evaluated in Section~\ref{sec:results}. + +To simulate real-time prediction rather than retrospective analysis, a sliding-window approach is employed. +This allows the model to make partial predictions based on the data available up to a certain point in the cycle. + +Each cycle is split into overlapping input windows, where each window includes data from the start of the cycle up to a specific day. +The window length is fixed and configurable. +As the cycle progresses, the window slides forward, allowing the model to incorporate increasing historical context over time. + +This setup enables temporally resolved predictions at different stages of the cycle and supports evaluation of how predictive accuracy changes with increasing context. + +\begin{figure}[htbp] + \centering + \includegraphics[width=0.9\textwidth]{methodology_padding_example} + \caption{ + Padded input window during early cycle phases, + where historical data is still sparse. + } + \label{fig:methodology_padding_example} +\end{figure} + +Fixed-length input windows would normally prevent early-cycle predictions when insufficient data is available. +To address this, left-padding is applied using masked values. + +In this study, predictions are enabled once at least 4 days of data are available. +A padding value of 0.0 is used for all features, and the padding length is adjusted accordingly. +This choice ensures that the model learns to ignore tokens consisting entirely of padding. + +The feature \textit{hours since start}, which encodes the time elapsed since cycle onset, will be zero for all padded tokens—explicitly indicating +that these entries contain no meaningful information. + +Figure~\ref{fig:methodology_padding_example} shows an example of such padding during early-cycle input preparation. + \subsection{Model Training}\label{subsec:model_training} \subsubsection{Training Setup}\label{subsubsec:training_setup}