Skip to content

Instantly share code, notes, and snippets.

@srikarplus
Created October 9, 2018 02:22
Show Gist options
  • Save srikarplus/9de1ea8114fee856bcee37a2a43551d7 to your computer and use it in GitHub Desktop.
Save srikarplus/9de1ea8114fee856bcee37a2a43551d7 to your computer and use it in GitHub Desktop.
theta_opt = opt.fmin_cg(maxiter = 50, f = nnCostFunc, x0 = nn_initial_params, fprime = nnGrad, \
args = (input_layer_size, hidden_layer_size, num_labels, X, y.flatten(), lmbda))
theta1_opt = np.reshape(theta_opt[:hidden_layer_size*(input_layer_size+1)], (hidden_layer_size, input_layer_size+1), 'F')
theta2_opt = np.reshape(theta_opt[hidden_layer_size*(input_layer_size+1):], (num_labels, hidden_layer_size+1), 'F')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment