Implementing artificial neural networks
Imagine that we made an enemy or game system that emulates the way the brain works. That's how neural networks operate. They are based on the neuron—we call it the Perceptron
—and are formed of the sum of several neurons; its inputs and outputs are what makes a neural network.
In this recipe, we will learn how to build a neural system, starting from the Perceptron
through to the way that they can be joined to create a network.
Getting ready...
We will need a data type for handling raw input; this is called InputPerceptron
:
public class InputPerceptron { public float input; public float weight; }
How to do it...
We will implement two big classes. The first one is the implementation for the Perceptron
data type, and the second one is the data type handling the neural network. Go through the following steps to implement these two classes:
- Implement a
Perceptron
class derived from theInputPerceptron
class that was previously defined:
public class...