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:

  1. Implement a Perceptron class derived from the InputPerceptron class that was previously defined:
public class Perceptron : InputPerceptron 
{ 
    public InputPerceptron[] inputList; 
    public delegate float Threshold(float x); 
    public Threshold threshold; 
    public float state; 
    public float error;     
} 
  1. Implement the constructor for setting the number of inputs:
public Perceptron(int inputSize) 
{ 
    inputList = new InputPerceptron[inputSize]; 
} 
  1. Define the function for processing the inputs:
public void FeedForward() ...

Get Unity 2018 Artificial Intelligence Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.