using System; using Unity.Mathematics; /// /// The Pulsar represents a type of neuron that operates based on /// the product of its weighted inputs rather than the traditional summation. /// Drawing inspiration from the concept of pulsars in astrophysics /// —highly magnetized rotating neutron stars that emit beams of radiation— /// the Pulsar could symbolize dynamic, focused output based on the interaction of multiple factors. /// /// Multiplicative Functionality: /// Instead of summing inputs, the Pulsar takes the weighted product of its inputs. /// This means that all inputs must be active (non-zero) for the neuron to "pulse" or activate. /// Output Behavior: /// The output could amplify or diminish depending on the magnitude of the inputs. /// The product would be sensitive to small values, /// which means that even a small input could significantly lower the overall output if multiplied. /// Activation Mechanism: /// The activation function can further refine the output from the product result. /// For instance, a certain threshold could be used to determine if a pulse occurs. /// Modeling Complex Interactions: /// The Pulsar could be particularly beneficial for modeling situations where interactions multiply rather than add. /// This is useful in fields such as economics (e.g., compound growth models), /// biology (e.g., interaction of hormones), and machine learning where multiplicative relationships exist. [Serializable] public class Pulsar : Neuron { public Pulsar(Cluster parent, string name) : base(parent, name) { // To prevent mistakes, bias one (instead of zero for standard neurons) this.bias = new float3(1, 1, 1); } public Pulsar(ClusterPrefab parent, string name) : base(parent, name) { // To prevent mistakes, bias one (instead of zero for standard neurons) this.bias = new float3(1, 1, 1); } public override Nucleus ShallowCloneTo(Cluster newParent) { Pulsar clone = new(newParent, this.name); CloneFields(clone); return clone; } public override void UpdateStateIsolated() { float3 product = this.bias; //Applying the weight factors foreach (Synapse synapse in this.synapses) { float3 input = synapse.weight * synapse.nucleus.outputValue; product *= input; } // Activation function this.outputValue = Activator(product); } }