From fb03ef5826ee601ec51d7601f49a294c898fb48d Mon Sep 17 00:00:00 2001 From: Kelechi Ukah Date: Fri, 27 Dec 2024 17:40:41 -0500 Subject: [PATCH] training run with parameters as in lib.rs --- src/clustering/lookup.rs | 6 ++---- src/lib.rs | 18 +++++++++--------- src/mccfr/profile.rs | 4 ---- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/clustering/lookup.rs b/src/clustering/lookup.rs index 19b52dd..1f6a5dc 100644 --- a/src/clustering/lookup.rs +++ b/src/clustering/lookup.rs @@ -51,18 +51,16 @@ impl Save for Lookup { std::fs::metadata(format!("{}{}", street, Self::name())).is_ok() } fn make(street: Street) -> Self { - let n = street.n_isomorphisms(); - let progress = crate::progress(n); + // abstractions for River are calculated once via obs.equity + // abstractions for Preflop are cequivalent to just enumerating isomorphisms match street { Street::Rive => IsomorphismIterator::from(Street::Rive) .map(|iso| (iso, Abstraction::from(iso.0.equity()))) - .inspect(|_| progress.inc(1)) .collect::>() .into(), Street::Pref => IsomorphismIterator::from(Street::Pref) .enumerate() .map(|(k, iso)| (iso, Abstraction::from((Street::Pref, k)))) - .inspect(|_| progress.inc(1)) .collect::>() .into(), _ => panic!("lookup must be learned via layer for {street}"), diff --git a/src/lib.rs b/src/lib.rs index 0341ee7..de2f721 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,19 +26,19 @@ const N_RAISE: usize = 3; /// sinkhorn optimal transport parameters const SINKHORN_TEMPERATURE: Entropy = 0.125; -const SINKHORN_ITERATIONS: usize = 16; -const SINKHORN_TOLERANCE: Energy = 0.001; +const SINKHORN_ITERATIONS: usize = 32; +const SINKHORN_TOLERANCE: Energy = 0.005; // kmeans clustering parameters -const KMEANS_FLOP_TRAINING_ITERATIONS: usize = 32; -const KMEANS_TURN_TRAINING_ITERATIONS: usize = 32; -const KMEANS_FLOP_CLUSTER_COUNT: usize = 24; -const KMEANS_TURN_CLUSTER_COUNT: usize = 16; -const KMEANS_EQTY_CLUSTER_COUNT: usize = 64; +const KMEANS_FLOP_TRAINING_ITERATIONS: usize = KMEANS_TURN_TRAINING_ITERATIONS; +const KMEANS_TURN_TRAINING_ITERATIONS: usize = KMEANS_TURN_CLUSTER_COUNT; +const KMEANS_FLOP_CLUSTER_COUNT: usize = 128; +const KMEANS_TURN_CLUSTER_COUNT: usize = 144; +const KMEANS_EQTY_CLUSTER_COUNT: usize = 101; // mccfr parameters -const CFR_BATCH_SIZE: usize = 16; -const CFR_TREE_COUNT: usize = 1024; // WARNING THIS WILL NOT SOLVE ANYTHING +const CFR_BATCH_SIZE: usize = 256; +const CFR_TREE_COUNT: usize = 1_048_576; const CFR_ITERATIONS: usize = CFR_TREE_COUNT / CFR_BATCH_SIZE; const CFR_PRUNNING_PHASE: usize = 100_000_000 / CFR_BATCH_SIZE; const CFR_DISCOUNT_PHASE: usize = 100_000 / CFR_BATCH_SIZE; diff --git a/src/mccfr/profile.rs b/src/mccfr/profile.rs index 7a4e541..2cf4878 100644 --- a/src/mccfr/profile.rs +++ b/src/mccfr/profile.rs @@ -583,12 +583,8 @@ mod tests { /// arguments to the save function to write to a temporary name /// and delete the file fn persistence() { - let name = "test"; - let file = format!("{}.profile.pgcopy", name); let save = Profile::random(); - save.save(); let load = Profile::load(Street::random()); - std::fs::remove_file(file).unwrap(); assert!(std::iter::empty() .chain(save.strategies.iter().zip(load.strategies.iter())) .chain(load.strategies.iter().zip(save.strategies.iter()))