protected function output(array $sample)
    {
        $sum = 0;
        foreach ($this->weights as $index => $w) {
            if ($index == 0) {
                $sum += $w;
            } else {
                $sum += $w * $sample[$index - 1];
            }
        }

        return $sum;
    }
protected function output(array $sample)
    {
        $sum = 0;
        foreach ($this->weights as $index => $w) {
            if ($index == 0) {
                $sum += $w;
            } else {
                $sum += $w * $sample[$index - 1];
            }
        }

        return $sum;
    }
protected function output ( array $ sample ) { $ sum = 0 ; foreach ( $ this -> weights as $ index => $ w ) { if ( $ index == 0 ) { $ sum += $ w ; } else { $ sum += $ w * $ sample [ $ index - 1 ] ; } } return $ sum ; }
Calculates net output of the network as a float value for the given input

@return int|float
Calculates net output of the network as a float value for the given input