Implementing a Multilayer Perceptron for the XOR Problem

Learn how to implement a basic multilayer perceptron and what to expect from it.

Naming, initializations, and error calculation

Let’s illustrate a basic multilayer perceptron implementation in Python on the XOR\text{XOR} problem. As already discussed in the simple perceptron implementation before, the program starts by defining the training problem (the training dataset) in the feature arrays X and desired label vector Y. We then introduce and initialize some variables, which now include the activation of the hidden nodes h and the weights to the hidden nodes wh, as well as the corresponding gradient dwh and delta term dh.

Get hands-on with 1200+ tech skills courses.