
    -i!                     `    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  1 Skr	SS jr
S rS	 rS
 rg)z+Utilities to discover scikit-learn objects.    N)import_module)
itemgetter)Path>   setuptestsconftest	externalsexperimentalestimator_checksc           
         SSK JnJnJnJnJn  SSKJn  S n/ n[        [        [        5      R                  R                  5      n	U" [        S9   [        R                  " U	/SS9 H  u  pn
UR                  S	5      n[!        S
 U 5       5      (       d  SU;   a  M6  [#        U5      n[$        R&                  " U[$        R(                  5      nU VVs/ s H"  u  nnUR+                  S5      (       a  M  UU4PM$     nnnUR-                  U5        M     SSS5        [/        U5      nU Vs/ s H&  n[1        US   U5      (       d  M  US   S:w  d  M$  UPM(     nnU Vs/ s H  nU" US   5      (       a  M  UPM     nnU b  [3        U [4        5      (       d  U /n O[5        U 5      n / nUUUUS.nUR7                  5        HV  u  nnX;   d  M  U R9                  U5        UR-                  U Vs/ s H  n[1        US   U5      (       d  M  UPM     sn5        MX     UnU (       a  [;        SU < S	35      e[=        [/        U5      [?        S5      S9$ s  snnf ! , (       d  f       GNF= fs  snf s  snf s  snf )a  Get a list of all estimators from `sklearn`.

This function crawls the module and gets all classes that inherit
from BaseEstimator. Classes that are defined in test-modules are not
included.

Parameters
----------
type_filter : {"classifier", "regressor", "cluster", "transformer"}             or list of such str, default=None
    Which kind of estimators should be returned. If None, no filter is
    applied and all estimators are returned.  Possible values are
    'classifier', 'regressor', 'cluster' and 'transformer' to get
    estimators only of these specific types, or a list of these to
    get the estimators that fit at least one of the types.

Returns
-------
estimators : list of tuples
    List of (name, class), where ``name`` is the class name as string
    and ``class`` is the actual type of the class.

Examples
--------
>>> from sklearn.utils.discovery import all_estimators
>>> estimators = all_estimators()
>>> type(estimators)
<class 'list'>
>>> type(estimators[0])
<class 'tuple'>
>>> estimators[:2]
[('ARDRegression', <class 'sklearn.linear_model._bayes.ARDRegression'>),
 ('AdaBoostClassifier',
  <class 'sklearn.ensemble._weight_boosting.AdaBoostClassifier'>)]
>>> classifiers = all_estimators(type_filter="classifier")
>>> classifiers[:2]
[('AdaBoostClassifier',
  <class 'sklearn.ensemble._weight_boosting.AdaBoostClassifier'>),
 ('BaggingClassifier', <class 'sklearn.ensemble._bagging.BaggingClassifier'>)]
>>> regressors = all_estimators(type_filter="regressor")
>>> regressors[:2]
[('ARDRegression', <class 'sklearn.linear_model._bayes.ARDRegression'>),
 ('AdaBoostRegressor',
  <class 'sklearn.ensemble._weight_boosting.AdaBoostRegressor'>)]
>>> both = all_estimators(type_filter=["classifier", "regressor"])
>>> both[:2]
[('ARDRegression', <class 'sklearn.linear_model._bayes.ARDRegression'>),
 ('AdaBoostClassifier',
  <class 'sklearn.ensemble._weight_boosting.AdaBoostClassifier'>)]
   )BaseEstimatorClassifierMixinClusterMixinRegressorMixinTransformerMixin   ignore_warningsc                 ^    [        U S5      (       d  g[        U R                  5      (       d  gg)N__abstractmethods__FT)hasattrlenr   )cs    J/var/www/html/venv/lib/python3.13/site-packages/sklearn/utils/discovery.pyis_abstract#all_estimators.<locals>.is_abstractS   s*    0111(())    categorysklearn.pathprefix.c              3   2   #    U  H  o[         ;   v   M     g 7fN_MODULE_TO_IGNORE.0parts     r   	<genexpr>!all_estimators.<locals>.<genexpr>b        G,$--,   .__Nr   r   )
classifier	regressortransformerclusterz_Parameter type_filter must be 'classifier', 'regressor', 'transformer', 'cluster' or None, got key) baser   r   r   r   r   _testingr   strr   __file__parentFutureWarningpkgutilwalk_packagessplitanyr   inspect
getmembersisclass
startswithextendset
issubclass
isinstancelistitemsremove
ValueErrorsortedr   )type_filterr   r   r   r   r   r   r   all_classesrootr2   module_namemodule_partsmoduleclassesnameest_clsr   
estimatorsfiltered_estimatorsfiltersmixinests                          r   all_estimatorsr^      sV   h  * KtH~$$++,D 
-	0!(!6!6TF:!VAA&,,S1LG,GGG;&";/F((AG5<5<MD'DOOTWDXwW   w' "W 
1  k"K Aqt]+ 	
01!0G 	
   (AZ{1Q4/@!ZJA+t,,&-K{+K )'+#	
 #==?KD%"""4(#**$.LJS*SVU2KSJL + )
  ?!%  #j/z!}55] 
1	0$ B$ MsO   BII
3I
;I*I$I$I$I)5I)*I.
I.
I
I!c            	         SSK Jn   / n[        [        [        5      R
                  R
                  5      nU " [        S9   [        R                  " U/SS9 H  u  p4nUR                  S5      n[        S U 5       5      (       d  SU;   a  M6  [        U5      n[        R                  " U[        R                  5      nU VV	s/ s H8  u  pUR                  S	5      (       a  M  UR!                  S
5      (       d  M5  X4PM:     nnn	UR#                  U5        M     SSS5        [%        ['        U5      [)        S5      S9$ s  sn	nf ! , (       d  f       N0= f)a  Get a list of all displays from `sklearn`.

Returns
-------
displays : list of tuples
    List of (name, class), where ``name`` is the display class name as
    string and ``class`` is the actual type of the class.

Examples
--------
>>> from sklearn.utils.discovery import all_displays
>>> displays = all_displays()
>>> displays[0]
('CalibrationDisplay', <class 'sklearn.calibration.CalibrationDisplay'>)
r   r   r   r!   r"   r%   c              3   2   #    U  H  o[         ;   v   M     g 7fr'   r(   r*   s     r   r-   all_displays.<locals>.<genexpr>   r/   r0   r1   r2   DisplayNr   r7   )r:   r   r;   r   r<   r=   r>   r?   r@   rA   rB   r   rC   rD   rE   rF   endswithrG   rO   rH   r   )
r   rQ   rR   r2   rS   rT   rU   rV   rW   display_classs
             r   all_displaysre      s   " *KtH~$$++,D 
-	0!(!6!6TF:!VAA&,,S1LG,GGG;&";/F((AG ,3+2'Ds+ &04i0H &%+2  
 w' "W 
1" #k"
166 
1	0s*   BED<
!D<
9D<
 E<E
Ec                     [         R                  " U 5      (       d  gU R                  R                  S5      (       a  gU R                  nUR                  S5      (       a  UR                  S5      (       a  gg)NFr2   r!   r   T)rC   
isfunction__name__rF   
__module__rc   )itemmods     r   _is_checked_functionrl      s[    d##}}$$
//C>>*%%6H)I)Ir   c            	      x   SSK Jn   / n[        [        [        5      R
                  R
                  5      nU " [        S9   [        R                  " U/SS9 H  u  p4nUR                  S5      n[        S U 5       5      (       d  SU;   a  M6  [        U5      n[        R                  " U[        5      nU VV	s/ s H+  u  pUR                  S	5      (       a  M  U	R                   U	4PM-     nnn	UR#                  U5        M     S
S
S
5        [%        ['        U5      [)        S5      S9$ s  sn	nf ! , (       d  f       N0= f)av  Get a list of all functions from `sklearn`.

Returns
-------
functions : list of tuples
    List of (name, function), where ``name`` is the function name as
    string and ``function`` is the actual function.

Examples
--------
>>> from sklearn.utils.discovery import all_functions
>>> functions = all_functions()
>>> name, function = functions[0]
>>> name
'accuracy_score'
r   r   r   r!   r"   r%   c              3   2   #    U  H  o[         ;   v   M     g 7fr'   r(   r*   s     r   r-    all_functions.<locals>.<genexpr>   r/   r0   r1   r2   Nr   r7   )r:   r   r;   r   r<   r=   r>   r?   r@   rA   rB   r   rC   rD   rl   rF   rh   rG   rO   rH   r   )
r   all_functionsrR   r2   rS   rT   rU   	functionsrW   funcs
             r   rp   rp      s   $ *MtH~$$++,D 
-	0!(!6!6TF:!VAA&,,S1LG,GGG;&";/F**63GHI #,"+JDs+ &%"+  
   + "W 
1* #m$*Q-88 
1	0s$   A8D+7D%
D%
)D+%D++
D9r'   )__doc__rC   r?   	importlibr   operatorr   pathlibr   r)   r^   re   rl   rp    r   r   <module>rx      s8    1
   #   @6F(7V-9r   