Nano Brain for Unity v0.1
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Properties | List of all members
NanoBrain.Neuron Class Reference

Description

A neuron is a basic Nucleus.

Inheritance diagram for NanoBrain.Neuron:
NanoBrain.Nucleus NanoBrain.MemoryCell

Public Types

enum  CombinatorType { Sum , Product }
 The type of combinators. More...
 
enum  ActivationType {
  Linear , Power , Sqrt , Reciprocal ,
  Tanh , Binary , Normalized , Custom
}
 The type of.
 
enum  Type { None , Neuron , MemoryCell , Cluster }
 Function to clone a nucleus to a Cluster prefab. More...
 

Public Member Functions

 Neuron (Cluster parent, string name)
 Create a new Neuron in a Cluster instance.
 
Synapse AddSynapse (Neuron sendingNucleus, float weight=1)
 Add a new synapse to this nuclues.
 
Synapse GetSynapse (Nucleus sender)
 Find a synapse.
 
void RemoveSynapse (Nucleus sendingNucleus)
 Remove a synapse from a Nucleus.
 
virtual void SetBias (Vector3 inputValue)
 Set the bias, recalculate the output and update all Nuclei receiving from this Nucleus.
 
AnimationCurve GenerateCurve ()
 
void SleepCheck ()
 
override Nucleus ShallowCloneTo (Cluster newParent)
 Toggle for printing debugging trace data.
 
override void UpdateStateIsolated ()
 
float3 CombinatorSum ()
 
float3 CombinatorProduct ()
 
Vector3 CombinatorSum ()
 
Vector3 CombinatorProduct ()
 
Vector3 CombinatorMax ()
 
virtual void AddReceiver (Nucleus receiverToAdd, float weight=1)
 
virtual void RemoveReceiver (Nucleus receiverToRemove)
 
virtual void ProcessStimulus (Vector3 inputValue)
 Process an external stimulus.
 
virtual void UpdateNuclei ()
 Update the state and recursively all Nuclei receiving data from this Nucleus.
 

Static Public Member Functions

static void Delete (Nucleus nucleus)
 

Public Attributes

Vector3 bias = Vector3.zero
 Create a new Neuron in a Cluster Prefab.
 
CombinatorType combinator = CombinatorType.Sum
 The type of combinator used for this Neuron.
 
ActivationType _curvePreset
 
AnimationCurve curve
 
float curveMax = 1.0f
 
Action WhenFiring
 
bool persistOutput = false
 
float lastUpdate = 0
 Toggle for printing debugging trace data.
 
readonly float timeToSleep = 1f
 
string name
 The name of the Nucleus.
 
Cluster parent
 The cluster prefab in which the nucleus is located.
 

Protected Member Functions

virtual void CloneFields (Neuron clone)
 
void CheckSleepingSynapses ()
 
float3 ActivatorLinear (float3 input)
 
float3 ActivatorSqrt (float3 input)
 
float3 ActivatorPower (float3 input)
 
float3 ActivatorReciprocal (float3 input)
 
float3 ActivatorTanh (float3 input)
 
float3 ActivatorBinary (float3 input)
 
float3 ActivatorNormalized (float3 input)
 
float3 ActivatorCustom (float3 input)
 
Vector3 ActivatorLinear (Vector3 input)
 
Vector3 ActivatorSqrt (Vector3 input)
 
Vector3 ActivatorPower (Vector3 input)
 
Vector3 ActivatorReciprocal (Vector3 input)
 
Vector3 ActivatorCustom (Vector3 input)
 

Protected Attributes

float3 _outputValue
 
Vector3 _outputValue
 

Properties

List< Synapsesynapses [get]
 The synapses of the nucleus.
 
ActivationType curvePreset [get, set]
 
virtual float3 outputValue [get, set]
 
float outputMagnitude [get]
 
float outputSqrMagnitude [get]
 
virtual Vector3 outputValue [get, set]
 
bool isFiring [get]
 
virtual bool isSleeping [get]
 
Func< float3 > Combinator [get]
 
Func< Vector3 > Combinator [get]
 
Func< float3, float3 > Activator [get]
 
Func< Vector3, Vector3 > Activator [get]
 
virtual List< Nucleusreceivers [get, set]
 

Member Enumeration Documentation

◆ CombinatorType

The type of combinators.

A combinator combines the weighted values of the synapses to a single value

Enumerator
Sum 

Add the weighted values together.

Product 

Multiply the weighted values.

◆ Type

enum NanoBrain.Nucleus.Type
inherited

Function to clone a nucleus to a Cluster prefab.

Parameters
prefab
Returns

The types of Nucleus

Constructor & Destructor Documentation

◆ Neuron()

NanoBrain.Neuron.Neuron ( Cluster  parent,
string  name 
)

Create a new Neuron in a Cluster instance.

Parameters
parentThe parent cluster in which the new Neuron should be created
nameThe name of the new Neuron

Member Function Documentation

◆ AddSynapse()

Synapse NanoBrain.Neuron.AddSynapse ( Neuron  sendingNucleus,
float  weight = 1 
)

Add a new synapse to this nuclues.

Parameters
sendingNucleusThe nucleus from which the signals may originate
weightThe weight applied to the input. Default value = 1
Returns
The created Synapse

This will add a new input to this nucleus with the given weight.

◆ GetSynapse()

Synapse NanoBrain.Neuron.GetSynapse ( Nucleus  sender)

Find a synapse.

Parameters
senderThe sender of the input to the Synapse
Returns
The found Synapse or null when the sender has no synapse to this nucleus.

◆ RemoveSynapse()

void NanoBrain.Neuron.RemoveSynapse ( Nucleus  sendingNucleus)

Remove a synapse from a Nucleus.

Parameters
sendingNucleusRemote the synapse connecting to this Nucleus

◆ SetBias()

virtual void NanoBrain.Neuron.SetBias ( Vector3  inputValue)
virtual

Set the bias, recalculate the output and update all Nuclei receiving from this Nucleus.

Parameters
inputValue

◆ ShallowCloneTo()

override Nucleus NanoBrain.Neuron.ShallowCloneTo ( Cluster  newParent)

Toggle for printing debugging trace data.

Function to make a partial clone of this nucleus

Parameters
parentThe cluster in which the cloned nucleus should be placed
Returns

◆ ProcessStimulus()

virtual void NanoBrain.Neuron.ProcessStimulus ( Vector3  inputValue)
virtual

Process an external stimulus.

Parameters
inputValueThe value of the stimulus
thingIdThe id of the thing causing the stimulus
thingNameThe name of the thing causing the stimulus

◆ UpdateNuclei()

virtual void NanoBrain.Nucleus.UpdateNuclei ( )
virtualinherited

Update the state and recursively all Nuclei receiving data from this Nucleus.

Reimplemented in NanoBrain.MemoryCell.

Member Data Documentation

◆ bias

Vector3 NanoBrain.Neuron.bias = Vector3.zero

Create a new Neuron in a Cluster Prefab.

Parameters
prefabThe Cluster Preafb in which the new Neuron should be created
nameThe name of the new Neuron

The bias

The bias which a value which is always added to the combined value of the neuron It does not have a synapse and therefore no weight of source nucleus

◆ parent

Cluster NanoBrain.Nucleus.parent
inherited

The cluster prefab in which the nucleus is located.

The cluster instance in which the nucleus is located


The documentation for this class was generated from the following file: