Hi, I am doing an online Python course and this following code was something the teacher typed in the video. It worked for him but it does not run on my laptop.
The error messages I receive for the last two lines are " “points” is not defined.
I am confused about how I cann access “points” and make it work, as it is defined in my function.
Thanks for any help!
import numpy as np
import scipy.stats as ss
import matplotlib.pyplot as plt
def generate_synth_data(n=50):
"""Create two sets of points from bivariate normal distributions."""
points = np.concatenate((ss.norm(0,1).rvs((n,2)), ss.norm(1,1).rvs((n,2))), axis=0)
outcomes = np.concatenate((np.repeat(0, n), np.repeat(1, n)))
return (points, outcomes)
n=20
plt.figure()
plt.plot(points[:n, 0], points[:n, 1], "ro")
plt.plot(points[n:, 0], points[n:, 1], "bo")