diff --git a/src/model.rs b/src/model.rs index 4383481..f4dc6f8 100644 --- a/src/model.rs +++ b/src/model.rs @@ -326,8 +326,8 @@ fn derive_prices( let runners = weighted_probs.cols(); let mut counts = Matrix::allocate(PODIUM, runners); - let all_selections = selection::top_n_matrix(PODIUM, runners); - engine.simulate_batch(all_selections.flatten(), counts.flatten_mut()); + let top_n_selections = selection::top_n_matrix(PODIUM, runners); + engine.simulate_batch(top_n_selections.flatten(), counts.flatten_mut()); let mut derived_probs = Matrix::allocate(PODIUM, runners); for runner in 0..runners { diff --git a/src/model/fit.rs b/src/model/fit.rs index e084d31..e452443 100644 --- a/src/model/fit.rs +++ b/src/model/fit.rs @@ -87,13 +87,13 @@ pub fn fit_all(options: &FitOptions, markets: &[Market]) -> Result = (1..model::PODIUM) .map(|rank| { let market = &markets[rank]; let outcome = fit_individual( - &all_selections, + &top_n_selections, &weighted_probs, options.mc_trials, options.individual_target_msre, @@ -166,9 +166,9 @@ pub fn fit_place( ) -> Result { options.validate()?; let num_runners = place_market.probs.len(); - let all_selections = selection::top_n_matrix(model::PODIUM, num_runners); + let top_n_selections = selection::top_n_matrix(model::PODIUM, num_runners); let outcome = fit_individual( - &all_selections, + &top_n_selections, weighted_probs, options.mc_trials, options.individual_target_msre, @@ -217,7 +217,7 @@ pub struct IndividualFitOutcome { } fn fit_individual( - all_selections: &Matrix, + top_n_selections: &Matrix, weighted_probs: &Matrix, mc_trials: u64, target_msre: f64, @@ -245,7 +245,7 @@ fn fit_individual( Rank::index(rank) ); let mut counts = Matrix::allocate(podium_places, runners); - engine.simulate_batch(all_selections.flatten(), counts.flatten_mut()); + engine.simulate_batch(top_n_selections.flatten(), counts.flatten_mut()); let fitted_probs: Vec<_> = counts .row_slice(rank) .iter() diff --git a/src/selection.rs b/src/selection.rs index 6f50955..3865d31 100644 --- a/src/selection.rs +++ b/src/selection.rs @@ -214,13 +214,13 @@ impl<'a> FromStr for Selections<'a> { /// Builds a `podium_places` x `num_runners` matrix populated with top-_N_ selections. pub fn top_n_matrix(podium_places: usize, num_runners: usize) -> Matrix> { - let mut all_selections = Matrix::allocate(podium_places, num_runners); + let mut top_n_selections = Matrix::allocate(podium_places, num_runners); for runner in 0..num_runners { for rank in 0..podium_places { - all_selections[(rank, runner)] = vec![Runner::index(runner).top(Rank::index(rank))].into(); + top_n_selections[(rank, runner)] = vec![Runner::index(runner).top(Rank::index(rank))].into(); } } - all_selections + top_n_selections } pub fn validate_plausible_selections(selections: &[Selection]) -> Result<(), anyhow::Error> {