From 1b746e395b6ab330cc7aaaf51414cfcf709598ad Mon Sep 17 00:00:00 2001 From: antonocube Date: Mon, 19 Aug 2019 14:17:41 -0400 Subject: [PATCH] Bug fix. --- JavaTriesWithFrequencies.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/JavaTriesWithFrequencies.m b/JavaTriesWithFrequencies.m index f9097810..f7f1d48a 100644 --- a/JavaTriesWithFrequencies.m +++ b/JavaTriesWithFrequencies.m @@ -522,7 +522,7 @@ Mathematica is (C) Copyright 1988-2017 Wolfram Research, Inc. Block[{res, dval = OptionValue[JavaTrieClassify, "Default"]}, res = JavaTrieLeafProbabilities[JavaTrieRetrieve[tr, record], "Normalized"->True]; If[Length[res] == 0, <|dval -> 0|>, - res = AssociationThread[res[[All, 2, 2]] -> res[[All, 1, 2]]]; + res = AssociationThread[res[[All, 1, 2]] -> res[[All, 2, 2]]]; res = ReverseSort[Association[Rule @@@ res]] ] ]; @@ -531,13 +531,13 @@ Mathematica is (C) Copyright 1988-2017 Wolfram Research, Inc. First @* Keys @* TakeLargest[1] /@ JavaTrieClassify[tr, records, "Probabilities", opts]; JavaTrieClassify[tr_, records:(_Dataset|{_List..}), "Probability" -> class_, opts : OptionsPattern[]] := - Map[Lookup[#, class, 0]&, JavaTrieClassify[tr, records, "Probabilities", opts] ]; + Map[ Lookup[#, class, 0]&, JavaTrieClassify[tr, records, "Probabilities", opts] ]; JavaTrieClassify[tr_, records:(_Dataset|{_List..}), "TopProbabilities", opts : OptionsPattern[]] := Map[ Select[#, # > 0 &]&, JavaTrieClassify[tr, records, "Probabilities", opts] ]; JavaTrieClassify[tr_, records:(_Dataset|{_List..}), "TopProbabilities" -> n_Integer, opts : OptionsPattern[]] := - Map[TakeLargest[#, UpTo[n]]&, JavaTrieClassify[tr, records, "Probabilities", opts] ]; + Map[ TakeLargest[#, UpTo[n]]&, JavaTrieClassify[tr, records, "Probabilities", opts] ]; JavaTrieClassify[tr_, records:(_Dataset|{_List..}), "Probabilities", opts:OptionsPattern[] ] := Block[{clRes, classLabels, stencil},