mercredi 1 mars 2017

neural network back propagation hidden error become zero. working on mnist_data_train_100_csv file

def backpropagation(x,weight1,weight2,bais1,bais2,yTarget):
    del1=np.zeros((weight1.shape))
    del2=np.zeros((weight2.shape))
    bel1=np.zeros((bais1.shape))
    bel2=np.zeros((bais2.shape))
    hh=forward(weight1,x,bais1)
    hhout=sigmoid(hh)
    oo=forward(weight2,hhout,bais2)
    oout=sigmoid(oo)
    e=sum((oout-yTarget)**2)/2
    ooe=-(yTarget-oout)*(oout*(1-oout))
    hhe=np.dot(weight2.T,ooe)*(hhout*(1-hhout))
    del2=del2+np.dot(hhout,ooe.T)
    del1=del1+np.dot(x,hhe.T)
    bel1=bel1+hhe
    bel2=bel2+ooe
    return del1,del2,bel1,bel2

def forward(weight,inp,b):
    val=np.dot(weight.T,inp)+b
    return val

def sigmoid(x):
    val=1.0/(1.0+np.exp(-x))
    return val

here in backpropagation() value of this hhout*(1-hhout) making all 0. so it is right or wrong please correct me

Aucun commentaire:

Enregistrer un commentaire