Langage:Python
Version:3.4
Reference:http://blog.csdn.net/dream_an/article/details/51782161
神经网络专题
#needed modules
import matplotlib.pyplot as plt
import numpy as np
import sklearn
import sklearn.datasets
import sklearn.linear_model
import matplotlib
# Generate a dataset and plot it
np.random.seed(0)
x, y = sklearn.datasets.make_moons(200, noise=0.20)
plt.scatter(x[:,0], x[:,1], s=40, c=y, cmap=plt.cm.Spectral)
%If you type these codes on the terminal, the following picture will show:
%
# training set size
num_examples = len(x)
# input layer dimensionality
nn_input_dim = 2
# output layer dimensionality
nn_output_dim = 2
# Gradient descent parameters (I picked these by hand)
# learning rate for gradient descent
epsilon = 0.01
# regularization strength
reg_lambda = 0.01
# Helper function to plot a decision boundary.
# If you don't fully understand this function don't worry, i