From 007c574183c6a820a21d4704a7cfd8737f32f2fb Mon Sep 17 00:00:00 2001 From: Brandon Rodriguez <brodriguez8774@gmail.com> Date: Mon, 1 Jun 2020 09:05:51 -0400 Subject: [PATCH] Add sorting to generated sets --- a3.r | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/a3.r b/a3.r index 71f17fe..61bbdd4 100644 --- a/a3.r +++ b/a3.r @@ -47,8 +47,8 @@ apriori <- function(itemsets, min_support, display_candidates=TRUE, display_freq # Not first level. } - # catn('Freq Itemsets:') - # print(frequent_itemsets) + catn('Freq Itemsets:') + print(frequent_itemsets) } catn('================================================================================') @@ -110,6 +110,11 @@ apriori_initialize_candidates <- function(initial_set, level, debug=FALSE) { } } + # Reorder to be more human-legible. + cand_order <- order(cand_names) + candidates <- candidates[cand_order] + cand_names <- cand_names[cand_order] + if (debug) { catn('Final candidate set:') print(candidates) -- GitLab