started methodology

This commit is contained in:
Alex Blank
2025-07-02 16:09:56 +02:00
parent c8cfb7610c
commit 584fb15951
4 changed files with 1635 additions and 1570 deletions
+1549 -1544
View File
File diff suppressed because one or more lines are too long
+3
View File
@@ -40,6 +40,8 @@ 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.
%TODO: implement a graph of a "normal" cycle with labeled phases for a better understanding of its structure
\begin{figure}[htbp]
\centering
\includegraphics[width=0.6\textwidth]{background_menstrual_cycle_physiology}
@@ -153,6 +155,7 @@ an intravaginal wearable sensor developed by VivoSensMedical GmbH, located in Le
The device continuously records intravaginal core body temperature at 5-minute intervals.
The sensor itself measures approximately 1\,cm $\times$ 1\,cm $\times$ 2\,cm and is embedded in a silicone ring with a diameter of 5\,cm for ease of use.
It pairs with a smartphone via Bluetooth to synchronize and upload recorded data to a secure database.
Figure~\ref{fig:background_ovularing} shows an image of the ring attached to its silicone ring.
The product has been on the market for over a decade, resulting in an extensive longitudinal dataset of menstrual cycles.
Cycle boundaries are defined by self-reported menstruation, which users manually log in the accompanying app to mark the beginning of each cycle.
+41 -14
View File
@@ -1,14 +1,15 @@
%! Author = alex
%! Date = 3/6/25
\section{Methodology}\label{sec:methodology}
% why did I select tft over other methods -> include examples of time series and why I belief a complex model could help
% you did I apply it
% implementation details
\subsection{Data Collection \& Preprocessing}\label{subsec:data_collection_preprocessing}
\subsubsection{Data Collection}\label{subsubsec:data_collection}
The dataset used in this work was collected by \textit{VivoSensMedical GmbH}, a medical technology company based in Leipzig, Germany,
specializing in fertility tracking devices and applications.
@@ -32,6 +33,7 @@ Not all cycles in the dataset can be used for training.
Cycles that are too short are excluded, as they usually do not contain enough information to make reliable predictions.
Additionally, cycles that are too long are also excluded, as they might contain multiple ovulation events or
pregnancies, which would make the prediction task ambiguous.
\subsubsection{Feature Engineering}\label{subsubsec:feature_engineering}
%TODO: show that a model without marker context and one with them is trained, to show the impact of the markers
@@ -47,33 +49,58 @@ pregnancies, which would make the prediction task ambiguous.
% explain why class imablances are there, and what I did to counteract this, also explain, why special weighting is useful for something like the pregnancy risk prediction
% show the work that needed to be done for inference -> padding values for future observables
\subsubsection{Data Labeling}\label{subsubsec:data_labeling}
Supervised machine learning requires labeled data—i.e., known target values for each input.
In the context of this study, the relevant target is the ovulation day within each menstrual cycle.
The dataset contains over 40{,}000 cycles, making manual annotation unfeasible.
Instead, a retrospective ovulation detection algorithm is employed to assign labels:
(1) whether a cycle is ovulatory or anovulatory, and
(2) if ovulatory, the estimated day of ovulation.
This labeling algorithm was developed in collaboration with a gynecologist and reproductive medicine specialist.
It is trained on a curated reference set of cycles with expert-assigned labels based on domain knowledge and characteristic temperature patterns.
The algorithm operates in two stages:
\begin{enumerate}
\item \textbf{Cycle classification:} Each cycle is classified as either monophasic (anovulatory) or biphasic (ovulatory), based on the presence of a luteal-phase temperature shift.
\item \textbf{Ovulation estimation:} For biphasic cycles, the most likely day of ovulation is identified retrospectively using the full temperature curve.
\end{enumerate}
This retrospective labeling provides a practical and scalable proxy for ground truth, enabling training and evaluation across a large, real-world dataset,
especially, as temperature is at least an excellent retrospective marker for ovulation.
%TODO: provide statistics for the retrospective algorithm
These labels are then used as ground truth labels for the prediction algorithms.
We are aware of potential shortcomings with this approach.
We acknowledge that this approach introduces some label noise—particularly in edge cases where temperature signals are
ambiguous or distorted (e.g., illness, missed measurements).
These inaccuracies may propagate into the predictive models.
However, label quality is continuously reviewed and can be refined as part of future model iterations.
The usage of the ovulation day labels in the model input features is documented in section~\ref{subsubsec:input_output_modeling}
% show, that for very regular cycles, no sophisticated methods are necessary
Notes for training:
- one head 512 hidden size make very "smoothed" out curves, which result in ver conservative predictions
Intermediate training results:
- first full training:
- first feature config with ov over and fertility did not show much promise, as it detected the ov too late, essentially when it was already over
- either there is no patterns detectable in advance, or there are not enough features yet
- soft of "soft ceiling" at 0.3 loss, many models get there quickly and then "bounce" around
\subsection{Time-Series Modeling Approach}\label{subsec:time-series_modeling_approach}
\subsubsection{Limitations of Traditional Time-Series Models}\label{subsubsec:limitations_of_traditional_time-series_models}
\subsubsection{Temporal Fusion Transformer}\label{subsubsec:temporal_fusion_transformer}
\subsubsection{Input \& Output Modeling}\label{subsubsec:input_output_modeling}
% build in the probability curve for the pregnancy chance
\subsection{Model Training}\label{subsec:model_training}
\subsubsection{Training Setup}\label{subsubsec:training_setup}
\subsubsection{Hyperparameter Tuning}\label{subsubsec:hyperparameter_tuning}
\subsubsection{Training Details}\label{subsubsec:training_details}
\subsection{Evaluation}\label{subsec:evaluation}
\subsubsection{Evaluation Metrics}\label{subsubsec:evaluation_metrics}
\subsubsection{Baseline Comparisons}\label{subsubsec:baseline_comparisons}
\subsubsection{Explainability \& Interpretability}\label{subsubsec:explainability_interpretability}
+42 -12
View File
@@ -5,13 +5,28 @@
\section{Related Work}\label{sec:related_work}
There has been a variety of works in menstrual cycle analysis.
\subsection{Body Temperature}
\subsection{Temperature-Based Approaches}\label{subsec:temperature_based_approaches}
\citeauthor{luo_detection_2020} used an in-ear wearable device that measured ear canal temperature every five minutes during sleep~\cite{luo_detection_2020}.
Several studies have questioned the utility of BBT (Basal Body Temperature) for reliable ovulation prediction.
For example \citeauthor{bauman_basal_1981} concluded, that BBT is not a robust standalone marker due to its
retrospective nature and sensitivity to external factors and thus must be used with extreme caution clinical or research evaluations~\cite{bauman_basal_1981}.
However, such conclusions were largely based on the standard BBT method, which relies on a single-point measurement taken
immediately upon waking—typically reflecting the body's lowest resting temperature.
In contrast, this study, along with several recent works, leverages continuous or high-resolution temperature data collected during sleep or throughout the day.
This richer signal provides a more robust foundation for detecting ovulatory patterns and addresses many of the limitations historically associated with BBT-based methods.
This was further supported by a study from \citeauthor{zhu_accuracy_2021}, who compared the accuracy and sensitivity of traditional BBT measurements with continuous skin temperature recordings from a wrist-worn device~\cite{zhu_accuracy_2021}.
They found that continuous temperature measurements had significantly higher sensitivity in detecting ovulation, though at the cost of increased false positives and lower specificity.
Importantly, the continuous data showed a greater average temperature difference between the follicular and luteal phases.
The authors conclude that for women seeking to optimize their chances of conception, continuous temperature tracking offers measurable benefits—primarily due to improved phase delineation enabled by the richer signal.
The predictive value of continuous temperature data was further demonstrated in a study by \citeauthor{luo_detection_2020},
who used an in-ear wearable device that measured ear canal temperature every five minutes during sleep~\cite{luo_detection_2020}.
They trained a Hidden Markov Model (HMM) to classify each data point into either a high- or low-temperature state,
augmented with biorhythm information from the user.
After filtering, the final dataset consisted of 64 cycles, each with at least 40\% data availability and at least one self-reported ovulation day, as determined by a hormone test kit.
After filtering, the final dataset consisted of 65 cycles, each with at least 40\% data availability and at least one self-reported ovulation day, as determined by a hormone test kit.
However, no information was provided regarding the distribution of cycle lengths or ovulation timing.
Ovulation detection was considered successful if the predicted day fell within ±3 days of the self-reported value.
@@ -37,16 +52,28 @@ For menstruation prediction, the model detected 70.70\% of menstruation days in
These results indicate that the model performs reasonably well for individuals with regular cycles,
but struggles significantly in the presence of menstrual irregularity—particularly in detecting the fertile window.
In addition to academic research, several commercial products use temperature-based methods for fertility tracking,
such as \textit{Ava}~\cite{sl_ava_nodate}, \textit{Daysy}~\cite{electronics_zykluscomputer_nodate} or \textit{Trackle}~\cite{noauthor_trackle_nodate}.
However, these products typically rely on proprietary algorithms, and no peer-reviewed publications are available detailing their methodology or performance.
This lack of transparency limits their scientific evaluation and comparability.
In contrast, the present study provides an open and data-driven approach to ovulation prediction based on continuous temperature data, aiming to contribute reproducible evidence to the field.
Several studies have questioned the utility of BBT (Basal Body Temperature) for reliable ovulation prediction.
For example \citeauthor{bauman_basal_1981} concluded, that BBT is not a robust standalone marker due to its
retrospective nature and sensitivity to external factors and thus must be used with extreme caution clinical or research evaluations~\cite{bauman_basal_1981}
\subsection{Alternative Pyhysiological Signals}
\subsection{Other Physiological Signals}\label{subsec:other_physiolocical_signals}
In addition to temperature, other physiological signals have been explored for ovulation and cycle phase prediction.
For example,\citeauthor{masuda_machine_2025} developed a machine learning algorithm to classify phases of the menstrual cycle
As early as \citeyear{moreno_temporal_1988}, researchers investigated ovulation prediction based on the electrical resistance of salivary and vaginal secretions~\cite{moreno_temporal_1988}.
Their study analyzed 29 cycles from 11 women, with daily recordings of BBT, urinary LH, pelvic ultrasound, and ovulation predictor kit results.
Participants were under the age of 35, had cycle lengths between 25 and 35 days, and had abstained from hormone therapies for at least two months prior to the study.
The results showed that, in all but one cycle, peaks in salivary resistance occurred 511 days prior to the estimated ovulation day.
The nadir in vaginal resistance coincided with or occurred on the day of ovulation.
These findings suggest that electrical resistance is a strong physiological marker for predicting ovulation.
A related modern implementation is the commercial product \textit{kegg}~\cite{noauthor_kegg_nodate}, which measures the electrical resistance of cervical mucus.
The device uses an undisclosed algorithm to estimate fertility status based on these readings, although no peer-reviewed validation studies are currently available.
\citeauthor{masuda_machine_2025} developed a machine learning algorithm to classify phases of the menstrual cycle
(follicular vs. luteal) based on sleeping heart rate, as recorded by a fitness tracker~\cite{masuda_machine_2025}.
They used an XGBoost classifier for this binary task and additionally performed ovulation day prediction,
although the details of this task were not fully specified.
@@ -76,5 +103,8 @@ Ovulation day prediction yielded an average absolute error between 3.6 and 4.1 d
When models are trained on highly constrained datasets with predictable patterns and clear ovulatory signals,
complex methods often show limited gains over naive or rule-based approaches—as will be demonstrated in Section~\ref{sec:methodology}.
%parts: traditional methods, ml approaches, tft in medical time series or other time series
\paragraph{Summary:}
While various physiological signals and modeling strategies have been explored for ovulation prediction,
many existing studies are limited by small, highly selected datasets, assumptions of cycle regularity, or reliance on proprietary algorithms.
The present work extends prior approaches by leveraging a large, heterogeneous dataset of real-world cycles and applying transparent,
data-driven modeling to better capture individual variability.