o
    tBh                     @   s"   d dl mZ dd ZdddZdS )   )is_classifierc                 C   s   |dvrt dd}|dkr$t| |d}|du r"t ||| jj|S t| dd}t| dd}|p3|}|du rBt |d| jj|S )	a)  Return prediction method from the response_method

    Parameters
    ----------
    estimator: object
        Classifier to check

    response_method: {'auto', 'predict_proba', 'decision_function'}
        Specifies whether to use :term:`predict_proba` or
        :term:`decision_function` as the target response. If set to 'auto',
        :term:`predict_proba` is tried first and if it does not exist
        :term:`decision_function` is tried next.

    Returns
    -------
    prediction_method: callable
        prediction method of estimator
    )predict_probadecision_functionautozFresponse_method must be 'predict_proba', 'decision_function' or 'auto'z'response method {} is not defined in {}r   Nr   r   z"decision_function or predict_proba)
ValueErrorgetattrformat	__class____name__)	estimatorresponse_method	error_msgprediction_methodr   r    r   q/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/sklearn/metrics/_plot/base.py!_check_classifier_response_method   s,   r   Nc           
   
   C   s   d|j j }t|st|t||}|| }|durAz
|j |}W n! ty@ } ztd| dt|j |d}~ww d}|j| }|j	dkrl|j
d }	|	dkr`t| d|	 d|dd|f }||fS ||jd	 krw|d
9 }||fS )ai  Return response and positive label.

    Parameters
    ----------
    X : {array-like, sparse matrix} of shape (n_samples, n_features)
        Input values.

    estimator : estimator instance
        Fitted classifier or a fitted :class:`~sklearn.pipeline.Pipeline`
        in which the last estimator is a classifier.

    response_method: {'auto', 'predict_proba', 'decision_function'}
        Specifies whether to use :term:`predict_proba` or
        :term:`decision_function` as the target response. If set to 'auto',
        :term:`predict_proba` is tried first and if it does not exist
        :term:`decision_function` is tried next.

    pos_label : str or int, default=None
        The class considered as the positive class when computing
        the metrics. By default, `estimators.classes_[1]` is
        considered as the positive class.

    Returns
    -------
    y_pred: ndarray of shape (n_samples,)
        Target scores calculated from the provided response_method
        and pos_label.

    pos_label: str or int
        The class considered as the positive class when computing
        the metrics.
    z8Expected 'estimator' to be a binary classifier, but got Nz2The class provided by 'pos_label' is unknown. Got z instead of one of       z fit on multiclass (z classes) data    )r	   r
   r   r   r   classes_tolistindexsetndimshape)
Xr   r   	pos_labelclassification_errorr   y_pred	class_idxey_pred_shaper   r   r   _get_response2   sH   "



r#   )N)baser   r   r#   r   r   r   r   <module>   s    .