From fcdad672c7a578153df93828c07f9ec8c8295b85 Mon Sep 17 00:00:00 2001 From: Niclas Date: Mon, 16 Mar 2026 10:52:49 +0100 Subject: [PATCH] added plot with alpha dependence --- scripts/plots_a_dependence.qmd | 69 ++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/scripts/plots_a_dependence.qmd b/scripts/plots_a_dependence.qmd index f9a79ca..89e02c6 100644 --- a/scripts/plots_a_dependence.qmd +++ b/scripts/plots_a_dependence.qmd @@ -241,4 +241,73 @@ title(main="Vectors for a rescaled to norm one.") It seems, that the direction of the parameter $a$ has a small influence in the smallest singular value of the matrix $Q$, but not the norm of it?? + + + ## Michael's Plot + Here we plot for each $n$ the smallest singular value of $Q$. We choose the + parameter $K$ as + $$ + K = \lfloor n^\alpha \rfloor + $$ + with $\alpha \in \{0.1, 0.2, 0.3, 0.4, 0.5\}$. + + +```{r Plot for different alphas} +#| cache: true +#| echo: false +#| collapse: true +ns <- seq(100, 1000, 100) +as <- c(1.0, 2, 5, 10, 20) +alphas <- seq(0.1, 0.5, 0.1) + +set.seed(100) +results <- data.frame(dim_n = integer(), + dim_k = integer(), + param_a = double(), + param_alpha = double(), + ssv = double()) +for (a in as) { + for (i in 1:length(ns)) { + for (j in 1:length(alphas)) { + n <- ns[i] + K <- floor(n^alphas[j]) + if (!K > 0) next # skip if K is equal to zero + # use the default seed 1L + Q <- compute_matrix(seed=1L, + a= a, + n = n, + K = K, + sample_X_fn = function(n) {matrix(rnorm(n), ncol = 1L)}, + fv = function(x) {dnorm(x, mean=0, sd=1)}, + Fv = function(x) {pnorm(x, mean=0, sd=1)}, + guard = 1e-12) + + ssv <- compute_minmax_sv(Q)[["smallest_singular_value"]] + + current_res <- data.frame(dim_n = n, dim_k = K, param_a = a, param_alpha=alphas[j], ssv =ssv) + results <- rbind(results, current_res) + } + } +} +``` + +```{r hyperparameter n / k^alpha = const plotting} +results |> + mutate(param_alpha = as.factor(param_alpha), + param_a = as.factor(param_a)) |> + group_by(param_a, param_alpha) |> + filter(dim_k == max(dim_k)) |> + ggplot(aes(dim_n, ssv, col=param_a, shape=param_alpha)) + + geom_point(size=1.5) + + geom_line() + + #scale_y_log10() + + theme_bw() + + labs(x=latex2exp::TeX("$n$"), + y=latex2exp::TeX("Smallest singular value of $Q$"), + title=latex2exp::TeX("Smallest singular value of $Q$ with respect to $\\alpha$."), + subtitle = latex2exp::TeX(("Hyperparameter $k = n^{\\alpha}$")), + colour=latex2exp::TeX("$n$"), + shape=latex2exp::TeX("$\\alpha$")) +``` + \ No newline at end of file