PHP Classes

Small error in the code

Recommend this page to a friend!

      Spell Corrector  >  All threads  >  Small error in the code  >  (Un) Subscribe thread alerts  
Subject:Small error in the code
Summary:Array model not defined in the train function
Messages:1
Author:urmi bhambhani
Date:2012-10-18 06:10:35
 

  1. Small error in the code   Reply   Report abuse  
Picture of urmi bhambhani urmi bhambhani - 2012-10-18 06:10:35
In the function 'train', the array 'model' is not defined.
And the line "model[$f] += 1;" is used. Instead of that line, the code to be inserted is:

if(array_key_exists($f, $model))
$model[$f] += 1;
else
$model[$f] = 1;