Taxonomy of Neural Networks under Neurovolution

ODOMOJULI

2020-07-13T07:00:00.000Z

Taxonomy for Neural Networks under Neurovolution


Tiny Neural Network

import numpy as np
X = np.array([ [0,0,1],[0,1,1],[1,0,1],[1,1,1] ])
y = np.array([[0,1,1,0]]).T
syn0 = 2*np.random.random((3,4)) - 1
syn1 = 2*np.random.random((4,1)) - 1
for j in range(60000):
 l1 = 1/(1+np.exp(-(np.dot(X,syn0))))
 l2 = 1/(1+np.exp(-(np.dot(l1,syn1))))
 l2_delta = (y - l2)*(l2*(1-l2))
 l1_delta = l2_delta.dot(syn1.T) * (l1 * (1-l1))
 syn1 += l1.T.dot(l2_delta)
 syn0 += X.T.dot(l1_delta)

Convolutional Neural Network Validation

def validate_network(size, layers):
    while layers:
        [mode, *layer] = layers.pop(0)
        if mode < 2:
            layer += [(1,1)]
        kernel, stride = layer
        m = 1 if mode > 1 else mode
        for i in 0,1:
            size[i] = (size[i] - m*kernel[i])/stride[i] + m
            if size[i] % 1:
                return False
            if m==0 and kernel[i]%2==0:
                return False
            if stride[i] > kernel[i]:
                return False
    return True

SOCIAL

© 2020 ODOMOJULI