Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update pav.rs to latest version, make some changes to external API #1143

Merged
merged 7 commits into from
Dec 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading