]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Change neural plugin's loss function 3478/head
authorPragadeesh C <pchandiran@mimecast.com>
Wed, 19 Aug 2020 06:47:49 +0000 (02:47 -0400)
committerPragadeesh C <pchandiran@mimecast.com>
Fri, 21 Aug 2020 06:41:17 +0000 (02:41 -0400)
Modified the neural network to use ceb_neg loss function.

src/plugins/lua/neural.lua

index e3518d3bd78dcbdb72b8b6a25b70cfb6d61f7f39..99efe720eb8e839edf006c98d9f6ea4c546c8c21 100644 (file)
@@ -342,8 +342,8 @@ local function create_ann(n, nlayers)
   local nhidden = math.floor((n + 1) / 2)
   local t = rspamd_kann.layer.input(n)
   t = rspamd_kann.transform.relu(t)
-  t = rspamd_kann.transform.tanh(rspamd_kann.layer.dense(t, nhidden));
-  t = rspamd_kann.layer.cost(t, 1, rspamd_kann.cost.mse)
+  t = rspamd_kann.layer.dense(t, nhidden);
+  t = rspamd_kann.layer.cost(t, 1, rspamd_kann.cost.ceb_neg)
   return rspamd_kann.new.kann(t)
 end