Skip to content

Commit

Permalink
fix fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
jirigav committed Nov 7, 2023
1 parent 45dc4d9 commit a716e2f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
7 changes: 6 additions & 1 deletion src/bottomup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,12 @@ pub(crate) fn bottomup(
args: &Args,
) -> Vec<Pattern> {
let mut start = Instant::now();
let top_k = phase_one(data, args.k, args.block_size * args.block_size_multiple, args.base_pattern_size);
let top_k = phase_one(
data,
args.k,
args.block_size * args.block_size_multiple,
args.base_pattern_size,
);
println!("phase one {:.2?}", start.elapsed());
start = Instant::now();
let r = phase_two(
Expand Down
23 changes: 18 additions & 5 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,30 @@ pub(crate) fn prepare_data(
} else {
training_data = transform_training_data(data, block_size, block_size_multiple);
}
println!("tr {}, te {}", training_data.data.len(), testing_data_option.as_ref().unwrap().data.len());
println!(
"tr {}, te {}",
training_data.data.len(),
testing_data_option.as_ref().unwrap().data.len()
);
(training_data, validation_data_option, testing_data_option)
}

fn transform_training_data(data: Vec<Vec<u8>>, block_size: usize, block_size_multiple: usize) -> Data {
if block_size_multiple == 1{
fn transform_training_data(
data: Vec<Vec<u8>>,
block_size: usize,
block_size_multiple: usize,
) -> Data {
if block_size_multiple == 1 {
return transform_data(data);
}

let data_flattened: Vec<Vec<u8>> = data.into_iter().flat_map(|x| x).collect_vec().chunks(block_size/8).map(<[u8]>::to_vec).collect();
let data_flattened: Vec<Vec<u8>> = data
.into_iter()
.flatten()
.collect_vec()
.chunks(block_size / 8)
.map(<[u8]>::to_vec)
.collect();

let mut data_duplicated = Vec::new();

Expand All @@ -167,7 +181,6 @@ fn transform_training_data(data: Vec<Vec<u8>>, block_size: usize, block_size_mul
block.append(&mut data_flattened[i + j].clone());
}
data_duplicated.push(block);

}

transform_data(data_duplicated)
Expand Down

0 comments on commit a716e2f

Please sign in to comment.