@@ -0,0 +1,804 @@
+def act(x):%0D%0A    mat = list()%0D%0A    for r in x:%0D%0A        row = list()%0D%0A        for c in r:%0D%0A            row.append(1 / (1 + math.exp(- c)))%0D%0A        mat.append(row)%0D%0A    return mat%0D%0A    %0D%0Adef grad_act(x):%0D%0A    mat = list()%0D%0A    for r in x:%0D%0A        row = list()%0D%0A        for c in r:%0D%0A            row.append(math.exp(- c) / (1 + math.exp(- c))**2)%0D%0A        mat.append(row)%0D%0A    return mat%0D%0A%0D%0Adef loss(x):%0D%0A    mat = list()%0D%0A    for r in x:%0D%0A        row = list()%0D%0A        for c in r:%0D%0A            row.append(math.exp(- c) / (1 + math.exp(- c))**2)%0D%0A        mat.append(row)%0D%0A    return mat%0D%0A%0D%0Adef grad_loss(A, B):%0D%0A    mat = list()%0D%0A    for i, row in enumerate(A):%0D%0A        r = list()%0D%0A        for j, column in enumerate(row):%0D%0A            r.append( -A%5Bi%5D%5Bj%5D + B%5Bi%5D%5Bj%5D)%0D%0A        mat.append(r)%0D%0A    return mat

split loss and activations to another file