Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- N = 5
- x1 = np.random.random(N)
- x2 = x1 + [np.random.random(10)/10 for i in range(N)] #случайные значения от 0 до 9, разделенные на 10, 5 штук на 1 половине плосости
- C1 = [x1, x2]
- x1 = np.random.random(N)
- x2 = x1 - [np.random.random(10)/10 for i in range(N)] - 0.1 #значения на 2 половине плосости
- C2 = [x1, x2]
- f = [0, 1]
- w = np.array([-0.3, 0.3])
- for i in range(N):
- x = np.array([C2[0][i], C2[1][i]])
- y = np.dot(w, x)
- if y >= 0 :
- print("Class C1")
- else:
- print("Class C2")
Advertisement
Add Comment
Please, Sign In to add comment