'''
forward()...順伝播
backward()...逆伝播
params()...重みやバイアスなどをリストとして保持する

'''

import numpy as np 

class Sigmoid:
    def __init__(self):
        self.params=[]

    def forward(self,x):
        return 1/(1+np.exp(-x))

class Affine:
    def __init__(self,W,b):
        self.params=[W,b]
    
    def forward(self,x):
        W,b=self.params
        out = np.dot(x,W)+b
        return out


class TwoLayerNet:
    def __init__(self,input_size, hidden_size, output_size):
        I,H,O=input_size,hidden_size,output_size

        W1=np.random.randn(i,H)
        b1=np.random.randn(H)
        W2=np.random.randn(H,O)
        b2=np.random.randn(O)

        self.layers=[
            Affine(W1,b1),
            Sigmoid(),
            Affine(W2,b2)
        ]

        self.params=[]
        for layer in self.layers:
            self.params += layer.params
        
    def predict(self,x):
        for layer in self.layers:
            x= layer.forward
        return x

07d8847256c007f79b4f268101672f12ea61a268
<mask token>


class Affine:

    def __init__(self, W, b):
        self.params = [W, b]

    def forward(self, x):
        W, b = self.params
        out = np.dot(x, W) + b
        return out


class TwoLayerNet:

    def __init__(self, input_size, hidden_size, output_size):
        I, H, O = input_size, hidden_size, output_size
        W1 = np.random.randn(i, H)
        b1 = np.random.randn(H)
        W2 = np.random.randn(H, O)
        b2 = np.random.randn(O)
        self.layers = [Affine(W1, b1), Sigmoid(), Affine(W2, b2)]
        self.params = []
        for layer in self.layers:
            self.params += layer.params

    def predict(self, x):
        for layer in self.layers:
            x = layer.forward
        return x

<mask token>


class Sigmoid:
    <mask token>
    <mask token>


class Affine:

    def __init__(self, W, b):
        self.params = [W, b]

    def forward(self, x):
        W, b = self.params
        out = np.dot(x, W) + b
        return out


class TwoLayerNet:

    def __init__(self, input_size, hidden_size, output_size):
        I, H, O = input_size, hidden_size, output_size
        W1 = np.random.randn(i, H)
        b1 = np.random.randn(H)
        W2 = np.random.randn(H, O)
        b2 = np.random.randn(O)
        self.layers = [Affine(W1, b1), Sigmoid(), Affine(W2, b2)]
        self.params = []
        for layer in self.layers:
            self.params += layer.params

    def predict(self, x):
        for layer in self.layers:
            x = layer.forward
        return x

<mask token>


class Sigmoid:

    def __init__(self):
        self.params = []
    <mask token>


class Affine:

    def __init__(self, W, b):
        self.params = [W, b]

    def forward(self, x):
        W, b = self.params
        out = np.dot(x, W) + b
        return out


class TwoLayerNet:

    def __init__(self, input_size, hidden_size, output_size):
        I, H, O = input_size, hidden_size, output_size
        W1 = np.random.randn(i, H)
        b1 = np.random.randn(H)
        W2 = np.random.randn(H, O)
        b2 = np.random.randn(O)
        self.layers = [Affine(W1, b1), Sigmoid(), Affine(W2, b2)]
        self.params = []
        for layer in self.layers:
            self.params += layer.params

    def predict(self, x):
        for layer in self.layers:
            x = layer.forward
        return x

<mask token>


class Sigmoid:

    def __init__(self):
        self.params = []

    def forward(self, x):
        return 1 / (1 + np.exp(-x))


class Affine:

    def __init__(self, W, b):
        self.params = [W, b]

    def forward(self, x):
        W, b = self.params
        out = np.dot(x, W) + b
        return out


class TwoLayerNet:

    def __init__(self, input_size, hidden_size, output_size):
        I, H, O = input_size, hidden_size, output_size
        W1 = np.random.randn(i, H)
        b1 = np.random.randn(H)
        W2 = np.random.randn(H, O)
        b2 = np.random.randn(O)
        self.layers = [Affine(W1, b1), Sigmoid(), Affine(W2, b2)]
        self.params = []
        for layer in self.layers:
            self.params += layer.params

    def predict(self, x):
        for layer in self.layers:
            x = layer.forward
        return x

'''
forward()...順伝播
backward()...逆伝播
params()...重みやバイアスなどをリストとして保持する

'''

import numpy as np 

class Sigmoid:
    def __init__(self):
        self.params=[]

    def forward(self,x):
        return 1/(1+np.exp(-x))

class Affine:
    def __init__(self,W,b):
        self.params=[W,b]
    
    def forward(self,x):
        W,b=self.params
        out = np.dot(x,W)+b
        return out


class TwoLayerNet:
    def __init__(self,input_size, hidden_size, output_size):
        I,H,O=input_size,hidden_size,output_size

        W1=np.random.randn(i,H)
        b1=np.random.randn(H)
        W2=np.random.randn(H,O)
        b2=np.random.randn(O)

        self.layers=[
            Affine(W1,b1),
            Sigmoid(),
            Affine(W2,b2)
        ]

        self.params=[]
        for layer in self.layers:
            self.params += layer.params
        
    def predict(self,x):
        for layer in self.layers:
            x= layer.forward
        return x
