Files
rustytorch/crates/training/rtx-automeasure/benches/automl_bench.rs
T
2026-03-04 00:08:42 +00:00

41 lines
1.4 KiB
Rust

use criterion::{Criterion, black_box, criterion_group, criterion_main};
use rtx_automeasure::{AutoMLAgent, AutoMLConfig, TaskType};
use rtx_tensor::Tensor;
fn benchmark_automl_fit(c: &mut Criterion) {
let rt = tokio::runtime::Runtime::new().unwrap();
c.bench_function("automl_basic_fit", |b| {
b.iter(|| {
rt.block_on(async {
let config = AutoMLConfig::new()
.with_task_type(TaskType::Classification)
.with_time_budget(10); // Very short for benchmark
let mut agent = AutoMLAgent::new(config).unwrap();
let x_train = Tensor::randn(&[50, 5], rtx_tensor::DType::F32);
let y_train = Tensor::zeros(&[50], rtx_tensor::DType::I64);
let _pipeline = agent.fit(&x_train, &y_train).await.unwrap();
})
})
});
}
fn benchmark_model_selection(c: &mut Criterion) {
let rt = tokio::runtime::Runtime::new().unwrap();
c.bench_function("model_selector_recommend", |b| {
b.iter(|| {
rt.block_on(async {
// This will be implemented when we create the actual modules
// For now, just a placeholder
black_box(());
})
})
});
}
criterion_group!(benches, benchmark_automl_fit, benchmark_model_selection);
criterion_main!(benches);