July 2017
Intermediate to advanced
254 pages
6h 29m
English
Let's use scikit-learn to train a network that approximates XOR. We pass the activation='logistic' keyword argument to the MLPClassifier constructor to specify that the neurons should use the logistic sigmoid activation function. The hidden_layer_sizes parameter takes a tuple of integers that indicate the number of hidden units in each hidden layer. We will train a network with the same architecture as the network we used in the previous section; it has one hidden layer with two hidden units and an output layer with one output unit:
# In[1]:from sklearn.model_selection import train_test_splitfrom sklearn.neural_network import MLPClassifiery = [0, 1, 1, 0]X = [[0, 0], [0, 1], [1, 0], [1, ...
Read now
Unlock full access