Finding optimal threshold based on ROC CURVE.
Project description
Installation
pip install threshold-finder
Usage
Folowing display an usage example.
>>> from threshold_finder.finder import OptimalThresholdFinder, ThresholdFinder, YoudenThresholdFinder
>>> # Example data
>>> true_label = pd.Series([1,1,1,0,0,0])
>>> predicted_proba = pd.Series([0.9, 0.8, 0.7, 0.72, 0.6, 0.5])
>>> # Use a specific finder directly ...
>>> finder = YoudenThresholdFinder()
>>> optimal_threshold = finder.optimal_threshold(true_label, predicted_proba)
>>> print(optimal_threshold)
0.7
>>> # ... Or use the factory
>>> factory = ThresholdFinder()
>>> finder = factory.get_finder(method="youden_statistic")
>>> optimal_threshold = finder.optimal_threshold(true_label, predicted_proba)
>>> print(optimal_threshold)
0.7
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
threshold-finder-0.1.2.tar.gz
(1.9 kB
view hashes)
Built Distribution
Close
Hashes for threshold_finder-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e22c4e51dc98bb8e6be0088b3fe1dd1d10395a49c682cf9a6d5bd7175009d862 |
|
MD5 | 59ddfdcf00de94fade1e98d15aa65fc1 |
|
BLAKE2b-256 | d739c98a88585fdfaa3580c3e409fc16e96c25585aabd598e21ed66d89dbad3e |