How do I sample from a two dimensional array by row?
Is there a julia specific way and/or build-in function to do this?
I am only able to sample elements
using StatsBase
m = [1 2 3; 4 5 6; 7 8 9]
sample(m,3)
So I must use an intermediate step
using StatsBase
m = [1 2 3; 4 5 6; 7 8 9]
idx = sample(1:size(m,1),3)
m[idx,:]
Unfortunately, the solution proposed on stackoverflow does not work as there is no function indices
Thanks!