Skip to main content

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.3.tar.gz (1.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

threshold_finder-0.1.3-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

File details

Details for the file threshold-finder-0.1.3.tar.gz.

File metadata

  • Download URL: threshold-finder-0.1.3.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.10 Linux/5.13.0-1021-azure

File hashes

Hashes for threshold-finder-0.1.3.tar.gz
Algorithm Hash digest
SHA256 5f630f509a86a796149d1d3273d25fffb37d3f6c2fae674357a5d3fc3840c2fe
MD5 3c311bc73645b7a496d16a88da9d3b3d
BLAKE2b-256 33219612d11764b969b9faefa07f8ad0c6dc41c4eff4444e76f3ebb3900a5e20

See more details on using hashes here.

File details

Details for the file threshold_finder-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: threshold_finder-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 2.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.10 Linux/5.13.0-1021-azure

File hashes

Hashes for threshold_finder-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b02f06d6df9d1217a93b469e6d2699804cc51b3f03f4b28f4687d03e4bc527c5
MD5 1523d62b32a803bc7a84be1a5306c827
BLAKE2b-256 515b02a352567d02a9de960d89b188be0bef47b144fa8ed5f90461d5071ee305

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page