{"id":364408,"date":"2024-05-21T02:16:19","date_gmt":"2024-05-21T02:16:19","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=364408"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=364408","title":{"rendered":"<span>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0438 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0433\u043e \u0433\u0435\u043d\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0434\u043b\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0441 Python \u0438 NumPy<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0413\u0435\u043d\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0443\u0436\u0435\u043d, \u043a\u043e\u0433\u0434\u0430 \u0442\u044b \u0437\u043d\u0430\u0435\u0448\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u0432\u043e\u0435\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438, \u043d\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0448\u044c, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0442\u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0438\u0433\u0440\u044b \u0432 Google \u0434\u0438\u043d\u043e\u0437\u0430\u0432\u0440\u0438\u043a\u0430 \u0438\u043b\u0438 Flappy Bird, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u0430\u043c \u0442\u044b \u043d\u0435 \u0437\u043d\u0430\u0435\u0448\u044c, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435, \u043d\u043e \u0443 \u0442\u0435\u0431\u044f \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0436\u0438\u0437\u043d\u0435\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u044d\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0438\u0442\u043d\u0435\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<p>\u0423 \u043c\u0435\u043d\u044f \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u0442\u0430\u043a\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0438 \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u043b, \u0438 \u0431\u044b\u043b \u043f\u0440\u043e\u0441\u0442\u044b\u043c,  \u0438 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043b \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0441\u0432\u043e\u0435\u0433\u043e \u043b\u0435\u0433\u043a\u043e\u0433\u043e, \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e, \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0433\u043e Genetic Algorithm. <\/p>\n<p>\u041c\u043e\u044f \u0446\u0435\u043b\u044c \u043d\u0435 \u0440\u0430\u0441\u0442\u044f\u043d\u0443\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u0438 \u0437\u0430\u043c\u0443\u0447\u0438\u0442\u044c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u0435\u0451 \u0434\u043b\u0438\u043d\u043e\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043a\u043e\u0434\u0443. \u041a\u0430\u043a \u0443\u0436\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u043e\u0441\u044c, \u043a\u043e\u0434 \u043f\u0440\u043e\u0441\u0442\u043e\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0446\u0435\u043b\u044b\u043c\u0438 \u0441\u043e\u0447\u0438\u043d\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>\u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u0438:<\/p>\n<pre><code class=\"python\">import numpy as np import random<\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c Dataset \u0438 \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u043d\u0435\u0433\u043e, \u043d\u043e \u043d\u0435 \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438, \u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0434\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432. \u041f\u043e\u0442\u043e\u043c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0435\u0439\u0447\u0430\u0441 \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b<\/p>\n<pre><code class=\"python\"> x = np.array([[1, 1, 0], [0, 0, 1], [1, 0, 1], [0, 0, 0], [1, 0, 0], [0, 1, 0], [1, 1, 0], [0, 1, 1], [1, 1, 1]]) y = np.array([[0],[1],[1], [0], [0], [0], [0], [1], [1]])  #x = np.array([[0, 1, 1], [0, 0, 1], [1, 0, 1], [0, 1, 0], [1, 0, 0], [1, 1, 0], [0, 0, 0], [1, 1, 0], [1, 1, 1]]) #y = np.array([[1],[0], [0], [1], [0], [1], [0], [1], [1]])  #x = np.array([[1, 1, 0], [0, 0, 1], [1, 0, 1], [0, 1, 0], [1, 0, 0], [0, 0, 0], [1, 1, 0], [0, 1, 1], [1, 1, 1]]) #y = np.array([[1],[0],[1], [0], [1], [0], [1], [0], [1]])<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043f\u0438\u0441\u043a\u0438 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438. \u0421\u043c\u044b\u0441\u043b \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u0441\u0442\u0430\u043d\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u0435\u043d \u043f\u043e\u0437\u0436\u0435. \u041f\u0435\u0440\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u044d\u0442\u043e \u0441\u0438\u0433\u043c\u043e\u0438\u0434\u0430, \u0430 \u0432\u0442\u043e\u0440\u0430\u044f &#8212; \u043f\u043e\u0440\u043e\u0433\u043e\u0432\u0430\u044f<\/p>\n<pre><code class=\"python\">listNet = [] NewNet = [] goodNET = [] GoodNet0 = [] GoodNet1 = [] GoodNet2 = [] GoodNet3 = [] GoodNet4 = [] GoodNet5 = [] GoodNet6 = [] good = 0 epoch = 0  good = 0 epoch = 0  def sigmoid(x):     return 1\/(1 + np.exp(-x))  def finfunc(x):     if x[0] >= 0.5:         x[0] = 1         return x[0]      else:         x[0] = 0         return x[0]<\/code><\/pre>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430, \u043f\u0435\u0440\u0432\u044b\u0439 \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f  \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u043f\u0443\u043b\u044f\u0446\u0438\u0438, \u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437 \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u0430, \u0430 \u043f\u043e\u0442\u043e\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0445 \u0441\u043a\u0440\u0435\u0449\u0438\u0432\u0430\u0442\u044c \u0438 \u043c\u0443\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0424\u0443\u043d\u043a\u0446\u0438\u044f init() \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0435\u0441\u0430 \u0438\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c, predict() \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0438 \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430 \u043b\u0443\u0447\u0448\u0438\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432, \u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f Fredict() \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u0430 \u0438 \u0444\u0438\u0442\u043d\u0435\u0441\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u0430 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0438 \u0432\u0438\u0434\u0435\u0442\u044c \u044d\u0442\u0430\u043f\u044b \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u043c \u0441\u043b\u043e\u0435 \u0432\u043d\u0430\u0447\u0430\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u0438\u0433\u043c\u043e\u0438\u0434\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c &#8212; \u043f\u043e\u0440\u043e\u0433\u043e\u0432\u0430\u044f.<\/p>\n<pre><code class=\"python\">class Network():     def __init__(self):         self.H1 = np.random.randn(3, 6)         self.O1 = np.random.randn(6, 1)      def predict(self, x, y):         t1 = x @ self.H1         t1 = sigmoid(t1)         t2 = t1 @ self.O1         t2 = sigmoid(t2)         t2 = finfunc(t2)         if t2 == y[0]:             global good             good += 1      def Fpredict(self, x, y):         t1 = x @ self.H1         t1 = sigmoid(t1)         t2 = t1 @ self.O1         t2 = sigmoid(t2)         t2 = finfunc(t2)         if t2 == y[0]:             global good             good += 1         return t2, good class Network1():     def __init__(self, H1, O1):         self.H1 = H1         self.O1 = O1       def predict(self, x, y):         t1 = x @ self.H1         t1 = sigmoid(t1)         t2 = t1 @ self.O1         t2 = sigmoid(t2)         t2 = finfunc(t2)         if t2 == y[0]:             global good             good += 1     def Fpredict(self, x, y):         t1 = x @ self.H1         t1 = sigmoid(t1)         t2 = t1 @ self.O1         t2 = sigmoid(t2)         t2 = finfunc(t2)         if t2 == y[0]:             global good             good += 1         return t2, good  <\/code><\/pre>\n<p>\u0412\u044b\u0432\u043e\u0434\u0438\u043c \u043f\u0435\u0440\u0432\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u044b \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e good, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0434\u0435\u0441\u044c \u0438 \u0435\u0441\u0442\u044c \u0442\u0430 \u0441\u0430\u043c\u0430\u044f \u0444\u0438\u0442\u043d\u0435\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043f\u043e\u0442\u043e\u043c &#8212; \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438, \u043f\u0440\u0438\u043d\u0442 &#8216;wait0&#8217; (\u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u044e\u0434\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0435, \u0447\u0442\u043e \u0437\u0430\u0445\u043e\u0447\u0435\u0442\u0441\u044f)\u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u043f\u0443\u0442\u0430\u0442\u044c\u0441\u044f, \u0433\u0434\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u043e\u0442\u0432\u0435\u0442\u044b \u0440\u0430\u0437\u043d\u044b\u0445 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439.<\/p>\n<pre><code class=\"python\">s = Network() print(s.Fpredict(x[0], y[0])) print(s.Fpredict(x[1], y[1])) print(s.Fpredict(x[2], y[2])) print(s.Fpredict(x[3], y[3])) print(\"wait0\") good = 0<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0432\u044b\u0439 \u0446\u0438\u043a\u043b, \u0437\u0434\u0435\u0441\u044c \u0438 \u0432\u043e \u0432\u0441\u0435\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0446\u0438\u043a\u043b\u0430\u0445 \u043c\u044b \u0434\u0430\u0435\u043c, \u0442\u043e\u043b\u044c\u043a\u043e \u0448\u0435\u0441\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u043d\u0430 \u0441\u043f\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043e\u043d\u0430 \u043d\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0430, \u0442\u043e \u0435\u0441\u0442\u044c \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0435\u0451 \u043d\u0430 \u0437\u0443\u0431\u0440\u0435\u0436\u043a\u0443, \u0430 \u044d\u0442\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f. \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435: \u043e\u0442 \u0442\u043e\u0433\u043e \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043e\u043d\u0430 \u043e\u0442\u0432\u0435\u0442\u0438\u043b\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0435\u0451 \u0432 \u043e\u0434\u0438\u043d \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0435\u0441\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b-\u0432\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0442\u043e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0435\u0451 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043c\u0443\u0442\u0430\u0446\u0438\u0438 \u0431\u043e\u043b\u0435\u0435 \u0443\u043c\u043d\u044b\u0445 \u0441\u0442\u0430\u043b\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0430 100 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u0433\u0435\u043d\u0438\u0439, \u043d\u043e \u0435\u0433\u043e \u043d\u0430 \u0432\u0441\u0435\u0445 \u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u0442, \u0438 \u0437\u043d\u0430\u0447\u0438\u0442 \u0435\u0433\u043e \u0433\u0435\u043d\u0438\u0439 \u0443\u0433\u0430\u0441\u043d\u0435\u0442 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u044f\u0445, \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u043b\u0438\u0431\u043e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e, \u0438\u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442, \u0447\u0442\u043e\u0431\u044b \u0442\u0430\u043a\u043e\u0433\u043e \u043d\u0435 \u0431\u044b\u043b\u043e \u043c\u044b \u0432 \u0446\u0438\u043a\u043b\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432. \u0412 \u043a\u043e\u043d\u0446\u0435 \u043c\u044b \u043e\u043f\u0443\u0441\u0442\u043e\u0448\u0430\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a listNet \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u0435\u043c\u0443 \u043d\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u043e\u0432 GoodNet \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u043e\u0442 \u043b\u0443\u0447\u0448\u0438\u0445 \u043a \u0445\u0443\u0434\u0448\u0438\u043c, \u0434\u0435\u043b\u0430\u0435\u043c \u0441\u0440\u0435\u0437 \u043d\u0430 100 \u043b\u0443\u0447\u0448\u0438\u0445 \u043e\u0441\u043e\u0431\u0435\u0439, \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043c\u0443\u0442\u0430\u0446\u0438\u0438.<\/p>\n<pre><code class=\"python\">for s in range (1000):     s = Network()     good = 0     s.predict(x[0], y[0])     s.predict(x[1], y[1])     s.predict(x[2], y[2])     s.predict(x[3], y[3])     s.predict(x[4], y[4])     s.predict(x[5], y[5])     if good == 6:         GoodNet6.append(s)         for r in range(15):             GoodNet4.append(s)     elif good == 5:         GoodNet5.append(s)         for r in range(10):             GoodNet4.append(s)     elif good == 4:         GoodNet4.append(s)         for r in range(5):             GoodNet4.append(s)     elif good == 3:         GoodNet3.append(s)     elif good == 2:         GoodNet2.append(s)     elif good == 1:         GoodNet1.append(s)     elif good == 0:         GoodNet0.append(s)     good = 0 listNet = [] listNet.extend(GoodNet6) listNet.extend(GoodNet5) listNet.extend(GoodNet4) listNet.extend(GoodNet3) listNet.extend(GoodNet2) listNet.extend(GoodNet1) GoodNet1 = [] GoodNet2 = [] GoodNet3 = [] GoodNet4 = [] GoodNet5 = [] GoodNet6 = [] goodNET = listNet[:100] listNet = goodNET goodNET = []<\/code><\/pre>\n<p>\u0421\u0430\u043c\u043e \u0441\u043a\u0440\u0435\u0449\u0438\u0432\u0430\u043d\u0438\u0435 \u0438 \u043c\u0443\u0442\u0430\u0446\u0438\u044f: \u043c\u044b \u0431\u0435\u0440\u0451\u043c \u043e\u0434\u043d\u0443 \u0447\u0430\u0441\u0442\u044c \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f, \u0432\u0442\u043e\u0440\u0443\u044e \u043e\u0442 \u0432\u0442\u043e\u0440\u043e\u0433\u043e, \u043c\u0443\u0442\u0438\u0440\u0443\u0435\u043c \u0438 \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0440\u0435\u0431\u0451\u043d\u043e\u043a \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 NewNet, \u0442\u0430\u043a 1000 \u0440\u0430\u0437.<\/p>\n<pre><code class=\"python\">for g in range(1000):     parent1 = random.choice(listNet)     parent2 = random.choice(listNet)     ch1H = np.vstack((parent1.H1[:1], parent2.H1[1:])) * random.uniform(-0.2, 0.2)     ch1O = parent1.O1 * random.uniform(-0.2, 0.2)     g = Network1(ch1H, ch1O)     NewNet.append(g) listNet = NewNet NewNet = []<\/code><\/pre>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043a\u043e\u0434\u0430, \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Network1(), \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0441\u0435\u0439\u0447\u0430\u0441 \u0441\u043a\u0440\u0435\u0449\u0438\u0432\u0430\u0435\u043c \u0438 \u043c\u0443\u0442\u0438\u0440\u0443\u0435\u043c, \u043d\u043e \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u043e. \u0422\u0430\u043a \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c 1000 \u0440\u0430\u0437(\u044d\u0442\u043e \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043f\u043e\u0445 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u043c\u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u043b\u043e 15), \u043c\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u043f\u043e\u0445\u0435 \u0438 1000-\u0439 &#8212; \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442(\u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 20, \u0442\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0435 20).  \u0417\u0434\u0435\u0441\u044c \u043a\u043e\u0434 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0435\u0433\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c, \u0442\u0430\u043c \u0432\u0441\u0451 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u043e.<\/p>\n<pre><code class=\"python\">for i in range(1000):     good = 0     epoch += 1     for s in listNet:       good = 0       s.predict(x[0], y[0])       s.predict(x[1], y[1])       s.predict(x[2], y[2])       s.predict(x[3], y[3])       s.predict(x[4], y[4])       s.predict(x[5], y[5])       if good == 6:           GoodNet6.append(s)           for r in range(15):               GoodNet4.append(s)       elif good == 5:           GoodNet5.append(s)           for r in range(10):               GoodNet4.append(s)       elif good == 4:           GoodNet4.append(s)           for r in range(5):               GoodNet4.append(s)       elif good == 3:           GoodNet3.append(s)       elif good == 2:           GoodNet2.append(s)       elif good == 1:           GoodNet1.append(s)       elif good == 0:           GoodNet0.append(s)       good = 0     listNet = []     listNet.extend(GoodNet6)     listNet.extend(GoodNet5)     listNet.extend(GoodNet4)     listNet.extend(GoodNet3)     listNet.extend(GoodNet2)     listNet.extend(GoodNet1)     GoodNet1 = []     GoodNet2 = []     GoodNet3 = []     GoodNet4 = []     GoodNet5 = []     GoodNet6 = []     goodNET = listNet[:100]     listNet = goodNET     goodNET = []     if epoch == 1000:          print(listNet[0].Fpredict(x[0], y[0]))         print(listNet[0].Fpredict(x[1], y[1]))         print(listNet[0].Fpredict(x[2], y[2]))         print(listNet[0].Fpredict(x[3], y[3]))         print(listNet[0].Fpredict(x[4], y[4]))         print(listNet[0].Fpredict(x[5], y[5]))         print(listNet[0].Fpredict(x[6], y[6]))         print(listNet[0].Fpredict(x[7], y[7]))         print(listNet[0].Fpredict(x[8], y[8]))          good = 0         print('wait')     elif epoch == 1:          good = 0         print(listNet[0].Fpredict(x[0], y[0]))         print(listNet[0].Fpredict(x[1], y[1]))         print(listNet[0].Fpredict(x[2], y[2]))         print(listNet[0].Fpredict(x[3], y[3]))         print('wait1')     for g in range(1000):         parent1 = random.choice(listNet)          parent2 = random.choice(listNet)         ch1H = np.vstack((parent1.H1[:1], parent2.H1[1:])) * random.uniform(-2, 2)         ch1O = parent1.O1 * random.uniform(2, 2)         g = Network1(ch1H, ch1O)         NewNet.append(g)     listNet = NewNet<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0432\u0441\u0451, \u0437\u0430\u043a\u043e\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0434\u043e\u043b\u0436\u043d\u0430 \u043d\u0430\u0439\u0442\u0438 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c, \u044d\u0442\u043e \u043e\u0442 \u043a\u0430\u043a\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430(\u043f\u0435\u0440\u0432\u043e\u0433\u043e, \u0432\u0442\u043e\u0440\u043e\u0433\u043e, \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e) \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0438 \u043d\u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u0435\u043b\u0430\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438(XOR, NOT, AND\u2026), \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 network \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0434\u0432\u0430, \u044f \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043b\u0441\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043d\u0435\u0439\u0440\u043e\u043d\u044b \u0432 \u0441\u043a\u0440\u044b\u0442\u043e\u043c \u0441\u043b\u043e\u0435 \u0440\u0430\u0432\u043d\u044b \u0432\u0445\u043e\u0434\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u043d\u044b\u043c \u043d\u0430 \u0434\u0432\u0430, \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e, \u043d\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u0442\u0430\u043a\u0436\u0435 \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0434\u043d\u0438\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 &#171;a&#187;, \u0431\u044b\u043b\u043e \u0431\u044b \u0440\u0430\u0432\u043d\u043e &#171;b&#187;, \u0430 \u0438\u043d\u0430\u0447\u0435 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0430 \u0432\u0441\u0435 \u043e\u0442\u0432\u0435\u0442\u044b \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e, \u0442\u043e \u0435\u0441\u0442\u044c, \u0435\u0441\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 a, \u0442\u043e \u043e\u043d\u0430 \u043d\u0430 \u0432\u0441\u0435 \u043e\u0442\u0432\u0435\u0442\u0438\u0442 a \u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u044b\u0439\u0434\u0435\u0442, \u0442\u0430\u043a\u0436\u0435 \u0434\u0430\u0432\u0430\u0442\u044c \u0435\u0439 \u0432 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u043f\u043e\u043d\u044f\u043b\u0430 \u0437\u0430\u043a\u043e\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0435\u0441\u043b\u0438 \u0432\u044b \u0434\u0435\u043b\u0430\u0435\u0442\u0435 \u0431\u043b\u043e\u043a XOR, \u0442\u043e \u043d\u0430\u0434\u043e \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 c \u0434\u0432\u0443\u043c\u044f \u0435\u0434\u0438\u043d\u0438\u0447\u043a\u0430\u043c\u0438, \u043d\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u0442\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u0438\u0431\u043e \u0438\u0445 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u0430\u043b\u043e \u0438 \u043e\u043d\u0430 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u043e\u0439\u043c\u0435\u0442.<\/p>\n<p>\u0412\u0441\u0451!!!<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/784192\/\"> https:\/\/habr.com\/ru\/articles\/784192\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0413\u0435\u043d\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0443\u0436\u0435\u043d, \u043a\u043e\u0433\u0434\u0430 \u0442\u044b \u0437\u043d\u0430\u0435\u0448\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u0432\u043e\u0435\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438, \u043d\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0448\u044c, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0442\u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0438\u0433\u0440\u044b \u0432 Google \u0434\u0438\u043d\u043e\u0437\u0430\u0432\u0440\u0438\u043a\u0430 \u0438\u043b\u0438 Flappy Bird, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u0430\u043c \u0442\u044b \u043d\u0435 \u0437\u043d\u0430\u0435\u0448\u044c, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435, \u043d\u043e \u0443 \u0442\u0435\u0431\u044f \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0436\u0438\u0437\u043d\u0435\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u044d\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0438\u0442\u043d\u0435\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<p>\u0423 \u043c\u0435\u043d\u044f \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u0442\u0430\u043a\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0438 \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u043b, \u0438 \u0431\u044b\u043b \u043f\u0440\u043e\u0441\u0442\u044b\u043c,  \u0438 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043b \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0441\u0432\u043e\u0435\u0433\u043e \u043b\u0435\u0433\u043a\u043e\u0433\u043e, \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e, \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0433\u043e Genetic Algorithm. <\/p>\n<p>\u041c\u043e\u044f \u0446\u0435\u043b\u044c \u043d\u0435 \u0440\u0430\u0441\u0442\u044f\u043d\u0443\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u0438 \u0437\u0430\u043c\u0443\u0447\u0438\u0442\u044c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u0435\u0451 \u0434\u043b\u0438\u043d\u043e\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043a\u043e\u0434\u0443. \u041a\u0430\u043a \u0443\u0436\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u043e\u0441\u044c, \u043a\u043e\u0434 \u043f\u0440\u043e\u0441\u0442\u043e\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0446\u0435\u043b\u044b\u043c\u0438 \u0441\u043e\u0447\u0438\u043d\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>\u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u0438:<\/p>\n<pre><code class=\"python\">import numpy as np import random<\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c Dataset \u0438 \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u043d\u0435\u0433\u043e, \u043d\u043e \u043d\u0435 \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438, \u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0434\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432. \u041f\u043e\u0442\u043e\u043c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0435\u0439\u0447\u0430\u0441 \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b<\/p>\n<pre><code class=\"python\"> x = np.array([[1, 1, 0], [0, 0, 1], [1, 0, 1], [0, 0, 0], [1, 0, 0], [0, 1, 0], [1, 1, 0], [0, 1, 1], [1, 1, 1]]) y = np.array([[0],[1],[1], [0], [0], [0], [0], [1], [1]])  #x = np.array([[0, 1, 1], [0, 0, 1], [1, 0, 1], [0, 1, 0], [1, 0, 0], [1, 1, 0], [0, 0, 0], [1, 1, 0], [1, 1, 1]]) #y = np.array([[1],[0], [0], [1], [0], [1], [0], [1], [1]])  #x = np.array([[1, 1, 0], [0, 0, 1], [1, 0, 1], [0, 1, 0], [1, 0, 0], [0, 0, 0], [1, 1, 0], [0, 1, 1], [1, 1, 1]]) #y = np.array([[1],[0],[1], [0], [1], [0], [1], [0], [1]])<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043f\u0438\u0441\u043a\u0438 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438. \u0421\u043c\u044b\u0441\u043b \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u0441\u0442\u0430\u043d\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u0435\u043d \u043f\u043e\u0437\u0436\u0435. \u041f\u0435\u0440\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u044d\u0442\u043e \u0441\u0438\u0433\u043c\u043e\u0438\u0434\u0430, \u0430 \u0432\u0442\u043e\u0440\u0430\u044f &#8212; \u043f\u043e\u0440\u043e\u0433\u043e\u0432\u0430\u044f<\/p>\n<pre><code class=\"python\">listNet = [] NewNet = [] goodNET = [] GoodNet0 = [] GoodNet1 = [] GoodNet2 = [] GoodNet3 = [] GoodNet4 = [] GoodNet5 = [] GoodNet6 = [] good = 0 epoch = 0  good = 0 epoch = 0  def sigmoid(x):     return 1\/(1 + np.exp(-x))  def finfunc(x):     if x[0] >= 0.5:         x[0] = 1         return x[0]      else:         x[0] = 0         return x[0]<\/code><\/pre>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430, \u043f\u0435\u0440\u0432\u044b\u0439 \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f  \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u043f\u0443\u043b\u044f\u0446\u0438\u0438, \u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437 \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u0430, \u0430 \u043f\u043e\u0442\u043e\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0445 \u0441\u043a\u0440\u0435\u0449\u0438\u0432\u0430\u0442\u044c \u0438 \u043c\u0443\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0424\u0443\u043d\u043a\u0446\u0438\u044f init() \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0435\u0441\u0430 \u0438\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c, predict() \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0438 \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430 \u043b\u0443\u0447\u0448\u0438\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432, \u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f Fredict() \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u0430 \u0438 \u0444\u0438\u0442\u043d\u0435\u0441\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u0430 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0438 \u0432\u0438\u0434\u0435\u0442\u044c \u044d\u0442\u0430\u043f\u044b \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u043c \u0441\u043b\u043e\u0435 \u0432\u043d\u0430\u0447\u0430\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u0438\u0433\u043c\u043e\u0438\u0434\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c &#8212; \u043f\u043e\u0440\u043e\u0433\u043e\u0432\u0430\u044f.<\/p>\n<pre><code class=\"python\">class Network():     def __init__(self):         self.H1 = np.random.randn(3, 6)         self.O1 = np.random.randn(6, 1)      def predict(self, x, y):         t1 = x @ self.H1         t1 = sigmoid(t1)         t2 = t1 @ self.O1         t2 = sigmoid(t2)         t2 = finfunc(t2)         if t2 == y[0]:             global good             good += 1      def Fpredict(self, x, y):         t1 = x @ self.H1         t1 = sigmoid(t1)         t2 = t1 @ self.O1         t2 = sigmoid(t2)         t2 = finfunc(t2)         if t2 == y[0]:             global good             good += 1         return t2, good class Network1():     def __init__(self, H1, O1):         self.H1 = H1         self.O1 = O1       def predict(self, x, y):         t1 = x @ self.H1         t1 = sigmoid(t1)         t2 = t1 @ self.O1         t2 = sigmoid(t2)         t2 = finfunc(t2)         if t2 == y[0]:             global good             good += 1     def Fpredict(self, x, y):         t1 = x @ self.H1         t1 = sigmoid(t1)         t2 = t1 @ self.O1         t2 = sigmoid(t2)         t2 = finfunc(t2)         if t2 == y[0]:             global good             good += 1         return t2, good  <\/code><\/pre>\n<p>\u0412\u044b\u0432\u043e\u0434\u0438\u043c \u043f\u0435\u0440\u0432\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u044b \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e good, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0434\u0435\u0441\u044c \u0438 \u0435\u0441\u0442\u044c \u0442\u0430 \u0441\u0430\u043c\u0430\u044f \u0444\u0438\u0442\u043d\u0435\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043f\u043e\u0442\u043e\u043c &#8212; \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438, \u043f\u0440\u0438\u043d\u0442 &#8216;wait0&#8217; (\u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u044e\u0434\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0435, \u0447\u0442\u043e \u0437\u0430\u0445\u043e\u0447\u0435\u0442\u0441\u044f)\u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u043f\u0443\u0442\u0430\u0442\u044c\u0441\u044f, \u0433\u0434\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u043e\u0442\u0432\u0435\u0442\u044b \u0440\u0430\u0437\u043d\u044b\u0445 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439.<\/p>\n<pre><code class=\"python\">s = Network() print(s.Fpredict(x[0], y[0])) print(s.Fpredict(x[1], y[1])) print(s.Fpredict(x[2], y[2])) print(s.Fpredict(x[3], y[3])) print(\"wait0\") good = 0<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0432\u044b\u0439 \u0446\u0438\u043a\u043b, \u0437\u0434\u0435\u0441\u044c \u0438 \u0432\u043e \u0432\u0441\u0435\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0446\u0438\u043a\u043b\u0430\u0445 \u043c\u044b \u0434\u0430\u0435\u043c, \u0442\u043e\u043b\u044c\u043a\u043e \u0448\u0435\u0441\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u043d\u0430 \u0441\u043f\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043e\u043d\u0430 \u043d\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0430, \u0442\u043e \u0435\u0441\u0442\u044c \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0435\u0451 \u043d\u0430 \u0437\u0443\u0431\u0440\u0435\u0436\u043a\u0443, \u0430 \u044d\u0442\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f. \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435: \u043e\u0442 \u0442\u043e\u0433\u043e \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043e\u043d\u0430 \u043e\u0442\u0432\u0435\u0442\u0438\u043b\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0435\u0451 \u0432 \u043e\u0434\u0438\u043d \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0435\u0441\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b-\u0432\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0442\u043e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0435\u0451 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043c\u0443\u0442\u0430\u0446\u0438\u0438 \u0431\u043e\u043b\u0435\u0435 \u0443\u043c\u043d\u044b\u0445 \u0441\u0442\u0430\u043b\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0430 100 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u0433\u0435\u043d\u0438\u0439, \u043d\u043e \u0435\u0433\u043e \u043d\u0430 \u0432\u0441\u0435\u0445 \u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u0442, \u0438 \u0437\u043d\u0430\u0447\u0438\u0442 \u0435\u0433\u043e \u0433\u0435\u043d\u0438\u0439 \u0443\u0433\u0430\u0441\u043d\u0435\u0442 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u044f\u0445, \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u043b\u0438\u0431\u043e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e, \u0438\u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442, \u0447\u0442\u043e\u0431\u044b \u0442\u0430\u043a\u043e\u0433\u043e \u043d\u0435 \u0431\u044b\u043b\u043e \u043c\u044b \u0432 \u0446\u0438\u043a\u043b\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432. \u0412 \u043a\u043e\u043d\u0446\u0435 \u043c\u044b \u043e\u043f\u0443\u0441\u0442\u043e\u0448\u0430\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a listNet \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u0435\u043c\u0443 \u043d\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u043e\u0432 GoodNet \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u043e\u0442 \u043b\u0443\u0447\u0448\u0438\u0445 \u043a \u0445\u0443\u0434\u0448\u0438\u043c, \u0434\u0435\u043b\u0430\u0435\u043c \u0441\u0440\u0435\u0437 \u043d\u0430 100 \u043b\u0443\u0447\u0448\u0438\u0445 \u043e\u0441\u043e\u0431\u0435\u0439, \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043c\u0443\u0442\u0430\u0446\u0438\u0438.<\/p>\n<pre><code class=\"python\">for s in range (1000):     s = Network()     good = 0     s.predict(x[0], y[0])     s.predict(x[1], y[1])     s.predict(x[2], y[2])     s.predict(x[3], y[3])     s.predict(x[4], y[4])     s.predict(x[5], y[5])     if good == 6:         GoodNet6.append(s)         for r in range(15):             GoodNet4.append(s)     elif good == 5:         GoodNet5.append(s)         for r in range(10):             GoodNet4.append(s)     elif good == 4:         GoodNet4.append(s)         for r in range(5):             GoodNet4.append(s)     elif good == 3:         GoodNet3.append(s)     elif good == 2:         GoodNet2.append(s)     elif good == 1:         GoodNet1.append(s)     elif good == 0:         GoodNet0.append(s)     good = 0 listNet = [] listNet.extend(GoodNet6) listNet.extend(GoodNet5) listNet.extend(GoodNet4) listNet.extend(GoodNet3) listNet.extend(GoodNet2) listNet.extend(GoodNet1) GoodNet1 = [] GoodNet2 = [] GoodNet3 = [] GoodNet4 = [] GoodNet5 = [] GoodNet6 = [] goodNET = listNet[:100] listNet = goodNET goodNET = []<\/code><\/pre>\n<p>\u0421\u0430\u043c\u043e \u0441\u043a\u0440\u0435\u0449\u0438\u0432\u0430\u043d\u0438\u0435 \u0438 \u043c\u0443\u0442\u0430\u0446\u0438\u044f: \u043c\u044b \u0431\u0435\u0440\u0451\u043c \u043e\u0434\u043d\u0443 \u0447\u0430\u0441\u0442\u044c \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f, \u0432\u0442\u043e\u0440\u0443\u044e \u043e\u0442 \u0432\u0442\u043e\u0440\u043e\u0433\u043e, \u043c\u0443\u0442\u0438\u0440\u0443\u0435\u043c \u0438 \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0440\u0435\u0431\u0451\u043d\u043e\u043a \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 NewNet, \u0442\u0430\u043a 1000 \u0440\u0430\u0437.<\/p>\n<pre><code class=\"python\">for g in range(1000):     parent1 = random.choice(listNet)     parent2 = random.choice(listNet)     ch1H = np.vstack((parent1.H1[:1], parent2.H1[1:])) * random.uniform(-0.2, 0.2)     ch1O = parent1.O1 * random.uniform(-0.2, 0.2)     g = Network1(ch1H, ch1O)     NewNet.append(g) listNet = NewNet NewNet = []<\/code><\/pre>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043a\u043e\u0434\u0430, \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Network1(), \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0441\u0435\u0439\u0447\u0430\u0441 \u0441\u043a\u0440\u0435\u0449\u0438\u0432\u0430\u0435\u043c \u0438 \u043c\u0443\u0442\u0438\u0440\u0443\u0435\u043c, \u043d\u043e \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u043e. \u0422\u0430\u043a \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c 1000 \u0440\u0430\u0437(\u044d\u0442\u043e \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043f\u043e\u0445 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u043c\u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u043b\u043e 15), \u043c\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u043f\u043e\u0445\u0435 \u0438 1000-\u0439 &#8212; \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442(\u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 20, \u0442\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0435 20).  \u0417\u0434\u0435\u0441\u044c \u043a\u043e\u0434 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0435\u0433\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c, \u0442\u0430\u043c \u0432\u0441\u0451 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u043e.<\/p>\n<pre><code class=\"python\">for i in range(1000):     good = 0     epoch += 1     for s in listNet:       good = 0       s.predict(x[0], y[0])       s.predict(x[1], y[1])       s.predict(x[2], y[2])       s.predict(x[3], y[3])       s.predict(x[4], y[4])       s.predict(x[5], y[5])       if good == 6:           GoodNet6.append(s)           for r in range(15):               GoodNet4.append(s)       elif good == 5:           GoodNet5.append(s)           for r in range(10):               GoodNet4.append(s)       elif good == 4:           GoodNet4.append(s)           for r in range(5):               GoodNet4.append(s)       elif good == 3:           GoodNet3.append(s)       elif good == 2:           GoodNet2.append(s)       elif good == 1:           GoodNet1.append(s)       elif good == 0:           GoodNet0.append(s)       good = 0     listNet = []     listNet.extend(GoodNet6)     listNet.extend(GoodNet5)     listNet.extend(GoodNet4)     listNet.extend(GoodNet3)     listNet.extend(GoodNet2)     listNet.extend(GoodNet1)     GoodNet1 = []     GoodNet2 = []     GoodNet3 = []     GoodNet4 = []     GoodNet5 = []     GoodNet6 = []     goodNET = listNet[:100]     listNet = goodNET     goodNET = []     if epoch == 1000:          print(listNet[0].Fpredict(x[0], y[0]))         print(listNet[0].Fpredict(x[1], y[1]))         print(listNet[0].Fpredict(x[2], y[2]))         print(listNet[0].Fpredict(x[3], y[3]))         print(listNet[0].Fpredict(x[4], y[4]))         print(listNet[0].Fpredict(x[5], y[5]))         print(listNet[0].Fpredict(x[6], y[6]))         print(listNet[0].Fpredict(x[7], y[7]))         print(listNet[0].Fpredict(x[8], y[8]))          good = 0         print('wait')     elif epoch == 1:          good = 0         print(listNet[0].Fpredict(x[0], y[0]))         print(listNet[0].Fpredict(x[1], y[1]))         print(listNet[0].Fpredict(x[2], y[2]))         print(listNet[0].Fpredict(x[3], y[3]))         print('wait1')     for g in range(1000):         parent1 = random.choice(listNet)          parent2 = random.choice(listNet)         ch1H = np.vstack((parent1.H1[:1], parent2.H1[1:])) * random.uniform(-2, 2)         ch1O = parent1.O1 * random.uniform(2, 2)         g = Network1(ch1H, ch1O)         NewNet.append(g)     listNet = NewNet<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0432\u0441\u0451, \u0437\u0430\u043a\u043e\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0434\u043e\u043b\u0436\u043d\u0430 \u043d\u0430\u0439\u0442\u0438 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c, \u044d\u0442\u043e \u043e\u0442 \u043a\u0430\u043a\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430(\u043f\u0435\u0440\u0432\u043e\u0433\u043e, \u0432\u0442\u043e\u0440\u043e\u0433\u043e, \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e) \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0438 \u043d\u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u0435\u043b\u0430\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438(XOR, NOT, AND\u2026), \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 network \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-364408","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/364408","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=364408"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/364408\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=364408"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=364408"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=364408"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}