本文整理汇总了Python中LogisticRegression.LogisticRegression.calcAccuracy方法的典型用法代码示例。如果您正苦于以下问题:Python LogisticRegression.calcAccuracy方法的具体用法?Python LogisticRegression.calcAccuracy怎么用?Python LogisticRegression.calcAccuracy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogisticRegression.LogisticRegression
的用法示例。
在下文中一共展示了LogisticRegression.calcAccuracy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from LogisticRegression import LogisticRegression [as 别名]
# 或者: from LogisticRegression.LogisticRegression import calcAccuracy [as 别名]
class NeuralNetwork:
def __init__(self, rng, n_in, n_out, hl):
# will contain basically a list of Hidden Layers objects.
self.layers = []
inp_size = n_in
for i in range(len(hl)):
HL = HiddenLayer(rng, inp_size, hl[i])
self.layers.append(HL)
inp_size = hl[i]
self.op = LogisticRegression(inp_size, n_out)
self.params = []
for l in self.layers:
self.params = self.params + l.params
self.params = self.params + self.op.params
# self.params = [l.params for l in self.layers]
# forward pass is here
def forward(self, x):
act = [x]
for i, l in enumerate(self.layers):
act.append(l.output(act[i]))
return act
def cost(self, x, y):
act = self.forward(x)
estimate = act[-1]
return self.op.cost(estimate, y)
def calcAccuracy(self, x, y):
act = self.forward(x)
ll = act[-1]
return self.op.calcAccuracy(ll, y)