From 99049728cf776840fdf7c7404a5d6860601e7d63 Mon Sep 17 00:00:00 2001 From: jirigav Date: Wed, 4 Oct 2023 11:13:21 +0200 Subject: [PATCH] use top_n parameter --- src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index c52b7a2..d6a9cfe 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,6 +26,7 @@ fn results( training_data: &Data, testing_data: &Data, patterns_combined: usize, + top_n: usize, hist: bool, ) -> (f64, f64) { final_patterns.sort_by(|a, b| { @@ -37,7 +38,7 @@ fn results( if hist { hist_result(final_patterns, training_data, testing_data, start) } else { - let mut best_mp = best_multi_pattern(training_data, &final_patterns, patterns_combined); + let mut best_mp = best_multi_pattern(training_data, &final_patterns.into_iter().take(top_n).collect_vec(), patterns_combined); println!("trained in {:.2?}", start.elapsed()); @@ -102,6 +103,7 @@ fn run_bottomup(args: Args) -> (f64, f64) { &training_data, &testing_data_option.unwrap(), args.patterns_combined, + args.top_n, args.hist, ) }