Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
b4b4f37
Add count_categorical_param_in_grid
kAIto47802 Feb 4, 2026
b1d28a3
Add count_numerical_param_in_grid
kAIto47802 Feb 4, 2026
ab310e4
Add common
kAIto47802 Feb 4, 2026
c6a80a2
Add PedAnovaImportanceEvaluator
kAIto47802 Feb 10, 2026
af07558
Add get_top_quantile_trials
kAIto47802 Feb 10, 2026
8dd1eb0
Add evaluate_with_target
kAIto47802 Feb 10, 2026
c0c9100
Update use
kAIto47802 Feb 10, 2026
1a2510b
Add trait ImportanceEvaluator
kAIto47802 Feb 10, 2026
8556b4f
Update common
kAIto47802 Feb 10, 2026
0768d82
Add is_single
kAIto47802 Feb 10, 2026
3be85c1
Rename
kAIto47802 Feb 10, 2026
3da55f5
Add build_parzen_estimator
kAIto47802 Feb 10, 2026
b0e7724
Update
kAIto47802 Feb 10, 2026
62a30ff
Add compute_pearson_divergence
kAIto47802 Feb 10, 2026
fb13ea6
Update
kAIto47802 Feb 10, 2026
1bf7a03
Update use
kAIto47802 Feb 10, 2026
87a7dda
Introduce ImportanceOptions
kAIto47802 Feb 10, 2026
6e6ca53
Add get_param_importances
kAIto47802 Feb 10, 2026
e1426d1
Add normalize_importances and default_target
kAIto47802 Feb 10, 2026
efa8ee1
Update trait ImportanceEvaluator
kAIto47802 Feb 10, 2026
9421743
Use ImportanceOptions
kAIto47802 Feb 10, 2026
23a49e7
Update lib.rs
kAIto47802 Feb 10, 2026
34f9b4c
Add ensure_target_for_multi_objective
kAIto47802 Feb 10, 2026
4624da7
Add ensure_target_for_multi_objective
kAIto47802 Feb 10, 2026
2319b2a
Add ImportanceEvaluatorError
kAIto47802 Feb 10, 2026
de7bbe4
Apply formatter
kAIto47802 Feb 10, 2026
d8c9f14
Add examples
kAIto47802 Feb 10, 2026
3073540
Add default
kAIto47802 Feb 13, 2026
72c03e2
Add test utils
kAIto47802 Feb 13, 2026
aabe02b
Add tests for ped anova
kAIto47802 Feb 13, 2026
484f6b0
Add tests for ped anova
kAIto47802 Feb 13, 2026
cd68c55
Update objectives
kAIto47802 Feb 13, 2026
fa5e8a2
Add tests for common
kAIto47802 Feb 13, 2026
c910547
Apply formatter
kAIto47802 Feb 13, 2026
9053578
Update tests for ped anova
kAIto47802 Feb 13, 2026
6dfe461
Update tests
kAIto47802 Feb 13, 2026
d5d6c76
Apply formatter
kAIto47802 Feb 13, 2026
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
27 changes: 27 additions & 0 deletions rustuna_core/src/distribution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,33 @@ impl Distribution {
_ => Err(Error::new(ErrorKind::IncompatibleDistribution)),
}
}

pub fn is_single(&self) -> bool {
match self {
Distribution::Float {
low, high, step, ..
} => {
if let Some(step) = step {
low == high || high - low - step < 1e-12
} else {
low == high
}
}
Distribution::Int {
low,
high,
step,
log,
} => {
if *log {
low == high
} else {
low == high || high - low < *step
}
}
Distribution::Categorical { cardinality } => *cardinality == 1,
}
}
}

#[cfg(test)]
Expand Down
1 change: 1 addition & 0 deletions rustuna_core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,5 @@ pub enum ErrorKind {
NoCompletedTrial,
IncompatibleDistribution,
Unexpected,
ImportanceEvaluatorError,
}
2 changes: 1 addition & 1 deletion rustuna_core/src/parzen_estimator/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl ParzenEstimator {
)
}

pub fn new_with_scott(
pub fn with_scott(
observations: &HashMap<String, Vec<f64>>,
search_space: &HashMap<String, Distribution>,
weights: &[f64],
Expand Down
31 changes: 31 additions & 0 deletions rustuna_importance/examples/ped_anova.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
use std::sync::{Arc, Mutex};

use rustuna_core::sampler::RandomSampler;
use rustuna_core::storage::InMemoryStorage;
use rustuna_core::study::{create_study, Direction};
use rustuna_core::Result;
use rustuna_importance::{self, PedAnovaImportanceEvaluator};

fn main() -> Result<()> {
let storage = InMemoryStorage::new();
let directions = vec![Direction::Minimize];
let mut study = create_study("simple-quadratic", storage, directions)?;

let sampler = Arc::new(Mutex::new(RandomSampler::new()));
study.optimize(
|mut t| {
let x = t.suggest_float("x", 0.0, 10.0)?;
let y = t.suggest_float("y", 0.0, 10.0)?;
let value = x + y * 3.0;
println!("{:2} x: {}, y: {}, value: {}", t.number, x, y, value);
Ok(vec![value])
},
sampler,
50,
)?;
let evaluator = PedAnovaImportanceEvaluator::new(0.1, 1.0, true);
let importances = rustuna_importance::get_param_importances(&study, &evaluator)?;
println!("Parameter importances: {importances:?}");

Ok(())
}
Loading