I have a problem to solve. I'm lost at generating a random data set for binary classification where each class correspond to the $2D$ region depicted in the figure below. The random data I must generate should have normal distribution with variance $\sigma^2 = 0.08$. I will use $200$ points ($100$ in each region) to train my nural network and report the results in terms of the loss function and the training epochs. New guy here Any tips will be welcomed!!

enter image description here


To generate normal random variable, you can use numpy.random.normal where the scale parameter is the standard deviation. To generate multivariate normal random variable, you can use numpy.random.multivariate_normal.

If you are an R user, you might like to consider mvrnorm

However, I doubt that is what you really want. After all, it is possible to generate points that are beyond the square.

You might like to consider some bounded distribution instead. Consider truncated normal distribution or uniform distribution.

  • $\begingroup$ Thanks here is what I used x_train = np.random.normal(0.5,0.08,100) y_train = np.random.normal(0.5,0.08,100). Would you say that this would generate a normal distribution with the variance = to 0.08? $\endgroup$ – Chris Kehl Feb 21 '20 at 1:27
  • $\begingroup$ Now for the second part how would I go about splitting up the regions on the above with my neural network? $\endgroup$ – Chris Kehl Feb 21 '20 at 1:32
  • $\begingroup$ You are assuming that each features are independent. Also, you need to take square root as the input is standard deviation. You might want to visualise your data to check if they fall in your desired region. Label your data, split your data to training, validation, and test set to train and evaluate your model. Remark: travelling, slow response ahead $\endgroup$ – Siong Thye Goh Feb 21 '20 at 1:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.