I have never understood how to use
Cases to extract items from objects (other than exactly copying code written by others which, again, means I don't understand).
I have a
LearnedDistribution object that upon using
FullForm I see the item I want:
I've been able to obtain the
"KernelSize" with the following:
SeedRandom; data = RandomVariate[NormalDistribution[0, 1], 100]; ld = LearnDistribution[data, Method -> "KernelDensityEstimation"] kernelSize = Cases[ld, First@Association[_]][[1, 6, 2]] (* 0.510338 *)
But using the index
[[1, 6, 2]] has to be fragile at best. What is a less fragile and more Mathematica way to get that value?
This is related to my partial answer about exporting information to obtain random samples from a