with ErroAKD; use ErroAKD; with MathAKD; use MathAKD; package body ANNsAKD is ---------------------------------------------------------------------- -- Copyright (C) 1994 David Wallace Croft. All rights reserved. ---------------------------------------------------------------------- function Lin_Sep_Prob ( M : in natural; N : in positive ) return float is ---------------------------------------------------------------------- -- Linear Separability Probability -- Returns the probability that a simple neuron can correctly classify -- M points in N dimensions. -- "Homework #1", CNS124 "Pattern Recognition", Abu-Mostafa -- & Venkatesh, Caltech, 1994. ---------------------------------------------------------------------- Sum : float := 0.0; begin for J in 0..( N - 1 ) loop exit when J > M - 1; -- Put_Line ( integer'image ( M - 1 ) & integer'image ( J ) ); Sum := Sum + Combination ( M - 1, J ); end loop; return ( 2.0 ** ( 1 - M ) ) * Sum; exception when numeric_error => Notify ( "ANNsAKD.Lin_Sep_Prob", "Numeric_Error" ); raise; when constraint_error => Notify ( "ANNsAKD.Lin_Sep_Prob", "Constraint_Error" ); raise; end Lin_Sep_Prob; ---------------------------------------------------------------------- ---------------------------------------------------------------------- end ANNsAKD;