diff --git a/Cargo.lock b/Cargo.lock index eafd12781..e205007ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3268,12 +3268,13 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pav_regression" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55e602c9eaa5bd2b89f5214636de0a845ddb2000db1cb429887eac12dbcd5996" +checksum = "13de74d772b05f09cece1a9af106ddd386d28f059692cba2c1e61a9fe76fb66b" dependencies = [ "ordered-float 3.9.2", "serde", + "thiserror", ] [[package]] diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index 82d1f5251..f15f1faa5 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -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" } @@ -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" diff --git a/crates/core/src/router/isotonic_estimator.rs b/crates/core/src/router/isotonic_estimator.rs index ed0f1ebde..a14e7d888 100644 --- a/crates/core/src/router/isotonic_estimator.rs +++ b/crates/core/src/router/isotonic_estimator.rs @@ -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; @@ -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, pub peer_adjustments: HashMap, } @@ -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 =