Develop and Download Open Source Software

Browse CVS Repository

Diff of /gikonavigoeson/gikonavi/GikoBayesian.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.9 by yoffy, Wed Oct 27 00:10:12 2004 UTC revision 1.10 by yoffy, Sun Oct 31 12:24:33 2004 UTC
# Line 629  begin Line 629  begin
629          end;          end;
630          mean := mean / wordCount.Count;          mean := mean / wordCount.Count;
631    
632          cnt := 0;          P1 := 1;
633          P1 := 0;          Q1 := 1;
         Q1 := 0;  
634          for i := 0 to wordCount.Count - 1 do begin          for i := 0 to wordCount.Count - 1 do begin
635                  countInfo       := TWordCountInfo( wordCount.Objects[ i ] );                  countInfo       := TWordCountInfo( wordCount.Objects[ i ] );
636                  n                                               := f( countInfo.WordCount, narray[ i ], mean );                  n                                               := f( countInfo.WordCount, narray[ i ], mean );
637                  if countInfo <> nil then                  P1 := P1 * ( 1 - n );
638                          cnt := cnt + countInfo.WordCount;                  Q1 := Q1 * n;
                 P1 := P1 + Ln( 1 - n ) * countInfo.WordCount;  
                 Q1 := Q1 + Ln( n ) * countInfo.WordCount;  
639          end;          end;
640            cnt := wordCount.Count;
641          if cnt = 0 then          if cnt = 0 then
642                  cnt := 1;                  cnt := 1
643          P1 := 1 - Exp( P1 * (1 / cnt) );          else
644          Q1 := 1 - Exp( Q1 * (1 / cnt) );          P1 := 1 - Power( P1, 1 / cnt );
645            Q1 := 1 - Power( Q1, 1 / cnt );
646    
647          if P1 + Q1 = 0 then begin          if P1 + Q1 = 0 then begin
648                  Result := 0.5                  Result := 0.5

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26