Metadata-Version: 2.1
Name: threshold-finder
Version: 0.1.2
Summary: Finding optimal threshold based on ROC CURVE.
Author: thibaultbl
Requires-Python: >=3.7.1,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Dist: pandas (>=1.3,<2.0)
Requires-Dist: scikit-learn (>=1.0.2,<2.0.0)
Description-Content-Type: text/x-rst

Installation
============

.. code-block:: bash

    pip install threshold-finder


Usage
=====

Folowing display an usage example.

.. code-block:: python

    >>> 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

