Holger's Java API

## com.antelmann.ai
Class Perceptron

    java.lang.Object
      com.antelmann.ai.Perceptron

All Implemented Interfaces:
  Serializable

    public class Perceptron

extends Object
implements Serializable

Perceptron implements a simple pattern classifier. The Perceptron is an enhanced TLU (Threshold Logic Unit) based on the works by Rosenblatt (Rosenblatt, F. (1962). Principles of Neurodynamics. Spartan Books.). The given implementation here uses boolean values to enforce the duality of the values otherwise represented with 0 and 1. For the purpose of this implementation, false equals 0 and true equals 1. The Perceptron's capability of learning to distinguish two classes (here: not a Java class) of patterns is limited to classes that are linearly separable.

Author:
  Holger Antelmann
See Also:
  Serialized Form

Constructor Summary
`Perceptron(int threshold, int numberOfInputs)`

Method Summary
`protected Object` `clone()` overrides Object.clone() to deep-copy the weight array
`boolean` `compute(boolean[] input)`
`int` `getLength()`
`int` `getThreshold()`
`int` `getWeight(int index)`
`void` `learn(boolean[] input, boolean result)` learns a specified output given the input vector by adjusting the synapses (weights) if the result to be learned does not match the actual current output
`static void` `main(String[] args)` testing app
`protected void` `setThreshold(int threshold)`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Perceptron

    public Perceptron(int threshold,
                      int numberOfInputs)

Method Detail

### compute

    public boolean compute(boolean[] input)

### learn

    public void learn(boolean[] input,
                      boolean result)

  learns a specified output given the input vector by adjusting the synapses (weights) if the result to be learned does not match the actual current output

### setThreshold

    protected void setThreshold(int threshold)

### getThreshold

    public int getThreshold()

### getLength

    public int getLength()

### getWeight

    public int getWeight(int index)

### clone

    protected Object clone()
                    throws CloneNotSupportedException

  overrides Object.clone() to deep-copy the weight array

  Overrides:
    `clone` in class `Object`
  Throws:
    `CloneNotSupportedException`

### main

    public static void main(String[] args)

  testing app

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads