Output {the weight ,
Var set
of , , = 0, = 0, Maxiteration;
Begin
 for to Maxiteration do
  Train NNAlg on set of ; //
  perception training
   Update( ); //update
   Update( ); //update
 end for
 return ( , )
return
End.
Algorithm 3: Calculate weights of categories and .