Example #1
0
 function activate()
 {
     $sum = 0;
     foreach (array_keys($this->inputs) as $k) {
         $sum += $this->inputs[$k] * $this->weights[$k];
     }
     $this->setOutput(Maths::sigmoid($sum));
 }
Example #2
0
File: Neuron.php Project: 0-php/AI
 /**
  * @uses Maths::sigmoid()
  */
 public function activate()
 {
     $floatSum = 0;
     foreach ($this->arrInputs as $intKey => $floatInput) {
         $floatSum += $floatInput * $this->arrWeights[$intKey];
     }
     $this->floatOutput = Maths::sigmoid($floatSum);
 }