In [21]:
plt.figure(figsize=(14, 14))
n_h_l = [1, 2,3, 4, 5, 10]
num_it = 20000

for i, n_h in enumerate(n_h_l):
    plt.subplot(5, 2, i + 1)
    plt.title('Num of iterations %d' % it)
    learning_rate = 0.1
    parameters = NN_model(X_train,y_train,n_h, num_it, learning_rate)
    
    predictions = predict(parameters, X_test)
    accuracy = 100 - np.mean(np.abs(predictions - y_test)) * 100
    accuracy = round(accuracy,2)
    title_string = 'number of hidden units = '+str(n_h)+' classified with accuracy = ' + str(accuracy)+'%'
    plot_grid(parameters, X_train)
    plot_classified(X_test, predictions, 'LightBlue', 'Orange', title_string )