
    -ic                     L    S r SSKrSSKrSSKJr  SSKJr  SSK	J
r
  S/rSS jrg)	zUtilities for random sampling.    N   )check_random_state)sample_without_replacementr   c           	      |   [         R                   " S5      n[         R                   " S5      n[         R                   " SS/5      n[        [        U5      5       GH  n[        R                  " X   5      X'   X   R
                  R                  S:w  a  [        SX   R
                  -  5      eX   R                  [        R                  SS9X'   UcG  [        R                  " X   R                  S   S9nUR                  SX   R                  S   -  5        O[        R                  " X'   5      n[        R                  " [        R                  " U5      S5      (       d  [        S	R                  U5      5      eUR                  S   X   R                  S   :w  a8  [        S
R                  XqU   R                  S   UR                  S   5      5      eSX   ;  a4  [        R                   " X   SS5      X'   [        R                   " USS5      n[#        U5      n	X   R                  S   S:  a  [        R$                  " X   S:H  5      R'                  5       n
SX   -
  n[)        X-  5      n[+        XUS9nUR-                  U5        X   S:g  nX   nU[        R                  " U5      -  n[        R.                  " UR1                  5       U	R3                  US95      nUR-                  X   U   U   5        UR5                  [        U5      5        GM     [6        R8                  " XEU4U [        U5      4[(        S9$ )a  Generate a sparse random matrix given column class distributions

Parameters
----------
n_samples : int,
    Number of samples to draw in each column.

classes : list of size n_outputs of arrays of size (n_classes,)
    List of classes for each column.

class_probability : list of size n_outputs of arrays of         shape (n_classes,), default=None
    Class distribution of each column. If None, uniform distribution is
    assumed.

random_state : int, RandomState instance or None, default=None
    Controls the randomness of the sampled classes.
    See :term:`Glossary <random_state>`.

Returns
-------
random_matrix : sparse csc matrix of size (n_samples, n_outputs)

ir   zclass dtype %s is not supportedF)copy)shaper   g      ?z2Probability array at index {0} does not sum to onezXclasses[{0}] (length {1}) and class_probability[{0}] (length {2}) have different length.g        )n_population	n_samplesrandom_state)size)dtype)arrayrangelennpasarrayr   kind
ValueErrorastypeint64emptyr	   fillisclosesumformatinsertr   flatnonzeroitemintr   extendsearchsortedcumsumuniformappendsp
csc_matrix)r   classesclass_probabilityr   dataindicesindptrjclass_prob_jrngindex_class_0	p_nonzeronnz
ind_sampleclasses_j_nonzeroclass_probability_nzclass_probability_nz_normclasses_inds                     G/var/www/html/venv/lib/python3.13/site-packages/sklearn/utils/random.py_random_choice_cscr9      s   2 ;;sDkk#G[[qc"F3w< ZZ
+
:  C'>AQAQQRRZ&&rxxe&<
 $88'**:*:1*=>La'*"2"21"556::&7&:;Lzz"&&.44DKKAN  a GJ$4$4Q$77$$*Fqz''*L,>,>q,A%  GJ7:q!4GJ99\1c:L !.:A"NN7:?;@@BML77Ii+,C3&LJ NN:& !(
a#/#B (<rvv$@ )% //)002CKKSK4IK KK
#45kBCc'l#k !n ==$09c'l2KSVWW    )NN)__doc__r   numpyr   scipy.sparsesparser&    r   _randomr   __all__r9    r:   r8   <module>rC      s(    $
      /'
(TXr:   