Closed zsk66 closed 2 years ago
Thanks @SheperoMah
Wow!!, I am so glad to see this code, this problem made me very crazy in these days. Finallu, I used spark.Mllib to generate the random numbers, but it is so difficult and troublesome. Thank you so much !!!!!
` import breeze.linalg.{DenseVector, DenseMatrix} import breeze.stats.distributions.RandBasis import breeze.stats.distributions.MultivariateGaussian
// Choose the random number generator. Check RandBasis' documentation if you want to know more. implicit val rand: RandBasis = RandBasis.systemSeed
// Define the parameters of the multivariate Gaussian distribution val mean = DenseVector(0.1, 2.0) val covariance = DenseMatrix(Array(0.3, 0.1), Array(0.1, 0.8))
// Create a distribution with these parameters. val myDist = MultivariateGaussian(mean, covariance)
// Sample from the distribution. val rndSamples = myDist.sample(n=1000) `