|
From: <jgr...@us...> - 2003-09-10 04:06:23
|
Update of /cvsroot/popfile/engine/Classifier
In directory sc8-pr-cvs1:/tmp/cvs-serv30285/Classifier
Modified Files:
Bayes.pm
Log Message:
Division is faster than log
Index: Bayes.pm
===================================================================
RCS file: /cvsroot/popfile/engine/Classifier/Bayes.pm,v
retrieving revision 1.191
retrieving revision 1.192
diff -C2 -d -r1.191 -r1.192
*** Bayes.pm 10 Sep 2003 04:04:27 -0000 1.191
--- Bayes.pm 10 Sep 2003 04:06:19 -0000 1.192
***************
*** 350,354 ****
if ( defined( $value ) ) {
my $total = $self->get_bucket_word_count( $bucket );
! return log( $value ) - log( $total );
} else {
return 0;
--- 350,354 ----
if ( defined( $value ) ) {
my $total = $self->get_bucket_word_count( $bucket );
! return log( $value / $total );
} else {
return 0;
***************
*** 445,449 ****
if ( $self->{full_total__} > 0 ) {
! $self->{not_likely__} = -log( $self->{full_total__} ) - log(10);
foreach my $bucket (keys %{$self->{matrix__}}) {
--- 445,449 ----
if ( $self->{full_total__} > 0 ) {
! $self->{not_likely__} = -log( $self->{full_total__} / 10 );
foreach my $bucket (keys %{$self->{matrix__}}) {
***************
*** 451,455 ****
if ( $total != 0 ) {
! $self->{bucket_start__}{$bucket} = log( $total ) - log( $self->{full_total__} );
} else {
$self->{bucket_start__}{$bucket} = 0;
--- 451,455 ----
if ( $total != 0 ) {
! $self->{bucket_start__}{$bucket} = log( $total / $self->{full_total__} );
} else {
$self->{bucket_start__}{$bucket} = 0;
|