diff --git a/main.bib b/main.bib index f98a209..2addfd2 100644 --- a/main.bib +++ b/main.bib @@ -1652,7 +1652,7 @@ Publisher: {JMIR} Publications Inc., Toronto, Canada}, note = {Publisher: The University of Chicago Press}, } -@article{noauthor_monitoring_1987, +@article{vermesh_monitoring_1987, title = {Monitoring techniques to predict and detect ovulation}, volume = {47}, issn = {0015-0282}, @@ -1662,6 +1662,7 @@ Publisher: {JMIR} Publications Inc., Toronto, Canada}, pages = {259--264}, number = {2}, journaltitle = {Fertility and Sterility}, + author = {Vermesh, Michael and Kletzky, Oscar A and Davajan, Val}, urldate = {2025-02-20}, date = {1987-02-01}, langid = {american}, @@ -2344,3 +2345,216 @@ Conclusions Motivations for fertility app use are varied, overlap and change ove langid = {american}, file = {Snapshot:/home/alex/Zotero/storage/HQEIAZSB/www.naturalcycles.com.html:text/html}, } + +@article{kilungeja_machine_2025, + title = {Machine learning-based menstrual phase identification using wearable device data}, + volume = {3}, + issn = {2948-1716}, + url = {https://www.nature.com/articles/s44294-025-00078-8}, + doi = {10.1038/s44294-025-00078-8}, + pages = {29}, + number = {1}, + journaltitle = {npj Womens Health}, + author = {Kilungeja, Grentina and Graham, Krystal and Liu, Xudong and Nasseri, Mona}, + urldate = {2025-09-05}, + date = {2025-05-13}, + langid = {english}, + file = {PDF:/home/alex/Zotero/storage/LQ53JP35/Kilungeja et al. - 2025 - Machine learning-based menstrual phase identification using wearable device data.pdf:application/pdf}, +} + +@article{gnoth_time_2003, + title = {Time to pregnancy: results of the German prospective study and impact on the management of infertility}, + volume = {18}, + issn = {1460-2350}, + url = {https://academic.oup.com/humrep/article-lookup/doi/10.1093/humrep/deg366}, + doi = {10.1093/humrep/deg366}, + shorttitle = {Time to pregnancy}, + pages = {1959--1966}, + number = {9}, + journaltitle = {Human Reproduction}, + author = {Gnoth, C.}, + urldate = {2025-09-05}, + date = {2003-09-01}, + langid = {english}, + file = {PDF:/home/alex/Zotero/storage/4KWGU5HB/Gnoth - 2003 - Time to pregnancy results of the German prospective study and impact on the management of infertili.pdf:application/pdf}, +} + +@article{trussell_contraceptive_1987, + title = {Contraceptive Failure in the United States: A Critical Review of the Literature}, + volume = {18}, + issn = {00393665}, + url = {https://www.jstor.org/stable/1966856?origin=crossref}, + doi = {10.2307/1966856}, + shorttitle = {Contraceptive Failure in the United States}, + pages = {237}, + number = {5}, + journaltitle = {Studies in Family Planning}, + author = {Trussell, James and Kost, Kathryn}, + urldate = {2025-09-05}, + date = {1987-09}, + langid = {english}, + file = {PDF:/home/alex/Zotero/storage/CEFARS55/Trussell and Kost - 1987 - Contraceptive Failure in the United States A Critical Review of the Literature.pdf:application/pdf}, +} + +@article{bouchard_achieving_2018, + title = {Achieving Pregnancy Using Primary Care Interventions to Identify the Fertile Window}, + volume = {4}, + issn = {2296-858X}, + url = {http://journal.frontiersin.org/article/10.3389/fmed.2017.00250/full}, + doi = {10.3389/fmed.2017.00250}, + pages = {250}, + journaltitle = {Front. Med.}, + author = {Bouchard, Thomas P. and Fehring, Richard J. and Schneider, Mary M.}, + urldate = {2025-09-05}, + date = {2018-01-09}, + langid = {english}, + file = {PDF:/home/alex/Zotero/storage/U7LPLWZT/Bouchard et al. - 2018 - Achieving Pregnancy Using Primary Care Interventions to Identify the Fertile Window.pdf:application/pdf}, +} + +@article{bassas_fertility_2025, + title = {Fertility Awareness-Based Methods for Family Planning: A Systematic Review}, + issn = {2168-8184}, + url = {https://www.cureus.com/articles/376697-fertility-awareness-based-methods-for-family-planning-a-systematic-review}, + doi = {10.7759/cureus.86233}, + shorttitle = {Fertility Awareness-Based Methods for Family Planning}, + abstract = {Fertility awareness-based methods ({FABMs}) have been used for a long time for family planning. This systematic review evaluates the efficacy and outcomes of various {FABMs} used for family planning. For this systematic review, a literature search was carried out in {PubMed}, Web of Science, {CINAHL} Ultimate, and Google Scholar. The inclusion criteria included women aged 18-49 undergoing {FABMs} for either contraception or to conceive. The search was limited from 2014 to 2024. The risk of bias was assessed using the Newcastle-Ottawa Scale ({NOS}) and the Revised Cochrane risk of bias tool for randomized trials ({ROB}2). A total of 16 studies, including 20,339 participants, were included. The age of the participants ranged from 18 to 47 years. Regarding study design, 11 were prospective, two were retrospective, two were randomized, and one was a longitudinal study. The average success rate of all {FABMs} was 69.5\%. In five studies, the success rate was above 90\%. Among factors that influenced the success rate were the timing of intercourse and adherence to method protocols. {FABMs} are effective tools for enhancing the success rate of family planning. However, {FABMs} when enhanced with digital technology are particularly effective for both contraception and conception. Adequate user education and consistent application are essential to optimize outcomes.}, + journaltitle = {Cureus}, + author = {Bassas, Rasha A and Alharbi, Mohammad Saleh and Al Harbi, Shatha S}, + urldate = {2025-09-05}, + date = {2025-06-17}, + langid = {english}, + file = {PDF:/home/alex/Zotero/storage/DGEHP4H2/Bassas et al. - 2025 - Fertility Awareness-Based Methods for Family Planning A Systematic Review.pdf:application/pdf}, +} + +@article{trussell_contraceptive_2011, + title = {Contraceptive failure in the United States}, + volume = {83}, + rights = {https://www.elsevier.com/tdm/userlicense/1.0/}, + issn = {00107824}, + url = {https://linkinghub.elsevier.com/retrieve/pii/S0010782411000497}, + doi = {10.1016/j.contraception.2011.01.021}, + abstract = {This review provides an update of previous estimates of first-year probabilities of contraceptive failure for all methods of contraception available in the United States. Estimates are provided of probabilities of failure during typical use (which includes both incorrect and inconsistent use) and during perfect use (correct and consistent use). The difference between these two probabilities reveals the consequences of imperfect use; it depends both on how unforgiving of imperfect use a method is and on how hard it is to use that method perfectly. These revisions reflect new research on contraceptive failure both during perfect use and during typical use.}, + pages = {397--404}, + number = {5}, + journaltitle = {Contraception}, + author = {Trussell, James}, + urldate = {2025-09-05}, + date = {2011-05}, + langid = {english}, + file = {PDF:/home/alex/Zotero/storage/XVQYMWE2/Trussell - 2011 - Contraceptive failure in the United States.pdf:application/pdf}, +} + +@article{byun_sexual_2013, + title = {Sexual dysfunctions induced by stress of timed intercourse and medical treatment}, + volume = {111}, + issn = {1464-4096, 1464-410X}, + url = {https://bjui-journals.onlinelibrary.wiley.com/doi/10.1111/j.1464-410X.2012.11577.x}, + doi = {10.1111/j.1464-410X.2012.11577.x}, + abstract = {What's known on the subject? and What does the study add? + + It is known that timed intercourse that is planned to coincide with ovulation causes stress in women. In men premature ejaculation is more common than delayed ejaculation. + + Timed intercourse imposes a substantial degree of stress on men. None of our study participants reported premature ejaculation, whereas delayed ejaculation was noted by 5.92\% of the participants. Timed intercourse elevates anxiety levels, which leads to aggression. The men who required high doses of tadalafil had significantly higher scores on both the Beck Anxiety Inventory and the Buss Perry Aggression Questionnaire subscales ( + P + {\textless} 0.001). + + + + {OBJECTIVE} + + + + To understand the effect of stress incurred by timed intercourse ({TI}) on sexual dysfunction in relation to anxiety and aggression in men facing {TI}. + + + + + + {PATIENTS} {AND} {METHODS} + + + + This study involved 439 men and was conducted during a 3‐year period between 1 July 2008 and 30 June 2011. + + + Various characteristics were evaluated, including newly acquired erectile dysfunction ({ED}), ejaculatory dysfunction ({EjD}), anxiety levels (using the Beck Anxiety Inventory [{BAI}]), self‐reported aggression (using the Buss Perry Aggression Questionnaire [{BPAQ}]), hormone levels (such as follicle‐stimulating hormone, luteinizing hormone, testosterone, prolactin and oestradiol) and semen parameters. + + + + + + {RESULTS} + + + + A total of 188 men (42.8\%) and 26 men (5.92\%) experienced {ED} and {EjD}, respectively. + + + + Luteinizing hormone, testosterone and oestradiol were significantly lower in men with {ED} ( + P + {\textless} 0.05). + + + + + The men who required high doses of tadalafil had significantly higher scores on both the {BAI} and the {BPAQ} subscales ( + P + {\textless} 0.001). + + + + + {BAI} and subscales of {BPAQ} were higher in males with delayed ejaculation ( + P + {\textless} 0.001). + + + + + + + {CONCLUSIONS} + + + + {TI} imposes a great deal of stress on male partners, potentially causing {ED} and {EjD}, and elevates anxiety levels, which leads to aggression. + + + Physicians and clinicians should acknowledge the potentially harmful effects of {TI} on men. + + + Furthermore, both female and male patients should be cautioned about the increased likelihood of {ED} and {EjD} as the number of incidents of {TI} increases.}, + number = {4}, + journaltitle = {{BJU} International}, + author = {Byun, Jae Sang and Lyu, Sang Woo and Seok, Hyun Ha and Kim, Won Jun and Shim, Sung Han and Bak, Chong Won}, + urldate = {2025-09-05}, + date = {2013-04}, + langid = {english}, + file = {PDF:/home/alex/Zotero/storage/V2CD7NHD/Byun et al. - 2013 - Sexual dysfunctions induced by stress of timed intercourse and medical treatment.pdf:application/pdf}, +} + +@article{pfeifer_optimizing_2017, + title = {Optimizing natural fertility: a committee opinion}, + volume = {107}, + issn = {00150282}, + url = {https://linkinghub.elsevier.com/retrieve/pii/S0015028216628492}, + doi = {10.1016/j.fertnstert.2016.09.029}, + shorttitle = {Optimizing natural fertility}, + abstract = {The ‘‘fertile window’’ spans the 6-day interval ending on the day of ovulation and correlates with the volume and character of cervical mucus.}, + pages = {52--58}, + number = {1}, + journaltitle = {Fertility and Sterility}, + author = {Pfeifer, Samantha and Butts, Samantha and Fossum, Gregory and Gracia, Clarisa and La Barbera, Andrew and Mersereau, Jennifer and Odem, Randall and Paulson, Richard and Penzias, Alan and Pisarska, Margareta and Rebar, Robert and Reindollar, Richard and Rosen, Mitchell and Sandlow, Jay and Vernon, Michael}, + urldate = {2025-09-05}, + date = {2017-01}, + langid = {english}, + file = {PDF:/home/alex/Zotero/storage/FDF7HZ69/Pfeifer et al. - 2017 - Optimizing natural fertility a committee opinion.pdf:application/pdf}, +} + +@article{lecun_gradient-based_nodate, + title = {Gradient-Based Learning Applied to Document Recognition}, + author = {Lecun, Yann}, + langid = {english}, + file = {PDF:/home/alex/Zotero/storage/JCQLD5GG/Lecun - Gradient-Based Learning Applied to Document Recognition.pdf:application/pdf}, +} diff --git a/thesis/main.tex b/thesis/main.tex index 7fd374f..981c164 100644 --- a/thesis/main.tex +++ b/thesis/main.tex @@ -38,7 +38,7 @@ \begin{titlepage} \centering {\large \textbf{Leipzig University}}\\[1.5cm] - {\large Faculty of Mathematics and Computer Science}\\[2cm] + {\large Faculty of Mathematics and Computer Science}\\[1cm] \includegraphics[width=7cm]{leipzig_university_logo}\\[1cm] % Adjust size as needed @@ -47,7 +47,9 @@ \textbf{Master’s Thesis}\\[1cm] \textbf{Author:}\\ - Alexander Blank\\[0.5cm] + Alexander Blank\\ [0.2cm] + Matriculation Number: \\ + 3796505\\ [0.5cm] \textbf{Supervisor:}\\ Prof. Bogdan Franczyk\\ @@ -62,7 +64,22 @@ \pagebreak \begin{abstract} - This could be your abstract - call 0800 - ABSTRACT to get your personal quote. + This thesis investigates the feasibility of predicting fertility from high-resolution body + core temperature data using machine learning. + More than 40,000 cycles recorded with an intravaginal sensor were used to train and evaluate recurrent, + transformer-based, and convolutional model variants. + Results show that while LSTM models achieved the lowest error on standard metrics, + transformer-based architectures performed more robustly in use-case evaluations + for contraception and natural family planning (NFP). + Predictions were substantially more accurate in regular cycles than in irregular ones, + underlining both the promise and the limits of temperature-based approaches. + A pre-ovulatory temperature drop was identified as a relevant physiological marker influencing fertility probability. + In simulated use cases, model predictions approached the effectiveness of established contraceptive + methods and enabled more efficient timing for conception efforts. + Despite the limitations of retrospective labeling, noisy real-world data, + and the restriction to temperature as a single modality, + the study demonstrates that machine learning can meaningfully advance individualized fertility prediction. + These results provide a foundation for future multimodal approaches and for the development of adaptive, user-tailored fertility support tools. \end{abstract} \pagebreak @@ -97,6 +114,19 @@ Responsibility for the content, structure, and conclusions of this thesis remains entirely my own. \pagebreak + I hereby declare that I have written the present thesis independently and only with the use of the sources and aids indicated. + In particular, literal or paraphrased quotations are marked as such. + I am aware that any violation may lead, even retrospectively, + to the revocation of the degree. + I further declare that the electronic copy is identical to the printed copies. + + \vspace{2cm} + + \noindent + \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} l c r} + Location: & Date: & Signature: \\ + \end{tabular*} + \include{sections/appendix} \printbibliography diff --git a/thesis/resources/figures/background/fertility_probability_relative_to_ovulation.png b/thesis/resources/figures/background/fertility_probability_relative_to_ovulation.png new file mode 100644 index 0000000..11974b0 Binary files /dev/null and b/thesis/resources/figures/background/fertility_probability_relative_to_ovulation.png differ diff --git a/thesis/resources/figures/results/contraception_use_case_pregnancy_statistics.png b/thesis/resources/figures/results/contraception_use_case_pregnancy_statistics.png index 6ee608f..db0da84 100644 Binary files a/thesis/resources/figures/results/contraception_use_case_pregnancy_statistics.png and b/thesis/resources/figures/results/contraception_use_case_pregnancy_statistics.png differ diff --git a/thesis/resources/figures/results/contraception_use_case_results_by_fertility_threshold.png b/thesis/resources/figures/results/contraception_use_case_results_by_fertility_threshold.png index a940311..59c73ae 100644 Binary files a/thesis/resources/figures/results/contraception_use_case_results_by_fertility_threshold.png and b/thesis/resources/figures/results/contraception_use_case_results_by_fertility_threshold.png differ diff --git a/thesis/resources/figures/results/pregnancy_use_case_pregnancy_statistics.png b/thesis/resources/figures/results/pregnancy_use_case_pregnancy_statistics.png index 09c498a..5959a09 100644 Binary files a/thesis/resources/figures/results/pregnancy_use_case_pregnancy_statistics.png and b/thesis/resources/figures/results/pregnancy_use_case_pregnancy_statistics.png differ diff --git a/thesis/resources/figures/results/pregnancy_use_case_results_by_fertility_threshold.png b/thesis/resources/figures/results/pregnancy_use_case_results_by_fertility_threshold.png index 406b40d..57cd2dc 100644 Binary files a/thesis/resources/figures/results/pregnancy_use_case_results_by_fertility_threshold.png and b/thesis/resources/figures/results/pregnancy_use_case_results_by_fertility_threshold.png differ diff --git a/thesis/sections/appendix.tex b/thesis/sections/appendix.tex index bc60763..33ff94a 100644 --- a/thesis/sections/appendix.tex +++ b/thesis/sections/appendix.tex @@ -2,6 +2,202 @@ \appendixpage % prints "Appendices" +\section{Supplementary Results: Prediction of Ovulation-Over Indicator}\label{sec:appendix_ov_over_results} + +\subsection{Comparative Study of Model Architectures and Parameters}\label{subsec:appendix_ov_over_architecture_results} + +We evaluate prediction of a binary indicator denoting whether ovulation has already occurred. +We examine the influence of input window length, input resolution, and model capacity. + +\paragraph{Impact of input window length.} +For predicting whether ovulation has occurred (OV-over), +optimal window lengths again vary by architecture and target phase (pre- vs post-ovulation). + +The \textbf{Transformer} yields the lowest overall (0.0533) and post-ovulation MSE (0.0520) at 40 days. +The \textbf{LSTM} performs best before ovulation (MSE 0.0212 at 20 days), while its overall MSE improves with longer context (160 days). + +The \textbf{Convolutional LSTM} favors short windows, with the best overall MSE (0.0699), before-OV (0.0389), +and after-OV (0.0833) all occurring at 20 days. +The \textbf{Convolutional Transformer} performs best overall at 40 days and best before ovulation at 160 days (MSE 0.0286). +See Table~\ref{tab:ovover_windows_compact_mse} for a summary. + +\begin{table}[t] + \small + \renewcommand{\arraystretch}{1.15} + \setlength{\tabcolsep}{6pt} + \begin{tabularx}{\linewidth}{l*{3}{>{\centering\arraybackslash}X}} + \toprule + \textbf{Architecture} & \multicolumn{3}{c}{\textbf{MSE}} \\ + \cmidrule(r){2-4} + & \shortstack[c]{Overall best\\(days / MSE)} + & \shortstack[c]{Before-OV best\\(days / MSE)} + & \shortstack[c]{After-OV best\\(days / MSE)} \\ + \midrule + LSTM + & 160 / 0.0557 + & \textbf{20 / 0.0212} + & 160 / 0.0580 \\ + Transformer + & \textbf{40 / 0.0533} + & 20 / 0.0255 + & \textbf{40 / 0.0520} \\ + Convolutional LSTM + & 20 / 0.0699 + & 20 / 0.0389 + & 20 / 0.0833 \\ + Convolutional Transformer + & 40 / 0.0709 + & 160 / 0.0286 + & 40 / 0.0820 \\ + \bottomrule + \end{tabularx} + \caption{OV-Over: best input window per architecture (MSE only) at a fixed input resolution of 12 values/day. + Bold entries are bests within a column.} + \label{tab:ovover_windows_compact_mse} +\end{table} + +\paragraph{Impact of input resolution.} +Fixing the input window to 20 days, we compare input resolutions for LSTM and Transformer models. + +For the \textbf{LSTM}, the lowest overall MSE (0.0633) occurs at 24/day, +with best before-OV and after-OV MSEs at 12/day (0.0212) and 48/day (0.0550), respectively. + +The \textbf{Transformer} performs best overall at 72/day (0.0585), +with lowest before-OV MSE at 12/day (0.0255) and after-OV MSE at 288/day (0.0578). + +Results are summarized in Table~\ref{tab:ovover_resolution_compact_mse}; +full resolution grids are in Appendix Table~\ref{tab:ov_over_results_by_resolution}. + +\begin{table}[t] + \small + \renewcommand{\arraystretch}{1.15} + \setlength{\tabcolsep}{6pt} + \begin{tabularx}{\linewidth}{l*{3}{>{\centering\arraybackslash}X}} + \toprule + \textbf{Architecture} & \multicolumn{3}{c}{\textbf{MSE}} \\ + \cmidrule(r){2-4} + & \shortstack[c]{Overall best\\(values/day / MSE)} + & \shortstack[c]{Before-OV best\\(values/day / MSE)} + & \shortstack[c]{After-OV best\\(values/day / MSE)} \\ + \midrule + LSTM + & 24 / 0.0633 + & \textbf{12 / 0.0212} + & \textbf{48 / 0.0550} \\ + Transformer + & \textbf{72 / 0.0585} + & 12 / 0.0255 + & 288 / 0.0578 \\ + \bottomrule + \end{tabularx} + \caption{OV-Over: best input resolution per architecture (MSE only) at a fixed input-window length of 20\,days. + Bold entries are bests within a column. Convolutional models are excluded (they consume 288 values/day internally).} + \label{tab:ovover_resolution_compact_mse} +\end{table} + +\paragraph{Impact of model parameters.} +Using fixed input settings (160 days at 12/day for LSTM/Transformer; 40 days for convolutional models), we evaluate model scaling. + +The \textbf{Transformer} achieves the lowest overall (0.0543) and after-ovulation MSE (0.0410) at a large configuration (512×8×8). +Before-OV MSE is lowest at 256×4×4 (0.0293). + +For the \textbf{LSTM}, the best overall and after-OV performance is at 512×4, +while the best before-OV MSE occurs at 128×2 (0.0274). +The \textbf{Convolutional LSTM} performs best overall and after-OV at 256×4, with the best before-OV MSE at 128×2. + +Finally, the \textbf{Convolutional Transformer} achieves its lowest overall and after-OV MSE at 512×4×4, and best before-OV MSE at 512×8×8. + +Table~\ref{tab:ovover_params_compact_mse} summarizes these parameter-dependent results; +full comparisons are included in Appendix Tables~\ref{tab:ov_over_results_by_model_parameters_lstm}–\ref{tab:ov_over_results_by_model_parameters_conv_transformer}. + +\begin{table}[t] + \scriptsize + \renewcommand{\arraystretch}{1.15} + \setlength{\tabcolsep}{6pt} + \begin{tabularx}{\linewidth}{l*{3}{>{\centering\arraybackslash}X}} + \toprule + \textbf{Architecture} & \multicolumn{3}{c}{\textbf{MSE}} \\ + \cmidrule(r){2-4} + & \shortstack[c]{Overall best\\(params / MSE)} + & \shortstack[c]{Before-OV best\\(params / MSE)} + & \shortstack[c]{After-OV best\\(params / MSE)} \\ + \midrule + LSTM + & \(512\times4\) / 0.0616 + & \textbf{\(128\times2\) / 0.0274} + & \(512\times4\) / 0.0613 \\ + Transformer + & \textbf{\(512\times8\times8\) / 0.0543} + & \(256\times4\times4\) / 0.0293 + & \textbf{\(512\times8\times8\) / 0.0410} \\ + Convolutional LSTM + & \(256\times4\) / 0.0687 + & \(128\times2\) / 0.0357 + & \(256\times4\) / 0.0715 \\ + Convolutional Transformer + & \(512\times4\times4\) / 0.0703 + & \(512\times8\times8\) / 0.0339 + & \(512\times4\times4\) / 0.0814 \\ + \bottomrule + \end{tabularx} + \caption{OV-Over: best parameter settings per architecture (MSE only). + Parameters are formatted as \(\text{hidden}\times\text{layers}\) (LSTM/Conv.\ LSTM) and \(\text{embedding}\times\text{encoder layers}\times\text{heads}\) (Transformer/Conv.\ Transformer). + Bold values indicate bests within a column. Fixed input settings: 160\,days with 12 values/day for LSTM/Transformer; 40\,days for convolutional models.} + \label{tab:ovover_params_compact_mse} +\end{table} + +\subsection{Regular vs. Irregular Cycles}\label{subsec:appendix_ov_over_regular_vs_irregular} +\begin{table}[htbp] + \centering + \small + \begin{tabularx}{\linewidth}{l*{3}{X}} + \toprule + \multirow{2}{*}{Model} & \multicolumn{3}{c}{MSE} \\ + \cmidrule(r){2-4} + & OV-Over Overall & OV-Over Before OV & OV-Over After OV \\ + \midrule + \multicolumn{4}{c}{\textbf{Regular Cycle Group}} \\ + \midrule + LSTM & \textbf{0.028519} & 0.031695 & \textbf{0.026116} \\ + Transformer & 0.032929 & \textbf{0.024774} & 0.033411 \\ + Convolutional LSTM & 0.034224 & 0.028962 & 0.033929 \\ + Convolutional Transformer & 0.033333 & 0.039045 & 0.029329 \\ + Last-Cycle Baseline & 0.087916 & 0.093465 & 0.074191 \\ + Population Mean Baseline & 0.285887 & 0.008876 & 0.418879 \\ + User Mean Baseline & 0.069245 & 0.069152 & 0.055724 \\ + \midrule + \multicolumn{4}{c}{\textbf{Irregular Cycle Group}} \\ + \midrule + LSTM & \textbf{0.051747} & \textbf{0.016777} & 0.070419 \\ + Transformer & 0.055990 & 0.026159 & 0.067520 \\ + Convolutional LSTM & 0.054523 & 0.030092 & \textbf{0.066643} \\ + Convolutional Transformer & 0.056075 & 0.029638 & 0.067965 \\ + Last-Cycle Baseline & 0.222906 & 0.134945 & 0.258047 \\ + Population Mean Baseline & 0.171368 & 0.130366 & 0.140363 \\ + User Mean Baseline & 0.180702 & 0.088884 & 0.217144 \\ + \bottomrule + \end{tabularx} + \caption{MSEs for ovulation-over target across different model architectures for regular and irregular cycle groups. Bold values denote the best scores per column.} + \label{tab:ov_over_mse_regular_irregular} +\end{table} + +\noindent +Table~\ref{tab:ov_over_mse_regular_irregular} shows the MSE metric results for all models on the regular and irregular cycle groups for the OV-over target. +For this target, performance patterns differ more distinctly across phases. +In the regular group, the LSTM performs best overall and after ovulation, while the Transformer performs best before ovulation. +Convolutional models perform slightly worse than their recurrent and transformer-based counterparts across all phases. +The population mean baseline shows a spurious low MSE before ovulation, but this is not consistent across phases, suggesting it is not reliable. +In general, baselines are notably weaker than learned models across all splits. + +For irregular cycles, all model performances deteriorate relative to regular cycles. +The LSTM remains the most robust, achieving the best MSEs both overall and before ovulation. +Convolutional LSTM performs best after ovulation. +Transformer-based models perform less consistently in this group, suggesting decreased robustness to cycle irregularity. +As before, all learned models outperform the baselines by a wide margin. + +The full table with MSE and MAE for all models can be found in the appendix, Table~\ref{tab:regular_vs_irregular_ov_over_results}. + + \section{Extra Figures}\label{app:figs} \begin{landscape} diff --git a/thesis/sections/background.tex b/thesis/sections/background.tex index 3214691..9c8d449 100644 --- a/thesis/sections/background.tex +++ b/thesis/sections/background.tex @@ -71,7 +71,7 @@ Over time, the temperature does not show any significant or longer lasting tempe To illustrate the diversity of real-world menstrual cycles, Figures~\ref{fig:background_long_cycle} and~\ref{fig:background_short_cycle} show examples of cycles that are significantly longer or shorter than a normative 28-day cycle. \citeauthor{bull_real-world_2019} have done an extensive study on cycle variability, -highlighting that women frequently deviate from the normative cycle, especially with age\cite{bull_real-world_2019}. +highlighting that women frequently deviate from the normative cycle, especially with age~\cite{bull_real-world_2019}. \begin{figure}[htbp] \centering @@ -116,7 +116,7 @@ The distribution of fertility probability is not dependent on the length of the \begin{figure}[htbp] \centering - \includegraphics[width=0.7\textwidth]{resources/figures/background/background_pregnancy_chance_over_time} + \includegraphics[width=0.7\textwidth]{resources/figures/background/fertility_probability_relative_to_ovulation} \caption{Chance of fertilization depending on the day of the menstrual cycle. The highest chance is around one day before ovulation~\cite{dunson_day-specific_1999}.} \label{fig:background_pregnancy_chance} @@ -202,7 +202,8 @@ In addition to temperature measurements, the database includes contextual metada These markers provide further physiological context and may include information about intermediate bleeding, sexual intercourse, or positive pregnancy tests. At the time of writing, the dataset contains approximately 65{,}000 annotated cycles, -comprising more than 350 million individual temperature measurements~\footnote{This is the largest dataset of continuous body core temperature data used in any study so far.}. +comprising more than 350 million individual temperature measurements. +This is the largest dataset of continuous body core temperature data used in any study so far. \subsubsection{Dataset Summary} For the present study, the dataset was reduced to approximately 40{,}000 cycles after filtering out entries that were incomplete, @@ -281,7 +282,10 @@ Recurrent Neural Networks (RNNs) and the more recent Transformer architecture. Recurrent Neural Networks (RNNs) are extensions of classical neural networks that incorporate cyclic connections between neurons. These recurrent connections allow the network to retain information from previous inputs by feeding the hidden state from a prior time step into the current one, enabling a form of temporal memory. -They process input \emph{sequentially}, maintaining this hidden state over time. +Recurrent Neural Networks (RNNs) process sequences in a strictly sequential manner, +where each token's representation depends on the preceding token. +This results in a per-layer time complexity of $\mathcal{O}(n \cdot d^2)$, where $n$ is the sequence length and $d$ is the hidden state size. + In practice, this means that input data is processed sequentially, one step at a time. At each step \(t\), the input \(x_t\) is combined with the previous hidden state \(h_{t-1}\) to produce a new @@ -324,46 +328,61 @@ information: the \emph{forget gate}, the \emph{input gate}, and the \emph{output \item The \emph{output gate} selects relevant parts of the current cell state to produce the output and the next hidden state. \end{itemize} -Each gate employs a sigmoid activation function to regulate the flow of information, -allowing LSTMs to preserve and update memory over long sequences. +Each gate uses a sigmoid activation to produce values in \([0, 1]\), +regulating how much information passes through. +This gating mechanism enables LSTMs to maintain relevant information over long sequences +while discarding irrelevant parts. \begin{figure}[htbp] \centering - \includegraphics[width=0.6\textwidth]{resources/figures/background/background_lstm_structure} - \caption{Architecture of a memory cell \( c_j \) and its gate units \( \text{in}_j \) and \( \text{out}_j \). - At the center, the self-recurrent linear unit (with weight 1.0) maintains the internal state~\cite{hochreiter_long_1997}. - See text for more details.} + \includegraphics[width=0.6\textwidth]{resources/figures/background/lstm_cell_diagram} + \caption{Architecture of a memory cell and its gate units (Image source: \cite{chevalier_english_2018}).} \label{fig:lstm_architecture} \end{figure} -The LSTM unit maintains an internal state \( s_{c_j}(t) \) for each cell $c_j$ that evolves over time to capture long-term dependencies. -Figure~\ref{fig:lstm_architecture} shows the structure of a memory cell along with its input and output gates. -The \emph{input gate} activation \( y_j^{\text{in}}(t) \) controls the influence of the new candidate input \( g(\text{net}_{c_j}(t)) \) on the state update (Eq.~\eqref{eq:state_update}): + +The LSTM maintains an internal cell state \(c_t\), which is updated at each time step. +First, the forget gate activation \(f_t\) determines how much of the previous state is retained: \begin{equation} - s_{c_j}(t) = s_{c_j}(t - 1) + y_j^{\text{in}}(t) \cdot g(\text{net}_{c_j}(t)) + f_t = \sigma\left(W_f \cdot [h_{t-1}, x_t] + b_f\right) + \label{eq:forget_gate} +\end{equation} + +The input gate \(i_t\) and the candidate cell state \(\tilde{c}_t\) are computed as: + +\begin{align} + i_t &= \sigma\left(W_i \cdot [h_{t-1}, x_t] + b_i\right) + \label{eq:input_gate} \\ + \tilde{c}_t &= \tanh\left(W_c \cdot [h_{t-1}, x_t] + b_c\right) + \label{eq:candidate_state} +\end{align} + +The new cell state \(c_t\) is then updated by combining the retained previous state +with the gated candidate state: + +\begin{equation} + c_t = f_t \cdot c_{t-1} + i_t \cdot \tilde{c}_t \label{eq:state_update} \end{equation} -The \emph{output gate} \( y_j^{\text{out}}(t) \), computed from \( \text{net}_{\text{out}_j}(t) \), determines how much of the transformed internal state is passed on as visible output (Eq.~\eqref{eq:cell_output}): - -\begin{equation} - y_j^{c}(t) = y_j^{\text{out}}(t) \cdot h(s_{c_j}(t)) - \label{eq:cell_output} -\end{equation} - -\(g\) and \(h\) are differentiable functions, here \emph{tanh}. -The gate activations themselves are derived from net inputs formed as weighted sums of previous outputs \( y^u(t-1) \), as given by: +Next, the output gate \(o_t\) determines how much of the transformed cell state +is exposed as hidden state: \begin{align} - \text{net}_{\text{out}_j}(t) &= \sum_u w_{\text{out}_j,u} \, y^u(t - 1) \label{eq:net_out} \\ - \text{net}_{\text{in}_j}(t) &= \sum_u w_{\text{in}_j,u} \, y^u(t - 1) \label{eq:net_in} \\ - \text{net}_{c_j}(t) &= \sum_u w_{c_j,u} \, y^u(t - 1) \label{eq:net_c} + o_t &= \sigma\left(W_o \cdot [h_{t-1}, x_t] + b_o\right) + \label{eq:output_gate} \\ + h_t &= o_t \cdot \tanh(c_t) + \label{eq:cell_output} \end{align} -During training, the weights associated with the inputs \( x_t \) and previous outputs \( h_{t-1} \), -as well as the biases for each gate in a cell, are learned through backpropagation. -To build more expressive models, memory cells can be stacked in multiple layers, and their outputs concatenated or passed sequentially to higher layers. +Here, \(\sigma\) denotes the sigmoid function. +All gates depend on both the previous hidden state \(h_{t-1}\) and the current input \(x_t\). +The weight matrices \(W_f, W_i, W_c, W_o\) and biases \(b_f, b_i, b_c, b_o\) +are learned during training via backpropagation through time. + +By combining multiplicative gates and additive memory updates, LSTMs can learn when to forget, +update, and expose information, solving key limitations of vanilla RNNs in sequence modeling tasks. LSTMs are widely used in biomedical applications due to their capacity to handle sequences of variable length and complexity. In the context of fertility prediction, where hormonal patterns exhibit periodicity but also irregularity, @@ -388,6 +407,9 @@ Unlike recurrent neural networks (RNNs), Transformers process input sequences \e allowing them to model relationships between any pair of input tokens or timesteps directly. This design mitigates the limitations of recurrent models, such as long-term memory constraints and vanishing gradients. +However, the per-layer time complexity is $\mathcal{O}(n^2 \cdot d)$, due to the quadratic cost of computing pairwise attention across the $n$ tokens. +Unlike RNNs, Transformers also cannot inherently process sequences of variable length. +Additional preprocessing steps, such as padding or windowing must be applied to support these. Originally introduced for machine translation, Transformers have proven broadly applicable to various sequence modeling tasks due to their flexibility, scalability, and strong performance @@ -401,7 +423,7 @@ linearly projected from the input and used to compute attention scores. \begin{figure}[htbp] \centering \includegraphics[width=0.4\textwidth]{resources/figures/background/background_transformer_architecture} - \caption{The Transformer - architecture for an encoder-decoder model~\cite{vaswani_attention_2017}} + \caption{The Transformer - architecture for an encoder-decoder model (Image source: \cite{vaswani_attention_2017})} \label{fig:background_transformer_architecture} \end{figure} @@ -417,7 +439,7 @@ In the case of machine translation, this input would be a sentence in the source The input tokens are first mapped to dense continuous vector representations (embeddings). -Since the attention mechanism permutation-invariant, that is, it does not inherently encode the order of tokens in the sequence, +Since the attention mechanism is permutation-invariant, that is, it does not inherently encode the order of tokens in the sequence, \emph{positional encodings} are added to the token embeddings to provide information about the token positions in the sequence. Without positional encoding, repeated tokens such as `The` would be indistinguishable @@ -564,11 +586,11 @@ For high-resolution time-series data, the input dimensionality can become large, especially in models like Transformers that process the entire sequence in parallel. This can lead to increased memory consumption and slower training. To mitigate this and retain as much information as possible, convolutional layers can be used -to reduce the sequence length while preserving important local patterns. +to reduce the sequence length while preserving important local patterns~\cite{lecun_gradient-based_nodate}. In this context, one-dimensional convolutions act as learnable filters that slide over the input sequence to extract temporal features. Each filter is parameterized to respond to specific local structures in the data, such as peaks, slopes, or short-term motifs. -By adjusting the \emph{stride}—the step size of the convolution—the model can control the degree of downsampling, +By adjusting the \emph{stride}, the step size of the convolution, the model can control the degree of downsampling, effectively reducing the number of time steps passed to subsequent layers. Additional dimensionality reduction can be achieved using pooling operations, such as \emph{max pooling}, which retains only the maximum value within a given window. diff --git a/thesis/sections/conclusion.tex b/thesis/sections/conclusion.tex index c1e93e9..f490502 100644 --- a/thesis/sections/conclusion.tex +++ b/thesis/sections/conclusion.tex @@ -2,4 +2,34 @@ %! Date = 3/6/25 -\section{Conclusion}\label{sec:conclusion} \ No newline at end of file +\section{Conclusion}\label{sec:conclusion} + +This thesis presented a systematic investigation of different machine learning architectures +for fertility prediction based on high-resolution body core temperature data. +By comparing LSTM- and Transformer-based models, as well as their convolutional variants, +the results show that machine learning can achieve high predictive performance. +LSTM models performed best according to standard evaluation metrics, whereas Transformer-based models +proved more robust in simulated use-case evaluations for contraception and Natural Family Planning (NFP). +Predictions were consistently more reliable in regular cycles than in irregular ones, +highlighting both the potential and the inherent limits of temperature-based approaches. + +A characteristic pre-ovulatory temperature drop was identified as correlating with fertility. +Both its timing and its magnitude appear to influence fertility probability, +pointing to a concrete physiological marker that could be exploited in practice. + +Use-case evaluations indicate that the model outputs could be highly relevant for contraception and NFP\@. +In simulations, pregnancy rates approached those reported for commonly used contraceptives such as condoms +or oral contraceptives, and with simple additional measures could even approximate the effectiveness of +long-term hormonal methods or sterilization. +While pregnancy rates for the NFP use-case were not significantly improved, +the predictions enabled a four-fold increase in the efficiency of timed intercourse, +facilitating more targeted pregnancy efforts for couples. + +Despite the limitations of real-world tracking data, including missing entries, noise, +and user heterogeneity, this work underscores the potential of personalized, data-driven predictions +in digital reproductive health. +Future work should integrate additional physiological signals, expand demographic representation, +and validate models in prospective real-world settings. + +In sum, this study contributes a systematic foundation for machine learning-based fertility prediction +and sets the stage for adaptive, user-tailored fertility support tools. \ No newline at end of file diff --git a/thesis/sections/discussion.tex b/thesis/sections/discussion.tex index a557371..1ecdf87 100644 --- a/thesis/sections/discussion.tex +++ b/thesis/sections/discussion.tex @@ -4,7 +4,7 @@ \section{Discussion}\label{sec:discussion} -\subsection{RQ1: Model Architecture Evuation an Optimization}\label{subsec:discussion_rq1_model_evaluation} +\subsection{Objective 1: Model Architecture Evuation an Optimization}\label{subsec:discussion_rq1_model_evaluation} The first research objective considered different model architectures and how they perform @@ -71,7 +71,7 @@ as a direct regression target, might prove more stable and informative. As we will see in the next section, the current targets are highly sensitive to anomalies, which may not be the case for alternative formulations. -\subsection{RQ2: Factors and Patterns that Influence Prediction}\label{susbsec:discussion_rq2_factors_and_patterns} +\subsection{Objective 2: Factors and Patterns that Influence Prediction}\label{susbsec:discussion_rq2_factors_and_patterns} Our second research objective focused on identifying potential factors and patterns in the data that influence fertility prediction. @@ -116,7 +116,7 @@ This could lead to a more biologically grounded interpretation of the patterns u Moreover, improvements in label quality will naturally improve the interpretability and accuracy of predictions. Better labels would also allow more reliable medical interpretation of the prediction outputs and the patterns driving them, as previously discussed. -\subsection{RQ3: Performance Across Regular and Irregular Cycles}\label{subsec:discussion_rq3_regular_vs_irregular} +\subsection{Objective 3: Performance Across Regular and Irregular Cycles}\label{subsec:discussion_rq3_regular_vs_irregular} The third research objective of this study was to compare model performance across subsets of users with regular and irregular menstrual cycles. @@ -159,190 +159,100 @@ Ideally, the model would have access to the entire cycle history of a user for t However, this would likely exceed the memory and capacity constraints of the architectures used in this study. Overcoming this limitation may require more efficient or hierarchical time series architectures, as previously discussed. -\subsection{RQ4: Use-case Evaluations}\label{subsec:discussion_rq4_use_case_evaluations} +\subsection{Objective 4: Use-case Evaluations}\label{subsec:discussion_rq4_use_case_evaluations} +The fourth research objective was to evaluate two practical use-cases—natural contraception +and natural family planning (NFP), using predefined evaluation algorithms. +These algorithms approximate the effectiveness of different models across varying fertility thresholds. -% ------------------------------------------------------------------------------------- -This study set out to evaluate the predictive value of body temperature for ovulation and fertility, -to assess the performance of different model architectures across use cases, -and to compare machine learning models with rule-based baselines. -Below we discuss the findings in relation to these objectives, their implications, and limitations. +We found that for both use-cases, all trained models outperformed the baselines. +There was notable variability between model types, with the Transformer model +performing best, especially for low fertility thresholds, followed closely by the convolutional variants. +The LSTM model consistently showed the weakest performance across all metrics. +Still, both trained and baseline models yielded significant +improvements over the control group, indicating that all model types offer meaningful predictive value. -\subsection{Predictive Value of Body Temperature} -Our results confirm that body core temperature carries meaningful predictive value for ovulation and fertility, -particularly in regular cycles with clear pre-ovulatory dips. -This dip before the -In such cases, fertility-probability curves aligned closely with the ground truth, -demonstrating that models can reliably exploit this physiological marker. -However, anomalies in the signal, such as irregular spikes or absent dips, frequently led to erroneous predictions. -This suggests that the models strongly rely on short-term temperature fluctuations without -distinguishing between ovulation-related and unrelated changes. +To our knowledge, no previous work has explicitly evaluated use-cases of natural +contraception or NFP with machine learning, or compared them to traditional contraceptive methods. +This highlights the exploratory nature of this analysis. -The irregular-versus-regular cycle analysis reinforces this interpretation: -prediction accuracy was consistently higher in regular cycles, indicating that models leverage cyclical regularity in -addition to absolute thermal changes. -Especially for regular cycles, the performance of the trained models +\paragraph{Contraception Use-Case.} +For the natural contraception scenario, Transformer-based architectures produced competitive results, +achieving fewer than 5 pregnancies per 100 user-years for low thresholds. +For context, the expected pregnancy rates per 100 user-years are approximately 12 for male condoms +and around 7 for oral contraceptives (e.g., “the pill”). +Only implanted hormonal contraceptives and sterilization achieve lower rates (under 1)~\cite{noauthor_birth_nodate}. +In contrast, the control group, representing no contraception, resulted in 90 pregnancies per 100 user-years, +which closely aligns with literature values (85 pregnancies per 100 women per year)~\cite{trussell_contraceptive_2011}. -%[continue here: bring in your figure-based examples of temperature drops, anomalies, and unclear cases, with interpretation rather than description.] +As expected, the number of denials, i.e., +days on which a potential application would suggest abstinence,increases with the threshold. +Therefore, a trade-off exists between minimizing pregnancies and minimizing denials. +This trade-off is user-dependent: while some users prefer certainty and are comfortable with frequent denials, +others may accept higher risk or use additional protective measures to mitigate it. -Taken together, these findings highlight both the utility and the limitations of body temperature as a single biomarker. -While it provides a strong signal in favorable cases, its variability across users and cycles limits robustness in real-world applications. -Additional biomarkers or contextual information are likely required to disambiguate genuine ovulatory patterns from noise. +This highlights a critical limitation: all results are based on a naive, +rigid denial strategy that did not incorporate any additional measures or contextual information +beyond the raw model predictions. +When combined with established behavioral protocols,such as abstinence during the early cycle phase, +as used in several commercial products~\cite{thigpen_oura_2025, bull_real-world_2019}, +significantly lower pregnancy rates are likely achievable. -\subsection{Model Architectures and Use-Case Performance} -Across architectures, LSTMs consistently outperformed both Transformers and convolutional models in the fertility-probability task. -This was somewhat unexpected given the recent dominance of Transformer-based approaches in sequence modeling. -The advantage of LSTMs likely stems from their strong inductive bias for sequential dependencies -and the relatively small dataset size, which may limit the benefits of more parameter-heavy architectures. -Convolutional models, by contrast, performed competitively on medium-length inputs, -suggesting that localized temporal filters can capture useful features when the history is limited. -However, they struggled with longer input sequences, where recurrent and attention-based models excelled. +As shown in previous sections, irregular cycles require additional caution. +All trained models had difficulty accurately predicting fertile days in these cases. +Therefore, any real-world application must include mechanisms that warn users about +potential inaccuracies and recommend additional precautions when irregular patterns are detected. -Resolution also proved important: medium-resolution inputs produced the strongest results, -suggesting a balance between preserving relevant detail and avoiding noise. -Too fine a resolution may amplify random fluctuations, while too coarse a resolution may obscure important cues. +Future work could explore models that combine predicted fertility probabilities +with contextual features—such as current follicular phase length—to generate +more nuanced contraceptive guidance. -In practical use-case simulations, thresholding had a decisive effect. -For contraception, a low threshold produced Pearl-Index equivalents in the range of 4–5, -which is competitive with or better than common contraceptive methods under typical use. -These numbers, however, must be treated as theoretical projections, since real-world outcomes depend on user behavior, -adherence, and additional protective measures. -For pregnancy planning, results were less directly comparable, reflecting the multifactorial nature of conception. -Nonetheless, the analysis illustrates how probabilistic outputs could be adapted to individual risk preferences, -highlighting the flexibility of machine learning approaches over fixed rules. +\paragraph{Pregnancy Use-Case.} +For the NFP use-case (i.e., attempting to conceive), all trained models achieved +nearly double the pregnancy rate compared to the baselines. +However, at low fertility thresholds, the baseline models showed higher efficiency in terms +of pregnancies per 1000 intercourse events. +Despite this, trained models maintained the overall advantage in total pregnancies per 100 user-years. +At low thresholds, all models achieved approximately 90 pregnancies per 100 user-years, +decreasing to 70--80 at higher thresholds. +The number of correct deferrals, days correctly identified as non-fertile, rose with increasing thresholds, +again suggesting that users may benefit from personalized thresholds depending +on the intensity of their conception efforts. +Most related studies report pregnancy outcomes over 12 cycles, which we assume to represent roughly one year. +We use the 100 user-years metric for consistency. +Since fertility status of couples in our dataset is unknown, we assume that all included users are generally fertile. -%\section{Discussion}\label{sec:discussion} +Related research usually refers to pregnancies per 100 women over 12 cycles. +We assume that, on average 12 cycles represent one year, and thus use the 100 user-years metric as comparison. +We cannot make any assumptions about the fertility of couples in our study, thus we assume that all users sampled +are generally able to conceive. -The model selection study based on the input window length, input resolution and model complexity parameters has shown, -longer input windows and higher complexity seem to be favourable for the purposes of this study. -The convolutional models show better performance for medium length input windows, which might be a limitation -of the model or its convolutional layers. -It thus seems like, the more historical measurements are available, the better +Among commercial fertility monitors, pregnancy rates over 12 cycles range +from 68\% to 72\% (with additional cervical mucus tracking)~\cite{bouchard_achieving_2018}. +Our method reaches approximately 80\%, without requiring additional measures, +placing it at the upper end of current non-invasive fertility prediction tools. -The LSTM and Transformer models also work better with medium resolution input, which suggests a sweet-spot of information. -Too small a resolution might omit important information, while the opposite might introduce too much noise, -that the models in the current configuration cannot handle. -It could be worth investigating how more complex models handle more complex input data, -as this grid-search was not possible in this study due to time and resource limitations. +Interestingly, control group results show that high pregnancy rates are achievable +even without targeted timing: random intercourse (approximately 6 times per month) +resulted in 90 out of 100 women becoming pregnant within one year, which aligns +with literature estimates that ~85\% of couples conceive within a year without +timing-based intervention~\cite{pfeifer_optimizing_2017}. -The study also showed, that the LSTM and Transformer base models outperform the convolutional models. -However, this is only the case for longer input sequences. -When isolating a 40-day input window, the convolutional models outperform the non-convolution models, -which suggests, that there is an informational benefit in the convolution. -However, the convolutional models seem to struggle with longer input windows, -which clearly represent a benefit for the predictive tasks, as the normal LSTM and Transformer models perform better -on longer input windows. -Additional work might be necessary to investigate, whether the convolutional models need additional complexity -or an optimized convolutional pre-processing to deal with longer input sequences. +The benefit of model-based prediction becomes more evident when examining efficiency. +While most related work ignores intercourse frequency, our results show that +trained and baseline models significantly outperform the control group in pregnancies per 1000 intercourse events. +At mid-range threshold values, trained models demonstrated a four-fold increase in efficiency, +indicating that model guidance can substantially optimize the effort-to-outcome ratio for couples trying to conceive. -Overall, the standard LSTM showed the best performance on the fertility-probability target. -This came to our surprise, as we expected the Transformer based architecture to outperform the LSTM based architectures. -The convolutional Transformer had a lower error rate than the convolutional LSTM, which aligned with our expectations. -But it is hard to interpret the results to thoroughly, as they have been taken on single measurement basis. -For a further evaluation, each model should be evaluated multiple times to get statistically more significant and comparable results. -The resource and time limitations of this study did not permit this. +Another useful metric could be time-to-pregnancy across different models and the control group. +The same pregnancy rate over one year can represent conception in the first or twelfth month, +which has practical significance for users. +Including this temporal dimension would allow for a more detailed comparative analysis. -We will be focusing mainly on the predictive quality of the fertility-probability target, -as most selections and evaluations were based on it and the fertility-probability contains the most relevant information -for potential users of the predictions. - -All prediction curve in this section have been generated with the best model selected in section~\ref{subsubsec:results_best_model_config_selection}, -i.e., the LSTM model. -Figure~\ref{fig:discussion_regular_cycle_fertility_prediction} shows the prediction curve for the fertility-probability target -for a user with a regular cycle pattern. -For such a regular cycle pattern, the predictions almost exactly match the targets. -Another noteworthy observation is the correlation between a clear temperature drop preceding ovulation and -the fertility rising. -This can be seen more prominently in Figure~\ref{fig:discussion_temperature_drop_fertility_prediction}. -The model seems to identify that this drop must be an indication for a heightened fertility. -However, this decrease in temperature is not visible for all cycles, and thus significantly impacts the prediction qualities of the model. -Figure~\ref{fig:discussion_spike_in_temperature_drop} shows an anomaly that results in a temperature spike during -the pre-ovulatory temperature dip. -This confuses the model into ending the fertile phase earlier. - -This suggests that the model may interpret the termination of the pre-ovulatory temperature decline as a -signal that ovulation is imminent or has just occurred, thus marking the end of the fertile window. -Another pattern that is visible for many users is a cycle with no clear temperature drop. -Figure~\ref{fig:discussion_unclear_temperature_drop} shows such a curve. -Here, potentially unrelated circumstances lead to a drop in temperature that the model incorrectly identifies as fertile days. -The actual fertile days don't result in an equally visible temperature drop. -This indicates, that a clear temperature drop is a precursor to the ovulation and comes with the fertile days, -but its intensity varies between users and also between cycles of the same user. -Such a pattern can turn out to be a useful predictor for ovulation / fertility, but the models we trained don't seem -to be able to differentiate between ovulation-related and unrelated temperature drops. - -This also points to a potential flaw in our workflow. -We don't yet have clinically accurate labels for the cycles that were used for the training of our models. -In fact, we cannot guarantee an ovulation, not even for the cycles with a clear temperature rise after the apparent ovulation. -The identified temperature drop and the fertility that seems to come with it could be a base for further research -with more accurate ovulation labeling. -It might be an indicator for a successful upcoming ovulation. - - -The results of the irregular vs regular cycle study, as shown in~\ref{subsubsec:regular_vs_irregular_cycles}, -indicate, that the models seem to learn recurrent cycle pattern on a per-user basis. -We conclude this based on the fact, that regular cycle performance is significantly better than the performance on the irregular cycle set. -If there is a reliable indicator in the temperature data, or its ablations, then there would not be a large difference between the two subsets. -The temperature patterns should show up in both regular and irregular cycle users. -Thus, all models must learn or extract information beyond the actual temperature data, which they seem to rely on more than -the temperature related features. -This is likely information indicating some form of regularity, which the models then use to predict the targets for new cycles. -It would be interesting to take a close look at how and in what intensity the models use certain features, -and whether the performance changes upon omitting certain features. - -\paragraph{Use-Case Study.} - -The threshold has a large effect on the overall effectiveness of the different use cases. -For the contraception use case, changing the threshold doubles and even quadruples the pregnancy rate. -It has to be noted, that the contraception use case is naive use-case, where the woman does not take any other -measures next to the prediction of our models. -In a real-world scenario, this is largely not the case, and thus the pregnancy rates should be even lower. -A measure often taken is abstinence during the first cycle phase (luteal phase), which should significantly lower -unwanted pregnancies. -Even without additional measures, a threshold of 0.05 leads to an approximate \emph{Pearl-Index} (pregnancy rate over 1 year for 100 women) -of 4--5, which is significantly better than methods such as the contraceptive pill (7) or the condom (13) for a typical use case. -However, these numbers have to be taken with caution, as this is not an actual study, but a naive theoretical projection. -Further research is necessary to find more reliable results. - -The pregnancy use case is harder to contextualize, as there are no comparable results for other methods, -and the actual pregnancy probability is subject to many more factors, we could not take into consideration for this study. - - -Overall, we conclude, that the body core temperature itself might be a sufficient indicator for pre-ovulation fertility. -However, this marker by itself is prone to anomalies in the data. -When anomalies intercept with the fertile phase and result in unusual temperature shifts, -none of our models were able to avoid erroneous predictions, and we think it will be nearly impossible to do so -just based on the temperature data. -Measuring and correlating other biomarkers or context information could turn out highly effective in detecting such -anomalies and improving the predictive quality of the temperature measurements. -The biological mechanisms that influence body core temperature are highly complex and not yet fully understood. -Many factors can affect it and the resulting temperature curve. -We were not yet able to isolate the ovulation-related temperature fluctuations over time reliably, -but in many cases, they provide highly useful information for NFP or natural contraception. - -For a practical use case of any model's prediction, a medical interpretation should be performed. -While the results themselves can give a clear indication of both the fertility probability and whether the ovulation -of a given cycle is already over for any given day, there a variety of external factors that should be taken into -consideration for a direct output to the user. - - -% 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 - - -% regular vs irregular cycles: mean baselines perform well on regular cycles as expected, as they get closer to the regularities with every past cycle - -% transformer can deal with more data and does also perform better for some cases -% lstm outperforms - -%The findings do not show a clear indication, that the temperature can be used as a predictive target. -%The results of irregular cycles should be significantly better to infer, that there are usable patters in the -%temperature readings before the ovulation or the fertile days. -% - -% add improvements in experiments / comparison -% add better decision base \ No newline at end of file +As in the contraception use-case, all results are based on statistical assumptions +that may not fully hold in real-world scenarios. +Therefore, findings should be interpreted accordingly. +A more detailed investigation of these assumptions, along with further medical interpretation, +would improve the reliability and applicability of the predictions. \ No newline at end of file diff --git a/thesis/sections/introduction.tex b/thesis/sections/introduction.tex index 1c83b1b..08fa6fc 100644 --- a/thesis/sections/introduction.tex +++ b/thesis/sections/introduction.tex @@ -3,6 +3,14 @@ \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_nodate}, such regularity is the exception rather than the rule~\cite{munster_length_1992, bull_real-world_2019}. @@ -31,9 +39,14 @@ others suggest its predictive value for ovulation~\cite{sato_novel_2024, royston 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. @@ -44,8 +57,10 @@ an intravaginal wearable device that continuously measures core body temperature The objective is to develop a machine learning model that performs reliably across diverse cycle types, including irregular ones. To this end, we compare a set of time series-based machine learning architectures and evaluate their performance for NFP and contraception. -Finally, we demonstrate that high predictive accuracy on highly regular, curated datasets, as commonly reported in prior work, -may overestimate real-world applicability, since such datasets tend to favor even simple, rule-based approaches. + +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, @@ -60,4 +75,4 @@ across real-world variability in cycle patterns and user needs: \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} +\end{itemize} \ No newline at end of file diff --git a/thesis/sections/methodology.tex b/thesis/sections/methodology.tex index 05ed43a..56828f2 100644 --- a/thesis/sections/methodology.tex +++ b/thesis/sections/methodology.tex @@ -28,12 +28,12 @@ as they typically indicate erroneous entries, pregnancies, sensor failures, or d In addition, incomplete cycles are filtered out, since new cycles continuously arrive from active users and may not contain the full sequence of data required for retrospective labeling. -Temperature values outside the physiologically plausible range—below 35\textdegree C or above 43\textdegree C—are also excluded, -as they typically result from sensor malfunction or transmission errors. +Temperature values outside the physiologically plausible range, below 35\textdegree C or above 43\textdegree C, +are also excluded, as they typically result from sensor malfunction or transmission errors. \subsubsection{Data Labeling}\label{subsubsec:data_labeling} -Supervised machine learning requires labeled data—i.e., known target values for each input. +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. @@ -65,9 +65,9 @@ The next section details how these labels are incorporated into feature represen The features used as model inputs have been divided into three categories: \begin{itemize} - \item \textbf{Static features} - Characteristics, that remain constant across a user's cycle, such as age, height, or average ovulation day - \item \textbf{Known features} — Inputs known a priori at each time step, such as time of day or calendar-based variables (e.g., month of the year). - \item \textbf{Observable features} — Inputs available at the current time step, including raw and derived temperature values (e.g, rolling averages). + \item \textbf{Static features:} Characteristics, that remain constant across a user's cycle, such as age, height, or average ovulation day + \item \textbf{Known features:} Inputs known a priori at each time step, such as time of day or calendar-based variables (e.g., month of the year). + \item \textbf{Observable features:} Inputs available at the current time step, including raw and derived temperature values (e.g, rolling averages). \end{itemize} The target variables predicted by the model—like ovulation status or fertility probability—are described separately. @@ -208,6 +208,12 @@ Together, the two outputs offer complementary information and improve interpreta 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. +Although the models were trained to predict both targets, and fertility-probability as well as the ovulation-over indicator +are relevant for actual application of the models, the primary focus of this thesis lies on the fertility-probability target, +which is more central to the research objectives. +The ovulation-over indicator is included due to its practical relevance for potential real-world applications, +but it is not analyzed in depth, as it lies outsize the core scope of scientific investigation. + \begin{table}[htbp] \centering \begin{tabular}{@{}lp{0.62\linewidth}@{}} @@ -355,7 +361,7 @@ Additionally, we'll show, how the convolutional hybrids extend their functionali \label{fig:methodology_lstm_architecture} \end{figure} -Recurrent neural networks, particularly GRUs and LSTMs, were tested for their ability to model long-term dependencies in the time series. +Recurrent neural networks, particularly LSTMs, were tested for their ability to model long-term dependencies in the time series. Their sequential memory structure allows them to retain information across cycle days, but they may struggle with high-resolution input and longer sequences. LSTMs, in particular, have a long history of strong performance in sequence prediction tasks. For this study, a stack of LSTM layers was followed by a linear projection layer, mapping the hidden state at the final time @@ -779,7 +785,7 @@ enabling comparability between models and providing interpretable performance me \paragraph{Contraception Use-Case:} For evaluating contraceptive effectiveness, we developed an algorithm inspired by the classical \emph{Pearl Index}, -initially proposed by~\citeauthor{pearl_factors_1933} in~\citeyear{pearl_factors_1933}\cite{pearl_factors_1933}. +initially proposed by~\citeauthor{pearl_factors_1933} in~\citeyear{pearl_factors_1933}~\cite{pearl_factors_1933}. \begin{figure}[htbp] \centering @@ -796,16 +802,14 @@ A day-specific probability of intercourse is computed for each user based on age We assume, that the users don't have any health-related or non-health-related issues affecting fertility. If a user's age is unknown, it is randomly drawn from the overall dataset distribution. Only users with at least one continuous year of data are included. -To get a representative result, we use 500 randomly selected user years. +To get a representative result, we use 100 randomly selected user years. Each day of data for a full year we count the following states by the algorithm: \begin{itemize} \item \emph{Sex}: Intercourse occurred. - \item \emph{No Sex}: no intercourse occurred. + \item \emph{Pregnancy}: fertility prediction allowed intercourse during a potentially fertile period, and it led to a pregnancy. \item \emph{Correct Denial}: fertility prediction correctly indicated abstinence during a fertile period. \item \emph{Incorrect Denial}: fertility prediction incorrectly indicated abstinence during an infertile period. - \item \emph{Pregnancy}: fertility prediction allowed intercourse during a potentially fertile period, and it led to a pregnancy. - \item \emph{No Pregnancy}: fertility prediction allowed intercourse during an infertile or potentially fertile period, but it did not lead to a pregnancy. \end{itemize} This categorization captures both the contraceptive accuracy (avoiding pregnancy) and the practicality @@ -813,6 +817,10 @@ This categorization captures both the contraceptive accuracy (avoiding pregnancy An algorithm achieving perfect contraceptive accuracy by always recommending abstinence would score highly but significantly limit user acceptability and utility. +To add a control group, we compute the potential pregnancies and number of sexual intercourse without using the models predictions, +i.e., the group does not use any contraception. +In this case, sexual intercourse can happen unrestricted on every day. + \paragraph{Pregnancy Use-Case:} For the pregnancy use-case, we developed a complementary algorithm to evaluate model performance for users attempting to conceive. @@ -834,21 +842,22 @@ we assume an average frequency of six times per month. We assume no health-related fertility impairments for comparative simplicity, though we acknowledge that real-world fertility is influenced by numerous complex factors. Similar to the contraception scenario, only users with at least one continuous year of data are considered. -For representative results, we use 500 randomly selected user years. +For representative results, we use 100 randomly selected user years. For each day in a full year we count occurrences of the following states: \begin{itemize} \item \emph{Sex}: Intercourse occurred - \item \emph{No Sex}: No intercourse \item \emph{Pregnancy}: Correct fertile prediction, intercourse occurred, resulting in pregnancy. - \item \emph{No Pregnancy}: Correct fertile prediction, intercourse occurred, but no pregnancy occurred. - \item \emph{Incorrect Deferral}: Incorrect non-fertile prediction, actual fertility was above threshold. \item \emph{Correct Deferral}: Correct non-fertile prediction. + \item \emph{Incorrect Deferral}: Incorrect non-fertile prediction, actual fertility was above threshold. \end{itemize} This classification measures both fertility prediction accuracy and the impact of incorrect deferrals. A model overly predicting fertility would increase potential pregnancy rates but negatively affect usability and trust due to misdirected efforts. +For the pregnancy case, we also compute a control group. +Here, every day is considered potentially fertile and thus allows for intercourse. + \subsection{Ethical Considerations}\label{subsec:ethical_considerations} This study was conducted using pseudonymized data collected in accordance with the terms of service and privacy policy of the data provider, VivoSensMedical GmbH (Leipzig, Germany). diff --git a/thesis/sections/related_work.tex b/thesis/sections/related_work.tex index 3597be3..5cf06e0 100644 --- a/thesis/sections/related_work.tex +++ b/thesis/sections/related_work.tex @@ -17,8 +17,8 @@ In~\citeyear{wallach_prediction_1980}, \citeauthor{wallach_prediction_1980} iden including salivary ferning and viscosity, serum levels of progesterone and estrogen, and urinary luteinizing hormone (LH) concentrations~\cite{wallach_prediction_1980}. These indicators showed strong correlation with ovulation timing as measured via transvaginal ultrasound. -\citeauthor{noauthor_monitoring_1987} later expanded on this work by focusing specifically on LH and estradiol, -confirming that LH surges reliably indicate an imminent ovulation event. +\citeauthor{vermesh_monitoring_1987} later expanded on this work by focusing specifically on LH and estradiol, +confirming that LH surges reliably indicate an imminent ovulation event~\cite{vermesh_monitoring_1987}. Despite their diagnostic value, many of these biomarkers are difficult to measure continuously and reliably in everyday settings, limiting their practicality for real-time or large-scale applications. @@ -36,7 +36,7 @@ However, several studies have raised concerns about its reliability as a predict high susceptibility to external confounders, recommending caution in its clinical or research use~\cite{bauman_basal_1981}. Similarly, \citeauthor{moghissi_accuracy_1976} emphasized its limited accuracy, particularly in cycles with irregularities~\cite{moghissi_accuracy_1976}. -However, such conclusions were largely based on the standard BBT method, which relies on a single-point measurement taken +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. @@ -78,10 +78,27 @@ For menstruation prediction, the model detected 70.70\% of menstruation days in These results indicate that the model performed well in regular cycles but struggled with irregularity, particularly in detecting the fertile window. -Complementing academic efforts, several commercial products have adopted temperature-based tracking, -such as \textit{Ava}~\cite{sl_ava_nodate}, \textit{Daysy}~\cite{electronics_zykluscomputer_nodate}, \textit{Trackle}~\cite{noauthor_trackle_nodate} -or \textit{Natural Cycles}~\cite{noauthor_natural_nodate}. -However, these products typically rely on proprietary algorithms, and no peer-reviewed publications are available detailing their methodology or performance. +In~\citeyear{kilungeja_machine_2025},~\citeauthor{kilungeja_machine_2025} trained a set of classification models +to predict the cycle phase a day based on skin temperature, electrodermal activity, interbeat interval and heart rate. +The measurements were automatic and did not require manual participant input~\cite{kilungeja_machine_2025}. +The classification was either into three or four targets: period, ovulation, luteal phase, and follicular phase for the four-class models. +Their dataset included 65 cycles across 18 subjects. +They trained a decision tree, random forest ensemble, logistic regression and support vector machine to enable +an architectural comparison. +Results show an edge for the random forest model with a reported 87\% accuracy and AUC-ROC (area under the receiver operating characteristic curve) +of 0.96 for the three class approach. +The four class approach significantly reduced accuracy to 68\% and AUC-ROC of 0.77. +There was no separation into cycle groups and all cycles were in a regular group, with a mean lengths of 28 days (SD: 1.65). + +There are some additional studies based on commercial products, such as \emph{Oura Ring}\cite{thigpen_oura_2025} +or \emph{Natural Cycles}\cite{bull_real-world_2019} that work with temperature data as a base. +However, they all focus on retrospective ovulation-detection and often complement this with advice to remain +abstinent during the first cycle phase until the ovulation was reliably detected. +This way they can offer a contraceptive product option, without needing to create a predictive model or algorithm. + +Complementing academic efforts, several other commercial products have also adopted temperature-based 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 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. diff --git a/thesis/sections/results.tex b/thesis/sections/results.tex index d76d81f..8585aa6 100644 --- a/thesis/sections/results.tex +++ b/thesis/sections/results.tex @@ -6,11 +6,14 @@ % find introduction -\subsection{RQ1: Comparative Study of Model Architectures}\label{subsec:rq1_temp_predictive_value} +\subsection{Objective 1: Comparative Study of Model Architectures}\label{subsec:rq1_temp_predictive_value} We systematically evaluated multiple model architectures to assess their performance in predicting the targets. -We report results for two targets: (i) fertility probability and (ii) an indicator that ovulation has already occurred (OV-Over). +We mainly report results for the fertility probability target. +Results for the second target, an indicator that ovulation has already occurred (OV-Over), +can be found in Appendix~\ref{sec:appendix_ov_over_results} + Each architecture was tested across a range of input window lengths, temporal resolutions, and model capacities. The best-performing configurations for each architecture were selected for downstream analyses. Unless stated otherwise, \textbf{MSE} is the primary metric (equivalent to the Brier score for probabilistic targets), @@ -178,148 +181,6 @@ with full results in Appendix Tables~\ref{tab:fertility_results_by_model_paramet \label{tab:fertility_params_compact_mse} \end{table} -\subsubsection{Ovulation-Over Prediction}\label{subsubsec:ov_over_prediction} - -We evaluate prediction of a binary indicator denoting whether ovulation has already occurred. -We examine the influence of input window length, input resolution, and model capacity. - -\paragraph{Impact of input window length.} -For predicting whether ovulation has occurred (OV-over), -optimal window lengths again vary by architecture and target phase (pre- vs post-ovulation). - -The \textbf{Transformer} yields the lowest overall (0.0533) and post-ovulation MSE (0.0520) at 40 days. -The \textbf{LSTM} performs best before ovulation (MSE 0.0212 at 20 days), while its overall MSE improves with longer context (160 days). - -The \textbf{Convolutional LSTM} favors short windows, with the best overall MSE (0.0699), before-OV (0.0389), -and after-OV (0.0833) all occurring at 20 days. -The \textbf{Convolutional Transformer} performs best overall at 40 days and best before ovulation at 160 days (MSE 0.0286). -See Table~\ref{tab:ovover_windows_compact_mse} for a summary. - -\begin{table}[t] - \small - \renewcommand{\arraystretch}{1.15} - \setlength{\tabcolsep}{6pt} - \begin{tabularx}{\linewidth}{l*{3}{>{\centering\arraybackslash}X}} - \toprule - \textbf{Architecture} & \multicolumn{3}{c}{\textbf{MSE}} \\ - \cmidrule(r){2-4} - & \shortstack[c]{Overall best\\(days / MSE)} - & \shortstack[c]{Before-OV best\\(days / MSE)} - & \shortstack[c]{After-OV best\\(days / MSE)} \\ - \midrule - LSTM - & 160 / 0.0557 - & \textbf{20 / 0.0212} - & 160 / 0.0580 \\ - Transformer - & \textbf{40 / 0.0533} - & 20 / 0.0255 - & \textbf{40 / 0.0520} \\ - Convolutional LSTM - & 20 / 0.0699 - & 20 / 0.0389 - & 20 / 0.0833 \\ - Convolutional Transformer - & 40 / 0.0709 - & 160 / 0.0286 - & 40 / 0.0820 \\ - \bottomrule - \end{tabularx} - \caption{OV-Over: best input window per architecture (MSE only) at a fixed input resolution of 12 values/day. - Bold entries are bests within a column.} - \label{tab:ovover_windows_compact_mse} -\end{table} - -\paragraph{Impact of input resolution.} -Fixing the input window to 20 days, we compare input resolutions for LSTM and Transformer models. - -For the \textbf{LSTM}, the lowest overall MSE (0.0633) occurs at 24/day, -with best before-OV and after-OV MSEs at 12/day (0.0212) and 48/day (0.0550), respectively. - -The \textbf{Transformer} performs best overall at 72/day (0.0585), -with lowest before-OV MSE at 12/day (0.0255) and after-OV MSE at 288/day (0.0578). - -Results are summarized in Table~\ref{tab:ovover_resolution_compact_mse}; -full resolution grids are in Appendix Table~\ref{tab:ov_over_results_by_resolution}. - -\begin{table}[t] - \small - \renewcommand{\arraystretch}{1.15} - \setlength{\tabcolsep}{6pt} - \begin{tabularx}{\linewidth}{l*{3}{>{\centering\arraybackslash}X}} - \toprule - \textbf{Architecture} & \multicolumn{3}{c}{\textbf{MSE}} \\ - \cmidrule(r){2-4} - & \shortstack[c]{Overall best\\(values/day / MSE)} - & \shortstack[c]{Before-OV best\\(values/day / MSE)} - & \shortstack[c]{After-OV best\\(values/day / MSE)} \\ - \midrule - LSTM - & 24 / 0.0633 - & \textbf{12 / 0.0212} - & \textbf{48 / 0.0550} \\ - Transformer - & \textbf{72 / 0.0585} - & 12 / 0.0255 - & 288 / 0.0578 \\ - \bottomrule - \end{tabularx} - \caption{OV-Over: best input resolution per architecture (MSE only) at a fixed input-window length of 20\,days. - Bold entries are bests within a column. Convolutional models are excluded (they consume 288 values/day internally).} - \label{tab:ovover_resolution_compact_mse} -\end{table} - -\paragraph{Impact of model parameters.} -Using fixed input settings (160 days at 12/day for LSTM/Transformer; 40 days for convolutional models), we evaluate model scaling. - -The \textbf{Transformer} achieves the lowest overall (0.0543) and after-ovulation MSE (0.0410) at a large configuration (512×8×8). -Before-OV MSE is lowest at 256×4×4 (0.0293). - -For the \textbf{LSTM}, the best overall and after-OV performance is at 512×4, -while the best before-OV MSE occurs at 128×2 (0.0274). -The \textbf{Convolutional LSTM} performs best overall and after-OV at 256×4, with the best before-OV MSE at 128×2. - -Finally, the \textbf{Convolutional Transformer} achieves its lowest overall and after-OV MSE at 512×4×4, and best before-OV MSE at 512×8×8. - -Table~\ref{tab:ovover_params_compact_mse} summarizes these parameter-dependent results; -full comparisons are included in Appendix Tables~\ref{tab:ov_over_results_by_model_parameters_lstm}–\ref{tab:ov_over_results_by_model_parameters_conv_transformer}. - -\begin{table}[t] - \scriptsize - \renewcommand{\arraystretch}{1.15} - \setlength{\tabcolsep}{6pt} - \begin{tabularx}{\linewidth}{l*{3}{>{\centering\arraybackslash}X}} - \toprule - \textbf{Architecture} & \multicolumn{3}{c}{\textbf{MSE}} \\ - \cmidrule(r){2-4} - & \shortstack[c]{Overall best\\(params / MSE)} - & \shortstack[c]{Before-OV best\\(params / MSE)} - & \shortstack[c]{After-OV best\\(params / MSE)} \\ - \midrule - LSTM - & \(512\times4\) / 0.0616 - & \textbf{\(128\times2\) / 0.0274} - & \(512\times4\) / 0.0613 \\ - Transformer - & \textbf{\(512\times8\times8\) / 0.0543} - & \(256\times4\times4\) / 0.0293 - & \textbf{\(512\times8\times8\) / 0.0410} \\ - Convolutional LSTM - & \(256\times4\) / 0.0687 - & \(128\times2\) / 0.0357 - & \(256\times4\) / 0.0715 \\ - Convolutional Transformer - & \(512\times4\times4\) / 0.0703 - & \(512\times8\times8\) / 0.0339 - & \(512\times4\times4\) / 0.0814 \\ - \bottomrule - \end{tabularx} - \caption{OV-Over: best parameter settings per architecture (MSE only). - Parameters are formatted as \(\text{hidden}\times\text{layers}\) (LSTM/Conv.\ LSTM) and \(\text{embedding}\times\text{encoder layers}\times\text{heads}\) (Transformer/Conv.\ Transformer). - Bold values indicate bests within a column. Fixed input settings: 160\,days with 12 values/day for LSTM/Transformer; 40\,days for convolutional models.} - \label{tab:ovover_params_compact_mse} -\end{table} - \subsubsection{Best Model Configuration Selection}\label{subsubsec:results_best_model_config_selection} To identify the best configuration for each model architecture, we followed the procedure described in Section~\ref{subsubsec:methodology_best_model_config_selection}. @@ -408,7 +269,7 @@ confirming the advantage of personalized and temporally-aware modeling. % ------------------------------------------------------------------------------------------------------------------------------- -\subsection{RQ2: Factors and Patterns that Influence Predictions}\label{subsec:rq2_factors_and_patterns} +\subsection{Objective 2: Factors and Patterns that Influence Predictions}\label{subsec:rq2_factors_and_patterns} \subsubsection{Representative predictions}\label{subsubsec:rq2_examples} @@ -517,7 +378,7 @@ but show greater scatter for users with longer data records. % ------------------------------------------------------------- -\subsection{RQ3: Performance across Regular and Irregular Cycles}\label{subsec:rq3_regular_vs_irregular} +\subsection{Objective 3: Performance across Regular and Irregular Cycles}\label{subsec:rq3_regular_vs_irregular} \begin{table}[htbp] \centering @@ -568,59 +429,6 @@ Baselines degrade more sharply in this group. The full table with MSE and MAE for all models can be found in the appendix, Table~\ref{tab:regular_vs_irregular_fertility_results}. -\vspace{1em} - -\begin{table}[htbp] - \centering - \small - \begin{tabularx}{\linewidth}{l*{3}{X}} - \toprule - \multirow{2}{*}{Model} & \multicolumn{3}{c}{MSE} \\ - \cmidrule(r){2-4} - & OV-Over Overall & OV-Over Before OV & OV-Over After OV \\ - \midrule - \multicolumn{4}{c}{\textbf{Regular Cycle Group}} \\ - \midrule - LSTM & \textbf{0.028519} & 0.031695 & \textbf{0.026116} \\ - Transformer & 0.032929 & \textbf{0.024774} & 0.033411 \\ - Convolutional LSTM & 0.034224 & 0.028962 & 0.033929 \\ - Convolutional Transformer & 0.033333 & 0.039045 & 0.029329 \\ - Last-Cycle Baseline & 0.087916 & 0.093465 & 0.074191 \\ - Population Mean Baseline & 0.285887 & 0.008876 & 0.418879 \\ - User Mean Baseline & 0.069245 & 0.069152 & 0.055724 \\ - \midrule - \multicolumn{4}{c}{\textbf{Irregular Cycle Group}} \\ - \midrule - LSTM & \textbf{0.051747} & \textbf{0.016777} & 0.070419 \\ - Transformer & 0.055990 & 0.026159 & 0.067520 \\ - Convolutional LSTM & 0.054523 & 0.030092 & \textbf{0.066643} \\ - Convolutional Transformer & 0.056075 & 0.029638 & 0.067965 \\ - Last-Cycle Baseline & 0.222906 & 0.134945 & 0.258047 \\ - Population Mean Baseline & 0.171368 & 0.130366 & 0.140363 \\ - User Mean Baseline & 0.180702 & 0.088884 & 0.217144 \\ - \bottomrule - \end{tabularx} - \caption{MSEs for ovulation-over target across different model architectures for regular and irregular cycle groups. Bold values denote the best scores per column.} - \label{tab:ov_over_mse_regular_irregular} -\end{table} - -\noindent -Table~\ref{tab:ov_over_mse_regular_irregular} shows the MSE metric results for all models on the regular and irregular cycle groups for the OV-over target. -For this target, performance patterns differ more distinctly across phases. -In the regular group, the LSTM performs best overall and after ovulation, while the Transformer performs best before ovulation. -Convolutional models perform slightly worse than their recurrent and transformer-based counterparts across all phases. -The population mean baseline shows a spurious low MSE before ovulation, but this is not consistent across phases, suggesting it is not reliable. -In general, baselines are notably weaker than learned models across all splits. - -For irregular cycles, all model performances deteriorate relative to regular cycles. -The LSTM remains the most robust, achieving the best MSEs both overall and before ovulation. -Convolutional LSTM performs best after ovulation. -Transformer-based models perform less consistently in this group, suggesting decreased robustness to cycle irregularity. -As before, all learned models outperform the baselines by a wide margin. - -The full table with MSE and MAE for all models can be found in the appendix, Table~\ref{tab:regular_vs_irregular_ov_over_results}. - - \begin{figure}[htbp] \centering \includegraphics[width=0.8\textwidth]{resources/figures/results/model_results_on_regular_cycles} @@ -645,7 +453,7 @@ visualize performance improvements with increasing numbers of past cycles. For regular cycles, all models except the population-mean baseline benefit from more historical data, showing consistent MSE reductions for both targets. Interestingly, the population-mean baseline performs worse as more cycles are added. The largest improvement can be seen for the last-cycle baseline and user-mean baseline models. -The outliers in the last-cycle and user-mean baseline are MSE values of 0.0, which result in these vertical lines. +The outliers in the last-cycle and user-mean baseline are MSE values of 0.0, which result in vertical lines based on the logarithmic scaling of the axis. In contrast, irregular cycles exhibit more variability and less performance gain with more cycles available. All trained models improve on both targets with more context. @@ -662,7 +470,7 @@ as indicated by the wider deviations from the trend lines. % ------------------------------------------------------------- -\subsection{RQ4: Use-Case Evaluations}\label{subsec:rq4_use_case_evaluations} +\subsection{Objective 4: Evaluating Use-Case Scenarios}\label{subsec:rq4_use_case_evaluations} We evaluated the use-case scenarios described in Section~\ref{subsubsec:practical_use_cases} using the algorithms in Section~\ref{subsubsec:use_case_evaluation} across multiple fertility thresholds. @@ -687,7 +495,7 @@ The four evaluated metrics are: number of pregnancies, number of intercourse eve number of correct denials (i.e., appropriately flagged fertile days), and number of incorrect denials (i.e., fertile days incorrectly flagged as infertile). -\paragraph{Pregnancies.} +\paragraph{Potential Pregnancies.} All trained models start with very low pregnancy rates (Transformer: 0, LSTM: 4) and then increase roughly linearly with the threshold, reaching between 99 (Convolutional Transformer) and 122 (Transformer) at the highest setting. @@ -696,12 +504,16 @@ The Transformer starts with the lowest pregnancy rate but rises steeply, ending with the highest number of pregnancies at threshold 0.1. By comparison, the baselines show much higher pregnancy rates throughout, starting between 103 (user-mean) and 150 (population-mean) and increasing by about 50 pregnancies over the range of thresholds. +The control group, which does not use any predictions shows very high potential pregnancy rates at 274 for 100 user years. +Note, that the thresholds do not alter the control group, as intercourse can happen on any day by design. \paragraph{Intercourse Events.} All trained models except the LSTM begin with low values of about 1000 intercourse events. The LSTM starts much higher, around 3000, and increases sharply, converging toward approximately 6100. All trained model variants show curved growth resembling logarithmic convergence, approaching the same upper range. In contrast, the baselines start near 6000 events and converge toward the same levels as the trained models at higher thresholds. +Here, the control group allows for 7610 intercourse events, which is also the maximum for 100 user years by design, +since no denials happen. \paragraph{Correct Denials.} The number of correct denials decreases by about half across the tested thresholds. @@ -732,6 +544,7 @@ and the number of pregnancies per 1000 intercourse events. Here, the difference between the models becomes clearer. The baselines start at 62 to 73 pregnancies per 100 users and become linearly worse over the threshold range. +The control group results in 90 pregnant users of 100 for a year. The LSTM performs worse than all other trained models, except for the upper end of the threshold interval. The Transformer, while being the best model for small thresholds, becomes worse over growing values until being on par with @@ -764,18 +577,20 @@ and number of incorrect deferrals (i.e., fertile days incorrectly flagged as inf The overall pattern mirrors the contraception use-case, but the optimization goal is reversed: here, a higher number of pregnancies is desirable. -\paragraph{Pregnancies.} +\paragraph{Potential Pregnancies.} Trained models achieve substantially higher pregnancy rates than the baselines. They begin at around 275 pregnancies for low thresholds and decline linearly to between 157 and 176 at higher thresholds. By contrast, the baselines start much lower (user-mean: 159, last-cycle: 139, population-mean: 117) and also decrease linearly, reaching 119, 102, and 71 pregnancies, respectively. This places all trained models well above baseline performance across the full threshold range. +The control group results in 261 potential pregnancies for 100 user years. \paragraph{Intercourse Events.} Trained models start with high numbers of intercourse events, near 7000, except for the LSTM which begins lower at 4252. All decline sublinearly and converge toward approximately 1500 at the highest thresholds. In contrast, the baselines start far lower, between 1700 and 1900, and decrease linearly to about 1300. Thus, the improved pregnancy rates of trained models come at the cost of substantially higher intercourse event counts. +Here, the control group allows for 7258 intercourse events, which is again the maximum possible for that interval by design. \paragraph{Correct Deferrals.} The baselines initially show higher numbers of correct deferrals, with values that increase linearly as thresholds rise. @@ -804,9 +619,11 @@ To facilitate comparison here as well, Figure~\ref{fig:results_pregnancy_use_cas normalized pregnancy metrics across fertility thresholds: the number of pregnancies per 100 users per year, and the number of pregnancies per 1000 intercourse events. -All trained models clearly result in more pregnancies per 100 users overall. +All trained models clearly result in more pregnancies per 100 users than the baselines. However, for lower fertility thresholds, there are fewer pregnancies per 1000 intercourse events for the trained models compared to the baselines. +The control group attains 90 pregnant users per 100 for a year, which is on par with the trained models for low thresholds. +The efficiency is much lower than both trained and baseline models with 36 pregnancies per 1000 intercourse events. \paragraph{Summary.} In the pregnancy use-case, trained models clearly outperform baselines in terms of pregnancy rates, @@ -820,7 +637,7 @@ There is an edge for the non-convolutional models for smaller thresholds that sw % ------------------------------------------------------------- -\subsection{Summary of key results}\label{subsec:key_results} +\subsection{Summary of Key Results}\label{subsec:key_results} % Keep this as a tight bulleted list mirroring RQs; strictly findings, no causes/interpretations. %\begin{itemize}[leftmargin=*] @@ -832,10 +649,10 @@ There is an edge for the non-convolutional models for smaller thresholds that sw % the largest margins occur on post-ovulation metrics. %\end{itemize} -\noindent\textbf{RQ1 (Architectures, context, and capacity).} +\noindent\textbf{Objective 1: Architectures, context, and capacity.} \begin{itemize} \item \emph{Architectures.} All learned models beat baselines by a wide margin. - The \textbf{LSTM} is the most reliable overall and post-ovulation; the \textbf{Transformer} is strongest on fertile days. + The LSTM is the most reliable overall and post-ovulation; the Transformer is strongest on fertile days. Convolutional variants are competitive but rarely best. \item \emph{Temporal context.} Performance depends on window length and differs by model. @@ -855,10 +672,10 @@ There is an edge for the non-convolutional models for smaller thresholds that sw \item LSTM is best \emph{overall}: fertility MSE \(0.0036\) (best overall; best non-fertile \(0.0008\)) and OV-over overall \(0.0437\) (best; best after-OV \(0.0492\)). Transformer is best on fertile days (MSE \(0.0089\)). - \item Versus the strongest baseline (User-Mean), LSTM cuts fertility MSE by \(\sim 44\%\) and post-ovulatory MSE by \(\sim 59\%\). + \item Versus the strongest baseline (User-Mean), LSTM cuts fertility MSE by \(\sim 44\%\) and ov-over MSE by \(\sim 59\%\). \end{itemize} -\noindent\textbf{RQ2 (Factors and Patterns).} +\noindent\textbf{Objective 2: Factors and Patterns.} \begin{itemize} \item Models consistently key on the \emph{pre-ovulatory temperature drop}; larger drops yield higher predicted fertility. This pattern weakens in irregular cycles with noisier temperature traces (Figures~\ref{fig:results_rq2_regular_cycle_predictions_example}–\ref{fig:results_rq2_irregular_cycle_predictions_example}, \ref{fig:results_temperature_drop_pattern}). @@ -867,7 +684,7 @@ There is an edge for the non-convolutional models for smaller thresholds that sw Baselines do not: Last-Cycle and Population-Mean often degrade with more history (Figure~\ref{fig:results_performance_on_different_historical_context}). \end{itemize} -\noindent\textbf{RQ3 (Regular vs.\ Irregular).} +\noindent\textbf{Objective 3: Regular vs.\ Irregular.} \begin{itemize} \item All models are better on \emph{regular} cycles. For fertility, Transformer leads overall and on fertile days; LSTM leads on non-fertile days. @@ -879,7 +696,7 @@ There is an edge for the non-convolutional models for smaller thresholds that sw \item Variance of predictions grow with longer context lengths. \end{itemize} -\noindent\textbf{RQ4 (Use-case Evaluations).} +\noindent\textbf{Objective 4: Use-case Evaluations.} \begin{itemize} \item \emph{Contraception:} Trained models cut pregnancies sharply vs baselines, at the cost of more denials and fewer intercourse opportunities.