示例#1
0
文件: net.py 项目: anskaal/NeuralNet
def fx(func, i, nodes, debug):
  if func is "sigm":
    res = nnlib.sigmoid(nodes[i])
  elif func is "tanh":
    res = nnlib.hyper_tan(nodes[i])

  log.d(debug, log.hl("f(%d)  \t(%.2f)\t---> %s \t--->   (%.2f) " %(i, nodes[i], func, res),2))
  nodes[i] = res
示例#2
0
def test_hyper_tan():
    assert nnlib.hyper_tan(0) == 0
    assert nnlib.hyper_tan(1) == 0.76159415595576490
    assert nnlib.hyper_tan(-1) == -0.7615941559557649