()
| 2 | import pylab as pl |
| 3 | |
| 4 | def gen_lin_separable_data(): |
| 5 | # generate training data in the 2-d case |
| 6 | mean1 = np.array([0, 2]) |
| 7 | mean2 = np.array([2, 0]) |
| 8 | cov = np.array([[0.8, 0.6], [0.6, 0.8]]) |
| 9 | X1 = np.random.multivariate_normal(mean1, cov, 100) |
| 10 | y1 = np.ones(len(X1)) |
| 11 | X2 = np.random.multivariate_normal(mean2, cov, 100) |
| 12 | y2 = np.ones(len(X2)) * -1 |
| 13 | return X1, y1, X2, y2 |
| 14 | |
| 15 | def gen_non_lin_separable_data(): |
| 16 | mean1 = [-1, 2] |