MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / forward

Function forward

ann_class/forwardprop.py:42–49  ·  view source on GitHub ↗
(X, W1, b1, W2, b2)

Source from the content-addressed store, hash-verified

40 return 1 / (1 + np.exp(-a))
41
42def forward(X, W1, b1, W2, b2):
43 Z = sigmoid(X.dot(W1) + b1) # sigmoid
44 # Z = np.tanh(X.dot(W1) + b1) # tanh
45 # Z = np.maximum(X.dot(W1) + b1, 0) # relu
46 A = Z.dot(W2) + b2
47 expA = np.exp(A)
48 Y = expA / expA.sum(axis=1, keepdims=True)
49 return Y
50
51# determine the classification rate
52# num correct / num total

Callers 1

forwardprop.pyFile · 0.70

Calls 1

sigmoidFunction · 0.70

Tested by

no test coverage detected