AIwinter

001

Jun 29th, 2024
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3.  
  4. N = 5
  5.  
  6. x1 = np.random.random(N)
  7. x2 = x1 + [np.random.random(10)/10 for i in range(N)] #случайные значения от 0 до 9, разделенные на 10, 5 штук на 1 половине плосости
  8. C1 = [x1, x2]
  9.  
  10. x1 = np.random.random(N)
  11. x2 = x1 - [np.random.random(10)/10 for i in range(N)] - 0.1 #значения на 2 половине плосости
  12. C2 = [x1, x2]
  13.  
  14. f = [0, 1]
  15.  
  16. w = np.array([-0.3, 0.3])
  17. for i in range(N):
  18. x = np.array([C2[0][i], C2[1][i]])
  19. y = np.dot(w, x)
  20. if y >= 0 :
  21. print("Class C1")
  22. else:
  23. print("Class C2")
Advertisement
Add Comment
Please, Sign In to add comment