diff --git a/thesis/resources/figures/results/lstm_fertility_results_by_resolution.png b/thesis/resources/figures/results/lstm_fertility_results_by_resolution.png index 0444f93..97dea6b 100644 Binary files a/thesis/resources/figures/results/lstm_fertility_results_by_resolution.png and b/thesis/resources/figures/results/lstm_fertility_results_by_resolution.png differ diff --git a/thesis/resources/figures/results/transformer_ov_over_results_by_input_length.png b/thesis/resources/figures/results/transformer_ov_over_results_by_input_length.png index 1e1f3ed..a63e00e 100644 Binary files a/thesis/resources/figures/results/transformer_ov_over_results_by_input_length.png and b/thesis/resources/figures/results/transformer_ov_over_results_by_input_length.png differ diff --git a/thesis/sections/discussion.tex b/thesis/sections/discussion.tex index e322d92..759daf0 100644 --- a/thesis/sections/discussion.tex +++ b/thesis/sections/discussion.tex @@ -7,11 +7,21 @@ In this study, we investigated the performance of different machine learning architectures on the task of fertility prediction, with the aim to find a model that performs well for natural family planning and natural contraception on regular and irregular cycles. -Our goal was to Based on an extensive real-world database and established model architectures for timeseries analysis, -we expect to outperform both rule-based baselines and related studies. -We think, that for regular cycles, the performance difference will be lower than +we expect our models to outperform the rule-based baselines. +We think, that for regular cycles, the performance difference will be lower than irregular cycles, +as the baseline models have no way of adapting to irregularities. + +In general, we expect the transformer based model to outperform the LSTM basd models, as they have proven to be +a more effective for time-series analysis tasks especially for longer sequences. +We also expect to find similar performance on irregular cycles compared to regular cycles, +if the temperature is a reliable predictive indicator for the ovulation. +If the performance on irregular cycles is significantly worse, and the predicted fertility curves see no upward trend around +the actual fertility curves, we have no reason to believe that there is any predictive value in the temperature as is. + +Results do not show any clear indication that the temperature contains any patterns useful for the prediction of +fertility or the ovulation. % talk about whether bbt / temperature can be used for such a task, discuss bbt doubt papers @@ -30,7 +40,6 @@ of a given cycle is already over for any given day, there a variety of external consideration for a direct output to the user. - \section{Future Work}\label{sec:future_work} There are several directions in which this study could be extended, most of which were omitted due to time and resource constraints but represent valuable areas for future exploration. @@ -39,8 +48,13 @@ One major area is feature selection. The dataset used includes additional user-entered markers such as physiological signs (e.g., bleeding, illness, stress) and external events (e.g., intercourse, pregnancy tests). These markers were not included in the present analysis but may carry predictive value and could meaningfully improve model performance. -Similarly, the introduction of engineered or intermediate features—derived from raw inputs—may help models better +Similarly, the introduction of engineered or intermediate features, derived from raw inputs, may help models better capture relevant patterns and temporal dependencies. +Additionally, the target features could be modelled in a better way, as, especially for long cycles, +there is a large imbalance of value distribution. +If a cycle has a length of 100 days with an ovulation at day 90, only 10\% of the ovulation-over targets are one. +The same applies to the fertility target, which will be zero throughout almost the whole sequence, +which will make it harder for the models to learn useful information. Alternative target formulations could also be explored to better reflect the structure of the fertile window and ovulation. For example, instead of predicting a daily fertility probability, models could aim to identify the absolute day of ovulation, diff --git a/thesis/sections/methodology.tex b/thesis/sections/methodology.tex index 044c8e1..31a693b 100644 --- a/thesis/sections/methodology.tex +++ b/thesis/sections/methodology.tex @@ -607,16 +607,10 @@ This is particularly relevant for model comparison, where disproportionate error Moreover, since the fertility probability target was trained using an MSE-based loss function, this metric directly reflects the optimization objective. -Additionally, we add the coefficient of determination (\(R^2\)) regression score: -\begin{align} - R^2 = 1 - \frac{\sum_{i=1}^n (y_i - \hat{y}_i)^2}{\sum_{i=1}^n (y_i - \bar{y})^2} -\end{align} -where \(y_i\) is the observed value, \(\hat{y}_i\) the predicted value, -\(\bar{y}\) is the mean of observed values and \(n\) is the number of observations. - -This coefficient indicates the proportion of total variance in the target that is explained by the model. -Since \( R^2 \) is specific to regression tasks, it is only applied to the fertility probability target. -All models operate on the same inputs and targets, so adjusted \( R^2 \) is not required. +We considered including the coefficient of determination (\(R^2\)) as an evaluation metric. +However, we found that the target windows frequently exhibited very low variance, +a condition under which \(R^2\) becomes unstable and potentially misleading. +As a result, we decided to exclude it from our evaluation. To enable a more nuanced comparison of model performance, we complement the overall error metrics with targeted evaluations at biologically relevant subregions of the prediction sequence. @@ -643,25 +637,19 @@ Tables~\ref{tab:fertility_mae_metrics} and~\ref{tab:ov_over_mae_metrics} summari \renewcommand{\arraystretch}{1.3} % spacing between rows \begin{tabular}{@{}p{0.35\linewidth}p{0.60\linewidth}@{}} \toprule - \textbf{Metric Name} & \textbf{Description} \\ + \textbf{Metric Name} & \textbf{Description} \\ \midrule \multicolumn{2}{@{}l}{\textbf{Mean Absolute Error}} \\ \midrule - Fertility Overall & MAE over the entire sequence. \\ - During-Fertility & MAE during the fertile phase. \\ - Non-Fertility & MAE on the non-fertile days. \\ + Fertility Overall & MAE over the entire sequence. \\ + During-Fertility & MAE during the fertile phase. \\ + Non-Fertility & MAE on the non-fertile days. \\ \midrule \multicolumn{2}{@{}l}{\textbf{Mean Squared Error}} \\ \midrule - Fertility Overall & MSE over the entire sequence. \\ - During-Fertility & MSE during the fertile phase. \\ - Non-Fertility & MSE on the non-fertile days. \\ - \midrule - \multicolumn{2}{@{}l}{\textbf{Coefficient of Determination (\(R^2\))}} \\ - \midrule - Fertility Overall & \(R^2\) over the entire sequence. \\ - During-Fertility & \(R^2\) during the fertile phase. \\ - Non-Fertility & \(R^2\) on the non-fertile days. \\ + Fertility Overall & MSE over the entire sequence. \\ + During-Fertility & MSE during the fertile phase. \\ + Non-Fertility & MSE on the non-fertile days. \\ \bottomrule \end{tabular} \caption{Evaluation metrics of the fertility probability target based on mean absolute error (MAE) at various intervals across the predicted fertility window.} @@ -717,7 +705,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}. +initially proposed by~\citeauthor{pearl_factors_1933} in~\citeyear{pearl_factors_1933}\cite{pearl_factors_1933}. \begin{figure}[htbp] \centering diff --git a/thesis/sections/results.tex b/thesis/sections/results.tex index 4aa16c8..85a99f5 100644 --- a/thesis/sections/results.tex +++ b/thesis/sections/results.tex @@ -61,7 +61,7 @@ Additionally, model performance is compared to the three baseline models introdu % show why I selected the individual input configs for model config training % selected by best mse fertility, use 2nd best, as it provides basically the same performance, but more input data for more complex model configs -\subsubsection{Performance Across Fertile Window}\label{subsubsec:fert_performance_across_fertile_window} +\subsubsection{Fertility Probability Prediction}\label{subsubsec:fertility_probability_prediction} \subsubsection{Impact of Input Resolution}\label{subsubsec:fert_impact_of_input_resolution} @@ -69,7 +69,7 @@ Additionally, model performance is compared to the three baseline models introdu \subsubsection{Comparison with Baselines}\label{subsubsec:fert_comparison_with_baselines} -\subsection{Ovulation-Over Prediction Accuracy}\label{subsubsec:ov_over_prediction_accuracy} +\subsection{Ovulation-Over Prediction}\label{subsubsec:ov_over_prediction} \subsubsection{Performance around Ovulation}\label{subsubsec:ov_over_performance_around_ovulation}