本文整理汇总了Python中Graphics.costHitsGraphica方法的典型用法代码示例。如果您正苦于以下问题:Python Graphics.costHitsGraphica方法的具体用法?Python Graphics.costHitsGraphica怎么用?Python Graphics.costHitsGraphica使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graphics
的用法示例。
在下文中一共展示了Graphics.costHitsGraphica方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update
# 需要导入模块: import Graphics [as 别名]
# 或者: from Graphics import costHitsGraphica [as 别名]
update(layerH, layerO, trX[i], trY[i], h, py_x, 0.1)
trainCost.append(cost)
print("Train: {}\nCost: {}".format(n, cost))
hitPercentage.append(test(teX, teY, layerH, layerO))
print ""
return trainCost, hitPercentage
# Método que compara las salida de la red con las etiquetas para calcular
# la calidad de la red y obtener su tasa de acierto
def test(teX, teY, layerH, layerO):
cont = 0
for i in range(teX.shape[0]):
[prx, h] = model(teX[i], layerH, layerO)
# print("{} -- {}".format(np.argmax(prx), np.argmax(teY[i])))
if(np.argmax(prx) == np.argmax(teY[i])):
cont += 1
hitPercentage = (cont/float(teX.shape[0]))*float(100)
print("Percentage of hits: {} %".format(hitPercentage))
return hitPercentage
print "Loading Mnist data ..."
[trX, teX, trY, teY] = LoadMnist.mnist(60000,10000)
print "Done\nTraining network ..."
nTrain = 10
layerH = Layer.Layer(55, 784)
layerO = Layer.Layer(10, 55)
print("Number of Trains: {}".format(nTrain))
[trainCost, hitPercentage] = train(nTrain, trX, trY, layerH, layerO)
Graphics.costHitsGraphica(trainCost, hitPercentage)