
    h$,f                     H    d dl mZ d dlZd dlmZ ddlmZ ddl	m
Z
 d Zd Zy)	    )suppressN)sparse   )is_scalar_nan)_object_dtype_isnanc                    t        t        t              5  dd l}||j                  u r|j                  |       cd d d        S 	 d d d        t        |      r|| j                  j                  dk(  rt        j                  |       }|S | j                  j                  dv r't        j                  | j                  t              }|S t        |       }|S | |k(  }|S # 1 sw Y   xY w)Nr   f)iu)dtype)r   ImportErrorAttributeErrorpandasNAisnar   r   kindnpisnanzerosshapeboolr   )Xvalue_to_maskr   Xts       3lib/python3.12/site-packages/sklearn/utils/_mask.py_get_dense_maskr   
   s    	+~	. " 	FII%;;q>" "
 &" ]#77<<3!B I WW\\Z'!''.B I	 %Q'B I -I)" "s   #CC"c                 j   t        j                  |       st        | |      S t        | j                  |      }| j                  dk(  rt         j
                  nt         j                  } ||| j                  j                         | j                  j                         f| j                  t              }|S )a  Compute the boolean mask X == value_to_mask.

    Parameters
    ----------
    X : {ndarray, sparse matrix} of shape (n_samples, n_features)
        Input data, where ``n_samples`` is the number of samples and
        ``n_features`` is the number of features.

    value_to_mask : {int, float}
        The value which is to be masked in X.

    Returns
    -------
    X_mask : {ndarray, sparse matrix} of shape (n_samples, n_features)
        Missing mask.
    csr)r   r   )spissparser   dataformat
csr_matrix
csc_matrixindicescopyindptrr   r   )r   r   r   sparse_constructor	Xt_sparses        r   	_get_maskr*   "   s    " ;;q> q-00		/B*+((e*;"	QYY^^qxx}}/qwwdI     )
contextlibr   numpyr   scipyr   r    r   fixesr   r   r*    r+   r   <module>r2      s        &0r+   