diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-04-20 12:48:54 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-04-20 12:48:54 +0100 |
commit | 8f6c12a2eb6342594a9b8dc3408bec472b82080a (patch) | |
tree | a357d9e81d110d5648f3074447a7489ac02c3b36 /utils | |
parent | 13efe6117d660c7f90302cabfe7f1f083a09c660 (diff) | |
download | rspamd-8f6c12a2eb6342594a9b8dc3408bec472b82080a.tar.gz rspamd-8f6c12a2eb6342594a9b8dc3408bec472b82080a.zip |
[Minor] Fix probability calculations
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/rspamd_stats.pl | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/utils/rspamd_stats.pl b/utils/rspamd_stats.pl index 9d8140c5f..00f08ade8 100755 --- a/utils/rspamd_stats.pl +++ b/utils/rspamd_stats.pl @@ -308,10 +308,22 @@ Junk changes / total junk hits : %6d/%-6d (%7.3f%%) print "Correlations report:\n"; while (my ($cs, $hits) = each %{$r->{corr}}) { - my $corr_prob = $hits / $total; - my $sym_prob = $r->{hits} / $total; - printf "Probability of %s when %s fires: %.3f\n", $s, $cs, - ($corr_prob / $sym_prob); + my $corr_prob = $r->{'hits'} / $total; + my $merged_hits = 0; + if($r->{symbols_met_spam}->{$cs}) { + $merged_hits += $r->{symbols_met_spam}->{$cs}; + } + if($r->{symbols_met_junk}->{$cs}) { + $merged_hits += $r->{symbols_met_junk}->{$cs}; + } + if($r->{symbols_met_ham}->{$cs}) { + $merged_hits += $r->{symbols_met_ham}->{$cs}; + } + + if ($merged_hits > 0) { + printf "Probability of %s when %s fires: %.3f\n", $cs, $s, + (($merged_hits / $total) / $corr_prob); + } } print "Related symbols report:\n"; |