Skip to content

Instantly share code, notes, and snippets.

@Olshansk
Last active May 25, 2020 23:08
Show Gist options
  • Save Olshansk/8377249322503c131788c57940822b24 to your computer and use it in GitHub Desktop.
Save Olshansk/8377249322503c131788c57940822b24 to your computer and use it in GitHub Desktop.
Joint Probability Matrices - Data Generation
# Data Generation
NUM_STUDENTS = 30
MEAN = 80
STD = 20
# https://stackoverflow.com/questions/36894191/how-to-get-a-normal-distribution-within-a-range-in-numpy
# Need to cap the values of the distributions to [0,100]
def get_truncated_normal(mean, sd, size, low, upp):
return truncnorm((low - mean) / sd, (upp - mean) / sd, loc=mean, scale=sd).rvs(size)
grades_GT = get_truncated_normal(MEAN, STD, NUM_STUDENTS, 0, 100)
grades_P = get_truncated_normal(MEAN, STD, NUM_STUDENTS, 0, 100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment