(data: &SearchData<'_>, n_splits: usize)
| 358 | } |
| 359 | |
| 360 | fn validate_search_data(data: &SearchData<'_>, n_splits: usize) -> Result<(), String> { |
| 361 | if data.x.is_empty() { |
| 362 | return Err("x cannot be empty".to_string()); |
| 363 | } |
| 364 | if data.y.is_empty() { |
| 365 | return Err("y cannot be empty".to_string()); |
| 366 | } |
| 367 | if data.x.len() != data.y.len() { |
| 368 | return Err("x/y length mismatch".to_string()); |
| 369 | } |
| 370 | if data.samples_info_sets.len() != data.x.len() { |
| 371 | return Err("samples_info_sets length must match x length".to_string()); |
| 372 | } |
| 373 | if n_splits < 2 { |
| 374 | return Err("n_splits must be >= 2".to_string()); |
| 375 | } |
| 376 | if let Some(sw) = data.sample_weight { |
| 377 | if sw.len() != data.y.len() { |
| 378 | return Err("sample_weight length mismatch".to_string()); |
| 379 | } |
| 380 | if sw.iter().any(|w| *w < 0.0) { |
| 381 | return Err("sample_weight cannot contain negative values".to_string()); |
| 382 | } |
| 383 | } |
| 384 | Ok(()) |
| 385 | } |
| 386 | |
| 387 | fn evaluate_params<C, F>( |
| 388 | build_classifier: &F, |
no test coverage detected