pub fn validate_threshold(threshold: f64) -> Result<()>
Utility function to validate threshold values