Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save n0obcoder/f2f3131e35aaa5146976480429978a09 to your computer and use it in GitHub Desktop.

Select an option

Save n0obcoder/f2f3131e35aaa5146976480429978a09 to your computer and use it in GitHub Desktop.
# Defining the range of 'x', the independent variable
x_range = [-2000, 2000]
# Defining the extent of noise, which would be added to both the dependent as well as the independent variable
deviation = 100
# For the data points to roughly fall on a staright line, we need to define the slope and the intercept of that line
# Let's intoduce some randomness in the slope and intercept selection process
m_synthetic = random.randint(-100, 100)/100. # m_synthetic is real number from the set(-1.0, -0.99, -0.98 ...., 0.98, 0.99, 1.0)
c_synthetic = random.randint(-10, 10) # c_synthetic is an integer from the set(-10, -9, -8 ..., 8, 9, 10)
print('\nm_synthetic: {}'.format(m_synthetic))
print('c_synthetic: {}'.format(c_synthetic))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment