Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
erikasan committed Nov 18, 2020
1 parent 51e66fc commit 041754b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion programs/regression_with_neural_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ def FrankeFunction(x, y):
return term1 + term2 + term3 + term4

def prepare_data(x, y, z):
"""Prepare data on a form that the neural network can handle.
Only works on scalar functions of two variables, e.g. the Frankefunction."""
assert len(x) == len(y) == len(z), "shape of x, y, z do not match"
input_data = [np.array([i, j]) for i, j in zip(x, y)]
for arr in input_data:
Expand Down Expand Up @@ -39,7 +41,6 @@ def prepare_data(x, y, z):
net = NeuralNetwork(layers=layers, mode='regression')
net.SGD(training_data, epochs=30, mini_batch_size=10, eta=3, lmbda=0)


ztilde = net.feedforward(input_test)
ztilde = ztilde.flatten()
z_exact = z_test.flatten()
Expand Down

0 comments on commit 041754b

Please sign in to comment.