The code below visualizes trajectories of equation $e=e-x\langle e,x\rangle$ for Gaussian $x$.
I'm using ListLinePlot with Filling, but it generates edge artifacts. Any suggestion how to make this diagram smoother? Tried EdgeForm[] to no result.
Related question is this
Clear["Global`*"];
(* Gaussian sampler with diagonal covariance )
SeedRandom[1, Method -> "MKL"];
SF = StringForm;
gaussianSampler[diag_] := With[{d = Length[diag]},
Compile[{{n, _Integer}},
Module[{vals, diagSqrt},
diagSqrt = Sqrt[diag];
vals =
diagSqrt# & /@ RandomVariate[NormalDistribution[], {n, d}]]]];
(* Generates plot for Gaussian SGD with cov eigenvalues
1^-p,2^-p,...,d^-p, by using step size a *)
generatePlot[p_, d_, a_] := Module[{},
B = 1000;
numSteps = 100;
ones = ConstantArray[1., d];
h = Table[i^-p, {i, 1, d}];
sampler = gaussianSampler[h];
W0 = sampler[B];
step[w_, x_] = w - a x x . w;
batchStep[W_] := MapThread[step, {W, sampler[B]}];
traj = NestList[batchStep, W0, numSteps]; (* numSteps x B x d *)
errorNorms2 = Total[traj*traj, {3}]; (* numSteps x B *)
numQuantiles = 100;
compress[l_] := Quantile[l, #] & /@ Range[0, 1, 1/numQuantiles];
meanPlot =
ListLinePlot[Total[errorNorms2, {2}]/B, ScalingFunctions -> "Log",
PlotLegends -> {"mean"}];
filling =
Table[i -> {numQuantiles + 2 - i}, {i, 1, numQuantiles/2}];
distPlot =
ListLinePlot[Transpose[compress /@ errorNorms2],
ScalingFunctions -> "Log", Filling -> filling,
FillingStyle -> Directive[Black, Opacity[.1], EdgeForm[]],
PlotStyle -> {Directive[Gray, Thin]}];
Show[distPlot, meanPlot,
AxesLabel -> {"t", "||e!(*SuperscriptBox[(||), (2)])"},
PlotLabel -> SF["e=e-x<e,x>", d], ImageSize -> Large]
];
p = 1;
d = 1;
a = 2.4212495210368360429927801314282259331288428340678678473778384243
45397835692066559296652232682365322;
generatePlot[p, d, a]

PlotStyle->None? Of not, what exactly do you mean by "edge artifacts"? – Lukas Lang Apr 14 '23 at 20:55PlotStyle->Noneseems to be what I needed – Yaroslav Bulatov Apr 14 '23 at 21:26