---------------------------------------------------- -- | -- Module : AI.Network -- License : GPL -- -- Maintainer : Kiet Lam -- -- -- This module provides forward propagation -- to let the user get the output of the neural -- network given an input vector -- -- ---------------------------------------------------- module AI.Calculation.NetworkOutput ( networkOutput ) where import Numeric.Container import AI.Network -- | Forward propagate to get the network's output networkOutput :: Network -- ^ The neural network of interest -> Vector Double -- ^ The input vector -> Vector Double -- ^ The output vector of the output neurons networkOutput nn inVec = let activF = toActivation nn ws = toWeightMatrices nn fBias = \v -> fromList $ 1.0:(toList v :: [Double]) in foldl (\as w -> mapVector activF ((fBias as) `vXm` w)) inVec ws