
    -i                         S r SSKrSSKJr  SSKrSSKJr  SSKJ	r	J
r
  SSKJrJr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJrJrJrJr  SSKJrJrJrJr  SS jr  " S S\\	\5      r! " S S\\	\5      r"g)zNearest Neighbor Classification    N)Integral)_check_precomputed   )ClassifierMixin_fit_context)ArgKminClassModeRadiusNeighborsClassMode)
StrOptions)_all_with_any_reduction_axis_1)weighted_mode)_mode)_is_arraylike_num_samplescheck_is_fittedvalidate_data   )KNeighborsMixinNeighborsBaseRadiusNeighborsMixin_get_weightsc                 B    U=(       d    0 nU S:X  a  X!S'   US:X  a  Sn X4$ )N	minkowskipr   	euclidean metricmetric_kwargsr   s      T/var/www/html/venv/lib/python3.13/site-packages/sklearn/neighbors/_classification.py_adjusted_metricr       s1    !'RMc6 F      c            	         ^  \ rS rSr% Sr0 \R                  Er\\S'   \R                  S5        \R                  S\" SS15      \S/05         SSS	S
SSSSS.U 4S jjjr\" SS9S 5       rS rS rSU 4S jjrU 4S jrSrU =r$ )KNeighborsClassifier(   aA  Classifier implementing the k-nearest neighbors vote.

Read more in the :ref:`User Guide <classification>`.

Parameters
----------
n_neighbors : int, default=5
    Number of neighbors to use by default for :meth:`kneighbors` queries.

weights : {'uniform', 'distance'}, callable or None, default='uniform'
    Weight function used in prediction.  Possible values:

    - 'uniform' : uniform weights.  All points in each neighborhood
      are weighted equally.
    - 'distance' : weight points by the inverse of their distance.
      in this case, closer neighbors of a query point will have a
      greater influence than neighbors which are further away.
    - [callable] : a user-defined function which accepts an
      array of distances, and returns an array of the same shape
      containing the weights.

    Refer to the example entitled
    :ref:`sphx_glr_auto_examples_neighbors_plot_classification.py`
    showing the impact of the `weights` parameter on the decision
    boundary.

algorithm : {'auto', 'ball_tree', 'kd_tree', 'brute'}, default='auto'
    Algorithm used to compute the nearest neighbors:

    - 'ball_tree' will use :class:`BallTree`
    - 'kd_tree' will use :class:`KDTree`
    - 'brute' will use a brute-force search.
    - 'auto' will attempt to decide the most appropriate algorithm
      based on the values passed to :meth:`fit` method.

    Note: fitting on sparse input will override the setting of
    this parameter, using brute force.

leaf_size : int, default=30
    Leaf size passed to BallTree or KDTree.  This can affect the
    speed of the construction and query, as well as the memory
    required to store the tree.  The optimal value depends on the
    nature of the problem.

p : float, default=2
    Power parameter for the Minkowski metric. When p = 1, this is equivalent
    to using manhattan_distance (l1), and euclidean_distance (l2) for p = 2.
    For arbitrary p, minkowski_distance (l_p) is used. This parameter is expected
    to be positive.

metric : str or callable, default='minkowski'
    Metric to use for distance computation. Default is "minkowski", which
    results in the standard Euclidean distance when p = 2. See the
    documentation of `scipy.spatial.distance
    <https://docs.scipy.org/doc/scipy/reference/spatial.distance.html>`_ and
    the metrics listed in
    :class:`~sklearn.metrics.pairwise.distance_metrics` for valid metric
    values.

    If metric is "precomputed", X is assumed to be a distance matrix and
    must be square during fit. X may be a :term:`sparse graph`, in which
    case only "nonzero" elements may be considered neighbors.

    If metric is a callable function, it takes two arrays representing 1D
    vectors as inputs and must return one value indicating the distance
    between those vectors. This works for Scipy's metrics, but is less
    efficient than passing the metric name as a string.

metric_params : dict, default=None
    Additional keyword arguments for the metric function.

n_jobs : int, default=None
    The number of parallel jobs to run for neighbors search.
    ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
    ``-1`` means using all processors. See :term:`Glossary <n_jobs>`
    for more details.
    Doesn't affect :meth:`fit` method.

Attributes
----------
classes_ : array of shape (n_classes,)
    Class labels known to the classifier

effective_metric_ : str or callble
    The distance metric used. It will be same as the `metric` parameter
    or a synonym of it, e.g. 'euclidean' if the `metric` parameter set to
    'minkowski' and `p` parameter set to 2.

effective_metric_params_ : dict
    Additional keyword arguments for the metric function. For most metrics
    will be same with `metric_params` parameter, but may also contain the
    `p` parameter value if the `effective_metric_` attribute is set to
    'minkowski'.

n_features_in_ : int
    Number of features seen during :term:`fit`.

    .. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
    Names of features seen during :term:`fit`. Defined only when `X`
    has feature names that are all strings.

    .. versionadded:: 1.0

n_samples_fit_ : int
    Number of samples in the fitted data.

outputs_2d_ : bool
    False when `y`'s shape is (n_samples, ) or (n_samples, 1) during fit
    otherwise True.

See Also
--------
RadiusNeighborsClassifier: Classifier based on neighbors within a fixed radius.
KNeighborsRegressor: Regression based on k-nearest neighbors.
RadiusNeighborsRegressor: Regression based on neighbors within a fixed radius.
NearestNeighbors: Unsupervised learner for implementing neighbor searches.

Notes
-----
See :ref:`Nearest Neighbors <neighbors>` in the online documentation
for a discussion of the choice of ``algorithm`` and ``leaf_size``.

.. warning::

   Regarding the Nearest Neighbors algorithms, if it is found that two
   neighbors, neighbor `k+1` and `k`, have identical distances
   but different labels, the results will depend on the ordering of the
   training data.

https://en.wikipedia.org/wiki/K-nearest_neighbor_algorithm

Examples
--------
>>> X = [[0], [1], [2], [3]]
>>> y = [0, 0, 1, 1]
>>> from sklearn.neighbors import KNeighborsClassifier
>>> neigh = KNeighborsClassifier(n_neighbors=3)
>>> neigh.fit(X, y)
KNeighborsClassifier(...)
>>> print(neigh.predict([[1.1]]))
[0]
>>> print(neigh.predict_proba([[0.9]]))
[[0.666 0.333]]
_parameter_constraintsradiusweightsuniformdistanceNauto   r   r   )r'   	algorithm	leaf_sizer   r   metric_paramsn_jobsc          
      8   > [         T	U ]  UUUUUUUS9  X l        g )N)n_neighborsr,   r-   r   r   r.   r/   )super__init__r'   )
