Optimal Classification Cutoffs Optimize classification thresholds to improve model performance. The library provides efficient algorithms for threshold selection in binary and multiclass classification. Why Default 0.5 Thresholds Are Wrong: Most classifiers output probabilities, but decisions need thresholds. The default ฯ = 0.5 assumes equal costs and balanced classes. Real problems have imbalanced data (fraud: 1%, disease: 5%) and asymmetric costs (missing fraud costs $1000, false alarm costs $1). API 2.0.0 Features: ๐ฏ Clean API - 2 core functions, progressive disclosure design โก Auto-selection - intelligent algorithm + task detection with explanations ๐ O(n log n) optimization - exact solutions for piecewise metrics ๐ฐ Cost-matrix decisions - Bayes-optimal without thresholds ๐ง Namespaced power tools - metrics/, cv/, bayes/, algorithms/ ๐ Match/case routing - Modern Python 3.10+ performance API v2.0 - Redesigned architecture with modern patterns Why Optimize Classification Thresholds? Most classifiers use a default threshold of 0.5, but this is often suboptimal for: ๐ฅ Medical DiagnosisFalse negatives (missed diseases) cost far more than false positives ๐ฆ Fraud DetectionMissing fraud has higher cost than investigating legitimate transactions ๐ง Spam DetectionBlocking legitimate emails is worse than letting some spam through ๐ Imbalanced DatasetsDefault thresholds perform poorly when classes have very different frequencies The Problem with Standard Optimization Classification metrics like F1 score are piecewise-constant functions that create challenges for traditional optimization methods: Standard optimizers fail because these functions have: Zero gradients everywhere except at breakpoints Flat regions providing no directional information Step discontinuities that trap optimizers Our solution uses specialized algorithms designed for piecewise-constant optimization. Quick Example from optimal_cutoffs import optimize_thresholds import numpy as np from sklearn.ensemble ...
First seen: 2025-12-30 18:04
Last seen: 2025-12-30 18:04