Skip to content

Commit

Permalink
update pav.rs to latest version, make some changes to external API (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sanity authored Dec 28, 2024
1 parent b89cc4b commit 824935c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
5 changes: 3 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ itertools = "0.13"
notify = "7"
once_cell = "1"
ordered-float = "4"
pav_regression = "0.4.0"
pav_regression = "0.5.1"
parking_lot = "0.12"
rand = { features = ["small_rng"], workspace = true }
redb = { optional = true, version = "2" }
Expand Down Expand Up @@ -83,7 +83,7 @@ freenet-stdlib = { features = ["net"], workspace = true }
arbitrary = { features = ["derive"], version = "1" }
chrono = { features = ["arbitrary"], workspace = true }
freenet-stdlib = { features = ["net", "testing"], workspace = true }
pav_regression = "0.4"
pav_regression = "0.5.1"
pico-args = "0.5"
statrs = "0.18"
tempfile = "3"
Expand Down
8 changes: 5 additions & 3 deletions crates/core/src/router/isotonic_estimator.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::ring::{Distance, Location, PeerKeyLocation};
use pav_regression::pav::{IsotonicRegression, Point};
use pav_regression::IsotonicRegression;
use pav_regression::Point;
use serde::Serialize;
use std::collections::HashMap;

Expand All @@ -14,7 +15,7 @@ const MIN_POINTS_FOR_REGRESSION: usize = 5;
#[derive(Debug, Clone, Serialize)]
pub(super) struct IsotonicEstimator {
pub global_regression: IsotonicRegression,
pub global_regression: IsotonicRegression<f64>,
pub peer_adjustments: HashMap<PeerKeyLocation, Adjustment>,
}

Expand Down Expand Up @@ -44,7 +45,8 @@ impl IsotonicEstimator {
let global_regression = match estimator_type {
EstimatorType::Positive => IsotonicRegression::new_ascending(&all_points),
EstimatorType::Negative => IsotonicRegression::new_descending(&all_points),
};
}
.expect("Failed to create isotonic regression");

let adjustment_prior_size = 20;
let global_regression_big_enough_to_estimate_peer_adjustments =
Expand Down

0 comments on commit 824935c

Please sign in to comment.