selfr1   r'   r,   r-   r   r   r.   r/   	__class__s
            r   r3   KNeighborsClassifier.__init__   s3     	#' 	 	
 r!   Fprefer_skip_nested_validationc                 $    U R                  X5      $ )a  Fit the k-nearest neighbors classifier from the training dataset.

Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features) or                 (n_samples, n_samples) if metric='precomputed'
    Training data.

y : {array-like, sparse matrix} of shape (n_samples,) or                 (n_samples, n_outputs)
    Target values.

Returns
-------
self : KNeighborsClassifier
    The fitted k-nearest neighbors classifier.
)_fit)r4   Xys      r   fitKNeighborsClassifier.fit   s    , yyr!   c                 *   [        U S5        U R                  S:X  a  U R                  S:X  a  [        R                  " XR
                  U R                  5      (       a  U R                  U5      nU R                  (       aV  [        R                  " [        U5       VVs/ s H*  u  p4U R                  U   [        R                  " USS9   PM,     snnSS9$ U R                  [        R                  " USS9   $ U R                  USS9nSnOU R                  U5      u  peU R                  nU R                  nU R                  (       d(  U R                  R!                  S	5      nU R                  /n[#        U5      n	[%        Uc  U R
                  OU5      n
['        X`R                  5      nUb  [)        US
S9(       a  [+        S5      e[        R,                  " X4US
   R.                  S9n[        U5       Hu  u  pUc  [1        XU4   SS9u  nnO[3        XU4   USS9u  nn[        R4                  " UR7                  5       [        R8                  S9nUR;                  U5      USS2U4'   Mw     U R                  (       d  UR7                  5       nU$ s  snnf )  Predict the class labels for the provided data.

Parameters
----------
X : {array-like, sparse matrix} of shape (n_queries, n_features),                 or (n_queries, n_indexed) if metric == 'precomputed', or None
    Test samples. If `None`, predictions for all indexed points are
    returned; in this case, points are not considered their own
    neighbors.

Returns
-------
y : ndarray of shape (n_queries,) or (n_queries, n_outputs)
    Class labels for each data sample.
_fit_methodr(   bruter   axisFreturn_distanceNr   r   valueAll neighbors of some sample is getting zero weights. Please modify 'weights' to avoid this case if you are using a user-defined function.dtype)r   r'   rA   r   is_usable_for_fit_Xr   predict_probaoutputs_2d_npstack	enumerateclasses_argmax
kneighbors_yreshapelenr   r   r   
ValueErroremptyrM   r   r   asarrayravelintptake)r4   r;   probabilitiesidxprobas	neigh_ind
neigh_distrU   rX   	n_outputs	n_queriesr'   y_predk	classes_kmode_s                    r   predictKNeighborsClassifier.predict   s8     	m,<<9$7*/?/M/M;;0 0 !% 2 21 5##88 09/G/G !MM#.ryya/HI/G   }}RYY}1%EFF 5AIJ$(OOA$6!J==WW)BHM	 	qA	z<<8#A'QR#S1  908I8IJ%h/LAa< 0q9a'a<(8'Ja::djjl"'':D$>>$/F1a4L 0 \\^FWs   1J
c                    [        U S5        U R                  S:X  a  [        U R                  U R                  U R
                  S9u  p#U R                  S:X  a  [        R                  " XR                  U5      (       a  U R                  (       dx  U R                  S:X  a  [        U5      nO[        XSSSS	9n[        R                  " UU R                  U R                  U R                  U R                  U R                   UUS
S9	nU$ U R#                  USS9nSnOU R#                  U5      u  peU R                   nU R                  nU R                  (       d(  U R                  R%                  S5      nU R                   /n['        Uc  U R                  OU5      n	[)        X`R                  5      n
U
c  [*        R,                  " U5      n
O[/        U
SS9(       a  [1        S5      e[*        R2                  " U	5      n/ n[5        U5       H  u  pUSS2U4   U   n[*        R6                  " XR8                  45      n[5        UR:                  5       H  u  nnXU4==   U
SS2U4   -  ss'   M     UR=                  SS9SS2[*        R>                  4   nUU-  nURA                  U5        M     U R                  (       d  US   nU$ )aT  Return probability estimates for the test data X.

Parameters
----------
X : {array-like, sparse matrix} of shape (n_queries, n_features),                 or (n_queries, n_indexed) if metric == 'precomputed', or None
    Test samples. If `None`, predictions for all indexed points are
    returned; in this case, points are not considered their own
    neighbors.

Returns
-------
p : ndarray of shape (n_queries, n_classes), or a list of n_outputs                 of such arrays if n_outputs > 1.
    The class probabilities of the input samples. Classes are ordered
    by lexicographic order.
rA   r(   r   rB   precomputedcsrFC)accept_sparseresetorderparallel_on_X)ri   r'   Y_labelsunique_Y_labelsr   r   strategyrE   NrG   r   rI   rK   r   rC   )!r   r'   r    r   r.   r   rA   r   rN   rO   rQ   r   r   computer1   rX   rU   rW   rY   r   r   rR   	ones_liker   r[   arangerT   zerossizeTsumnewaxisappend)r4   r;   r   r   ra   rd   re   rU   rX   rg   r'   all_rowsri   rj   pred_labelsproba_kirb   
normalizers                      r   rP   "KNeighborsClassifier.predict_proba6  si   $ 	m,<<9$ %5{{$2D2D%!F   G+$221kk6JJ((;;-/*1-A%uEA !1 8 8KK&& LL!WW$(MM!"/ -#!& %$ 5AIJ$(OOA$6!J==WW)BH 	qA	z<<8?ll9-G+G1=1  99Y'%h/LAQT(9-Khh	>>:;G $KMM23#&'!Q$-7& 3 !!,Q

];Jz!G  ) 0 )!,Mr!   c                 $   > [         TU ]  XU5      $ a  
Return the mean accuracy on the given test data and labels.

In multi-label classification, this is the subset accuracy
which is a harsh metric since you require for each sample that
each label set be correctly predicted.

Parameters
----------
X : array-like of shape (n_samples, n_features), or None
    Test samples. If `None`, predictions for all indexed points are
    used; in this case, points are not considered their own
    neighbors. This means that `knn.fit(X, y).score(None, y)`
    implicitly performs a leave-one-out cross-validation procedure
    and is equivalent to `cross_val_score(knn, X, y, cv=LeaveOneOut())`
    but typically much faster.

y : array-like of shape (n_samples,) or (n_samples, n_outputs)
    True labels for `X`.

sample_weight : array-like of shape (n_samples,), default=None
    Sample weights.

Returns
-------
score : float
    Mean accuracy of ``self.predict(X)`` w.r.t. `y`.
r2   scorer4   r;   r<   sample_weightr5   s       r   r   KNeighborsClassifier.score      : w}Q=11r!   c                    > [         TU ]  5       nSUR                  l        U R                  S:H  UR
                  l        U$ )NTrp   )r2   __sklearn_tags__classifier_tagsmulti_labelr   
input_tagspairwiser4   tagsr5   s     r   r   %KNeighborsClassifier.__sklearn_tags__  s8    w')+/(#';;-#? r!   )r'   )   N)__name__
__module____qualname____firstlineno____doc__r   r%   dict__annotations__popupdater
   callabler3   r   r=   rm   rP   r   r   __static_attributes____classcell__r5   s   @r   r#   r#   (   s    Qf $Lm&J&J#KDKx(!!	ZJ 78(DIJ  
 . &+	(CJgV2> r!   r#   c            
          ^  \ rS rSr% Sr0 \R                  E\" SS15      \S/\	\
SS/S.Er\\S'   \R                  S	5         SSS
SSSSSSS.U 4S jjjr\" SS9S 5       rS rS rSU 4S jjrU 4S jrSrU =r$ )RadiusNeighborsClassifieri  a  Classifier implementing a vote among neighbors within a given radius.

Read more in the :ref:`User Guide <classification>`.

Parameters
----------
radius : float, default=1.0
    Range of parameter space to use by default for :meth:`radius_neighbors`
    queries.

weights : {'uniform', 'distance'}, callable or None, default='uniform'
    Weight function used in prediction.  Possible values:

    - 'uniform' : uniform weights.  All points in each neighborhood
      are weighted equally.
    - 'distance' : weight points by the inverse of their distance.
      in this case, closer neighbors of a query point will have a
      greater influence than neighbors which are further away.
    - [callable] : a user-defined function which accepts an
      array of distances, and returns an array of the same shape
      containing the weights.

    Uniform weights are used by default.

algorithm : {'auto', 'ball_tree', 'kd_tree', 'brute'}, default='auto'
    Algorithm used to compute the nearest neighbors:

    - 'ball_tree' will use :class:`BallTree`
    - 'kd_tree' will use :class:`KDTree`
    - 'brute' will use a brute-force search.
    - 'auto' will attempt to decide the most appropriate algorithm
      based on the values passed to :meth:`fit` method.

    Note: fitting on sparse input will override the setting of
    this parameter, using brute force.

leaf_size : int, default=30
    Leaf size passed to BallTree or KDTree.  This can affect the
    speed of the construction and query, as well as the memory
    required to store the tree.  The optimal value depends on the
    nature of the problem.

p : float, default=2
    Power parameter for the Minkowski metric. When p = 1, this is
    equivalent to using manhattan_distance (l1), and euclidean_distance
    (l2) for p = 2. For arbitrary p, minkowski_distance (l_p) is used.
    This parameter is expected to be positive.

metric : str or callable, default='minkowski'
    Metric to use for distance computation. Default is "minkowski", which
    results in the standard Euclidean distance when p = 2. See the
    documentation of `scipy.spatial.distance
    <https://docs.scipy.org/doc/scipy/reference/spatial.distance.html>`_ and
    the metrics listed in
    :class:`~sklearn.metrics.pairwise.distance_metrics` for valid metric
    values.

    If metric is "precomputed", X is assumed to be a distance matrix and
    must be square during fit. X may be a :term:`sparse graph`, in which
    case only "nonzero" elements may be considered neighbors.

    If metric is a callable function, it takes two arrays representing 1D
    vectors as inputs and must return one value indicating the distance
    between those vectors. This works for Scipy's metrics, but is less
    efficient than passing the metric name as a string.

outlier_label : {manual label, 'most_frequent'}, default=None
    Label for outlier samples (samples with no neighbors in given radius).

    - manual label: str or int label (should be the same type as y)
      or list of manual labels if multi-output is used.
    - 'most_frequent' : assign the most frequent label of y to outliers.
    - None : when any outlier is detected, ValueError will be raised.

    The outlier label should be selected from among the unique 'Y' labels.
    If it is specified with a different value a warning will be raised and
    all class probabilities of outliers will be assigned to be 0.

metric_params : dict, default=None
    Additional keyword arguments for the metric function.

n_jobs : int, default=None
    The number of parallel jobs to run for neighbors search.
    ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
    ``-1`` means using all processors. See :term:`Glossary <n_jobs>`
    for more details.

Attributes
----------
classes_ : ndarray of shape (n_classes,)
    Class labels known to the classifier.

effective_metric_ : str or callable
    The distance metric used. It will be same as the `metric` parameter
    or a synonym of it, e.g. 'euclidean' if the `metric` parameter set to
    'minkowski' and `p` parameter set to 2.

effective_metric_params_ : dict
    Additional keyword arguments for the metric function. For most metrics
    will be same with `metric_params` parameter, but may also contain the
    `p` parameter value if the `effective_metric_` attribute is set to
    'minkowski'.

n_features_in_ : int
    Number of features seen during :term:`fit`.

    .. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
    Names of features seen during :term:`fit`. Defined only when `X`
    has feature names that are all strings.

    .. versionadded:: 1.0

n_samples_fit_ : int
    Number of samples in the fitted data.

outlier_label_ : int or array-like of shape (n_class,)
    Label which is given for outlier samples (samples with no neighbors
    on given radius).

outputs_2d_ : bool
    False when `y`'s shape is (n_samples, ) or (n_samples, 1) during fit
    otherwise True.

See Also
--------
KNeighborsClassifier : Classifier implementing the k-nearest neighbors
    vote.
RadiusNeighborsRegressor : Regression based on neighbors within a
    fixed radius.
KNeighborsRegressor : Regression based on k-nearest neighbors.
NearestNeighbors : Unsupervised learner for implementing neighbor
    searches.

Notes
-----
See :ref:`Nearest Neighbors <neighbors>` in the online documentation
for a discussion of the choice of ``algorithm`` and ``leaf_size``.

https://en.wikipedia.org/wiki/K-nearest_neighbor_algorithm

Examples
--------
>>> X = [[0], [1], [2], [3]]
>>> y = [0, 0, 1, 1]
>>> from sklearn.neighbors import RadiusNeighborsClassifier
>>> neigh = RadiusNeighborsClassifier(radius=1.0)
>>> neigh.fit(X, y)
RadiusNeighborsClassifier(...)
>>> print(neigh.predict([[1.5]]))
[0]
>>> print(neigh.predict_proba([[1.0]]))
[[0.66666667 0.33333333]]
r(   r)   Nz
array-like)r'   outlier_labelr%   r1   r*   r+   r   r   )r'   r,   r-   r   r   r   r.   r/   c          
      D   > [         T
U ]  UUUUUUU	S9  X l        Xpl        g )N)r&   r,   r-   r   r   r.   r/   )r2   r3   r'   r   )r4   r&   r'   r,   r-   r   r   r   r.   r/   r5   s             r   r3   "RadiusNeighborsClassifier.__init__k  s9     	' 	 	
 *r!   Fr7   c                 X   U R                  X5        U R                  nU R                  nU R                  (       d(  U R                  R	                  S5      nU R                  /nU R
                  c  SnGOU R
                  S:X  aV  / n[        U5       HC  u  pg[        R                  " USS2U4   5      nUR                  XxR                  5          5        ME     GOJ[        U R
                  5      (       a|  [        U R
                  [        5      (       d]  [        U R
                  5      [        U5      :w  a.  [        SR!                  U R
                  [        U5      5      5      eU R
                  nOU R
                  /[        U5      -  n[#        X55       H  u  p[        U
5      (       a/  [        U
[        5      (       d  [%        SR!                  X5      5      e[        R                  " X5      R&                  U	R&                  :w  d  Mt  [%        SR!                  X5      5      e   XPl        U $ )a  Fit the radius neighbors classifier from the training dataset.

Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features) or                 (n_samples, n_samples) if metric='precomputed'
    Training data.

y : {array-like, sparse matrix} of shape (n_samples,) or                 (n_samples, n_outputs)
    Target values.

Returns
-------
self : RadiusNeighborsClassifier
    The fitted radius neighbors classifier.
rG   Nmost_frequentzJThe length of outlier_label: {} is inconsistent with the output length: {}zCThe outlier_label of classes {} is supposed to be a scalar, got {}.zCThe dtype of outlier_label {} is inconsistent with classes {} in y.)r:   rU   rX   rQ   rY   r   rT   rR   bincountr   rV   r   
isinstancestrrZ   r[   formatzip	TypeErrorrM   outlier_label_)r4   r;   r<   rU   rX   r   ri   rj   label_countclasseslabels              r   r=   RadiusNeighborsClassifier.fit  s   , 			!==WW)BH%!N?2N !*( 3 kk"QT(3%%i0B0B0D&EF !4
 T//00""C: : t))*c(m;$%%+VD,>,>H%N 
 "&!3!3"&"4"4!5H!E"%h"? ''
5#0F0F#$fW4 
 99W,22gmmC##VE3  #@  -r!   c                 b   U R                  U5      nU R                  nU R                  (       d  U/nU R                  /n[        U5      nUS   R                  S   n[
        R                  " XT4US   R                  S9n[        U5       H  u  pxUR                  SS9n	X7   R                  U	5      USS2U4'   US:H  R                  SS9n
U
R                  5       (       d  MW  [
        R                  " U
5      nU R                  U   XkU4'   M     U R                  (       d  UR                  5       nU$ )r@   r   rL   r   rC   N)rP   rU   rQ   rZ   shaperR   r\   rM   rT   rV   r`   allanyflatnonzeror   r^   )r4   r;   probsrU   rf   rg   rh   ri   probmax_prob_indexoutlier_zero_probszero_prob_indexs               r   rm   !RadiusNeighborsClassifier.predict  s   " ""1%==GEHM	!HNN1%	908I8IJ 'GA "[[a[0N#;++N;F1a4L"&!)a!8!%%''"$..1C"D-1-@-@-C)* ( \\^Fr!   c                 `   [        U S5        [        Uc  U R                  OU5      n[        U R                  U R
                  U R                  S9u  p4U R                  S:X  a  U R                  S:X  a  U R                  (       d  [        R                  " XR                  U5      (       a[  [        R                  " UU R                  U R                  U R                  U R                  U R                  U R                   UUSS9
nU$ U R#                  U5      u  pg[$        R&                  " U[(        S9nU V	s/ s H  n	[+        U	5      S	:H  PM     sn	USS& [$        R,                  " U5      n
[$        R,                  " U) 5      nU R                  nU R                  nU R                  (       d(  U R                  R/                  S
5      nU R                  /nU R0                  c  U
R2                  S	:  a  [5        SU
-  5      e[7        X`R                  5      nUb  X   n/ n[9        U5       GH  u  nn[$        R&                  " [+        U5      [:        S9nU Vs/ s H
  nUUU4   PM     snUSS& [$        R&                  " UUR2                  45      n[$        R&                  " [+        U5      UR2                  45      nUc?  [9        UU   5       H,  u  nn[$        R<                  " UUR2                  S9UUSS24'   M.     OB[9        UU   5       H0  u  nn[$        R<                  " UUU   UR2                  S9UUSS24'   M2     UUUSS24'   U
R2                  S	:  au  U R0                  U   n[$        R,                  " UU:H  5      nUR2                  S:X  a  SUU
US	   4'   O2[>        R@                  " SRC                  U R0                  U   5      5        URE                  SS9SS2[$        RF                  4   nSUUS:H  '   UU-  nURI                  U5        GM     U R                  (       d  US	   nU$ s  sn	f s  snf )aT  Return probability estimates for the test data X.

Parameters
----------
X : {array-like, sparse matrix} of shape (n_queries, n_features),                 or (n_queries, n_indexed) if metric == 'precomputed', or None
    Test samples. If `None`, predictions for all indexed points are
    returned; in this case, points are not considered their own
    neighbors.

Returns
-------
p : ndarray of shape (n_queries, n_classes), or a list of                 n_outputs of such arrays if n_outputs > 1.
    The class probabilities of the input samples. Classes are ordered
    by lexicographic order.
rA   Nr   r(   rB   rv   )
r;   Yr&   r'   rw   rx   r   r   r   ry   rL   r   rG   zNo neighbors found for test samples %r, you can try using larger radius, giving a label for outliers, or considering removing them from your dataset.)	minlengthr         ?ziOutlier label {} is not in training classes. All class probabilities of outliers will be assigned with 0.rC   g        )%r   r   rO   r    r   r.   r   r'   rA   rQ   r	   rN   rz   r&   rX   rU   r   radius_neighborsrR   r}   boolrZ   r   rY   r   r~   r[   r   rT   objectr   warningswarnr   r   r   r   )r4   r;   rg   r   r   ra   re   rd   outlier_masknindoutliersinliersrU   rX   r'   ri   rj   r   indr   	proba_inlr   rb   _outlier_labellabel_indexr   s                             r   rP   'RadiusNeighborsClassifier.predict_proba  s   $ 	m, 	qA	 0;;d.@.@DFF!

 LLI%  G+$$(66q++vNN4<<++{{ $"00+(M$ !  $ 5 5a 8
xx	66?@id3t9>i@Q>>,/..,/==WW)BH&8==1+<B EMM  z<<8&G%h/LAy((3y>@K4=>ISbajI>KNhh	9>>:;G#g,	!?@I 'G(<=FAs&(kk#&PIadO > (G(<=FAs&(kkWQZ9>>'IadO > #,GGQJ}}q !%!4!4Q!7 nnY.-HI##q(8;GHk!n45MM "6$"5"5a"89	 !!,Q

];J,/JzS()z!G  )I 0L )!,MC A4 ?s   4P&P+c                 $   > [         TU ]  XU5      $ r   r   r   s       r   r   RadiusNeighborsClassifier.scoreu  r   r!   c                 F   > [         TU ]  5       nSUR                  l        U$ )NT)r2   r   r   r   r   s     r   r   *RadiusNeighborsClassifier.__sklearn_tags__  s#    w')+/(r!   )r   r   r'   )r   r   )r   r   r   r   r   r   r%   r
   r   r   r   r   r   r   r3   r   r=   rm   rP   r   r   r   r   r   s   @r   r   r     s    Zx$

.
.$	:674H"Ct<$D 
 }- + 
+ +2 &+E	EN*Xvt2> r!   r   r   )#r   r   numbersr   numpyrR   sklearn.neighbors._baser   baser   r   %metrics._pairwise_distances_reductionr   r	   utils._param_validationr
   utils.arrayfuncsr   utils.extmathr   utils.fixesr   utils.validationr   r   r   r   _baser   r   r   r   r    r#   r   r   r!   r   <module>r      sj    %
    6 0 1 = )   V U!\?O] \~P 4o} Pr!   