summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2019-02-10 22:26:22 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2019-02-10 22:26:22 +0100
commit280f46020905e127f3488d0e91100805a0c872b3 (patch)
treeb4e8a61c9a17b3212ea878785c4ca346481c29f0
parent36752e4e050d52ddd4f92b47a876092dde27bd34 (diff)
downloadnixos-280f46020905e127f3488d0e91100805a0c872b3.tar
nixos-280f46020905e127f3488d0e91100805a0c872b3.tar.gz
nixos-280f46020905e127f3488d0e91100805a0c872b3.tar.bz2
nixos-280f46020905e127f3488d0e91100805a0c872b3.tar.xz
nixos-280f46020905e127f3488d0e91100805a0c872b3.zip
...
-rw-r--r--ymir.nix43
1 files changed, 3 insertions, 40 deletions
diff --git a/ymir.nix b/ymir.nix
index 9f6eec48..fb2e7d74 100644
--- a/ymir.nix
+++ b/ymir.nix
@@ -1118,22 +1118,9 @@ in rec {
1118 expire = 8640000; 1118 expire = 8640000;
1119 new_schema = true; 1119 new_schema = true;
1120 backend = "redis"; 1120 backend = "redis";
1121 autolearn = true; 1121 per_user = true;
1122 1122
1123 per_user = <<EOD 1123 autolearn = [-5, 15];
1124 return function(task)
1125 local rcpt = task:get_recipients(1)
1126
1127 if rcpt then
1128 one_rcpt = rcpt[1]
1129 if one_rcpt['domain'] then
1130 return one_rcpt['domain']
1131 end
1132 end
1133
1134 return nil
1135 end
1136 EOD
1137 1124
1138 statfile { 1125 statfile {
1139 symbol = "BAYES_HAM"; 1126 symbol = "BAYES_HAM";
@@ -1143,30 +1130,6 @@ in rec {
1143 symbol = "BAYES_SPAM"; 1130 symbol = "BAYES_SPAM";
1144 spam = true; 1131 spam = true;
1145 } 1132 }
1146 learn_condition =<<EOD
1147 return function(task, is_spam, is_unlearn)
1148 local prob = task:get_mempool():get_variable('bayes_prob', 'double')
1149
1150 if prob then
1151 local in_class = false
1152 local cl
1153 if is_spam then
1154 cl = 'spam'
1155 in_class = prob >= 0.95
1156 else
1157 cl = 'ham'
1158 in_class = prob <= 0.05
1159 end
1160
1161 if in_class then
1162 return false,string.format('already in class %s; probability %.2f%%',
1163 cl, math.abs((prob - 0.5) * 200.0))
1164 end
1165 end
1166
1167 return true
1168 end
1169 EOD
1170 ''; 1133 '';
1171 }; 1134 };
1172 }; 1135 };