def run_feedforward_nn_for_samples(theta_matrix_1, theta_matrix_2, samples, true_output):
  assert(mathutil.is_np_2d_array(samples))
  num_samples, num_features = samples.shape
  predicted_y = np.empty((num_samples,))
  for row_idx, sample in enumerate(samples):
    predicted_y[row_idx] = run_feedforward_nn_for_sample(theta_matrix_1, theta_matrix_2, sample)
  num_correctly_classified = np.count_nonzero(true_output[:,0] == predicted_y)
  print(num_correctly_classified/num_samples)
Ejemplo n.º 2
0
def reshape_to_np_1darray(x):
  assert(mathutil.is_np_2d_array(x))
  return x.reshape((-1))