Navigation Menu

Skip to content

Commit

Permalink
idf
Browse files Browse the repository at this point in the history
  • Loading branch information
ultraist committed Aug 24, 2009
1 parent 387bad2 commit 688a763
Show file tree
Hide file tree
Showing 2 changed files with 877 additions and 877 deletions.
4 changes: 2 additions & 2 deletions Repo.pm
Expand Up @@ -169,9 +169,9 @@ sub ranking
# idf
my $eps = 1e-64;
my $ud = log($eps + scalar(@{$user->users()}));
my $ilog2 = 1.0 / log(2.0);
my $ilog = 1.0 / log(3.0);
foreach my $rid (keys(%{$self->{id}})) {
$self->{id}->{$rid}->{idf} = 1 + $ilog2 * ($ud - log(3 + $self->{id}->{$rid}->{freq}));
$self->{id}->{$rid}->{idf} = 1 + $ilog * ($ud - log($eps + $self->{id}->{$rid}->{freq}));
}

# normalize freq
Expand Down

0 comments on commit 688a763

Please sign in to comment.