From f24412270b6098fe6a2e361c50d64dbc2379e2ad Mon Sep 17 00:00:00 2001 From: antononcube Date: Mon, 9 Apr 2018 18:02:46 -0400 Subject: [PATCH] Normalization in TrieClassify. --- TriesWithFrequencies.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TriesWithFrequencies.m b/TriesWithFrequencies.m index c9a76519..45f07e6c 100644 --- a/TriesWithFrequencies.m +++ b/TriesWithFrequencies.m @@ -591,7 +591,8 @@ Mathematica is (C) Copyright 1988-2016 Wolfram Research, Inc. Block[{res, dval = OptionValue[TrieClassify, "Default"]}, res = TrieRetrieve[tr, record]; If[Length[res] == 0, <|dval -> 0|>, - ReverseSort[Association[Rule @@@ TrieLeafProbabilities[res]]] + res = ReverseSort[Association[Rule @@@ TrieLeafProbabilities[res]]]; + res / Total[res] ] ];