Slide 22
Slide 22 text
Now letโs implement the logic that produces the Neuronโs output
val output: List[Bit] = process(inputs)
private def process(inputs: List[List[Bit]]): List[Bit] =
inputs.transpose.map { xs => f(g(xs)) }
private def g(xs: List[Bit]): Int =
xs.sum
private def f(z: Int): Bit =
if z < ฮธ then 0 else 1
The process functionโs first step is to take the Neuronโs inputs, i.e. a list of ๐ SignalSource outputs with the ๐๐กโ output being
List(๐ฅ๐1,
๐ฅ๐2 , โฆ ,
๐ฅ๐๐
), and transpose it into a list of ๐ parameter lists with the ๐๐กโ parameter list being List(๐ฅ1๐
, ๐ฅ2๐
, โฆ , ๐ฅ๐๐).
The process functionโs second step is to map each parameter list List(๐ฅ1๐
, ๐ฅ2๐
, โฆ , ๐ฅ๐๐), referred to as ๐ฅ, to ๐ ๐(๐ฅ) , referred to as
๐ฆ๐
, thereby producing output List(๐ฆ1
, ๐ฆ2
, โฆ , ๐ฆ๐).
๐ ๐ฅ = ๐ฅ1
+ ๐ฅ2
+ ๐ฅ3
+ โฏ + ๐ฅ๐
= &
+,-
.
๐ฅ๐
๐ ๐ง = )
0, ๐ง < ๐
1, ๐ง โฅ ๐
๐ฆ = ๐ ๐(๐ฅ) = )
0, ๐(๐ฅ) < ๐
1, ๐(๐ฅ) โฅ ๐
List(List ๐ฅ11
, ๐ฅ12
, โฆ , ๐ฅ1๐
, List ๐ฅ21
, ๐ฅ22
, โฆ , ๐ฅ2๐
, โฆ , List ๐ฅ๐1
, ๐ฅ๐2
, โฆ , ๐ฅ๐๐
)
โ ๐ ๐ก๐๐ 1 โ ๐ก๐๐๐๐ ๐๐๐ ๐
List(List ๐ฅ11
, ๐ฅ21
, โฆ , ๐ฅ๐1
, List ๐ฅ12
, ๐ฅ22
, โฆ , ๐ฅ๐2
โฆ , List ๐ฅ1๐
, ๐ฅ2๐
, โฆ , ๐ฅ๐๐
))
โ ๐ ๐ก๐๐2 โ ๐๐๐ ๐ ๐๐ 1. . ๐: ๐ฅ = ๐ฅ1๐
, ๐ฅ2๐
, โฆ , ๐ฅ๐๐; ๐ฆ๐
= ๐ ๐ ๐ฅ
List(y1
, y2
, โฆ , ym
)