�
I�g�! � �` � d Z ddlZddlZddlmZ ddlmZ ddlmZ h d�Z dd�Z
d� Zd � Zd
� Z
dS )z+Utilities to discover scikit-learn objects.� N)�
import_module)�
itemgetter)�Path> �setup�tests�conftest� externals�experimental�estimator_checksc �& ���� ddl m�m}m}m}m} ddlm} d� �g }t t t � � j j � � } |t �� � 5 t j |gd�� � D ]�\ }} }| � d � � }
t! d
� |
D � � � � sd| v r�9t# | � � }t% j |t$ j � � }d� |D � � }|� |� � �� d
d
d
� � n# 1 swxY w Y t- |� � }�fd�|D � � }
�fd�|
D � � }
| ��t/ | t0 � � s| g} nt1 | � � } g }||||d�}|� � � D ]?\ }�|| v r6| � |� � |� �fd�|
D � � � � �@|}
| r t7 dt9 | � � � d �� � �t; t- |
� � t= d� � �� � S )a1 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 �V � t | d� � sdS t | j � � sdS dS )N�__abstractmethods__FT)�hasattr�lenr )�cs �g/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sklearn/utils/discovery.py�is_abstractz#all_estimators.<locals>.is_abstractS s7 � ���0�1�1� ��5��1�(�)�)� ��5��t� ��category�sklearn.��path�prefix�.c 3 �( K � | ]
}|t v V � �d S �N��_MODULE_TO_IGNORE��.0�parts r � <genexpr>z!all_estimators.<locals>.<genexpr>b �( � � � �G�G�$�D�-�-�G�G�G�G�G�Gr �._c �F � g | ]\ }}|� d � � �||f��S ��_)�
startswith)r* �name�est_clss r �
<listcomp>z"all_estimators.<locals>.<listcomp>h sB � � � � �$1�D�'�D�O�O�TW�DX�DX���w��� � r Nc �X �� g | ]&}t |d �� � r|d dk �$|��'S )r r r ��
issubclass)r* r r s �r r5 z"all_estimators.<locals>.<listcomp>p sJ �� � � � �
��q��t�]�+�+�� 12�!���0G�0G�
�0G�0G�0Gr c �6 �� g | ]} �|d � � �|��S �r � )r* r r s �r r5 z"all_estimators.<locals>.<listcomp>v s, �� �A�A�A��{�{�1�Q�4�/@�/@�A�!�A�A�Ar )�
classifier� regressor�transformer�clusterc �@ �� g | ]}t |d �� � �|��S r: r7 )r* �est�mixins �r r5 z"all_estimators.<locals>.<listcomp>� s, �� �L�L�L�S�*�S��V�U�2K�2K�L�S�L�L�Lr z_Parameter type_filter must be 'classifier', 'regressor', 'transformer', 'cluster' or None, got r ��key)�baser r r r r �_testingr �strr �__file__�parent�
FutureWarning�pkgutil�
walk_packages�split�anyr �inspect�
getmembers�isclass�extend�set�
isinstance�list�items�remove�
ValueError�repr�sortedr )�type_filterr r r r r �all_classes�rootr1 �module_name�module_parts�module�classes�
estimators�filtered_estimators�filtersr3 r r rB s @@@r �all_estimatorsre s, ���� �h� � � � � � � � � � � � � � *�)�)�)�)�)�� � � �K��t�H�~�~�$�+�,�,�D�
��-� 0� 0� 0� (� (�!(�!6�T�F�:�!V�!V�!V�
(�
(��A�{�A�&�,�,�S�1�1�L��G�G�,�G�G�G�G�G�
��;�&�&��"�;�/�/�F��(����A�A�G�� �5<�� � �G�
���w�'�'�'�'�
(�(� (� (� (� (� (� (� (� (� (� (���� (� (� (� (� �k�"�"�K�� � � ��� � �J� B�A�A�A�Z�A�A�A�J����+�t�,�,� ,�&�-�K�K��{�+�+�K� ��)�'�+�#�
�
�� #�=�=�?�?� � �K�D�%��{�"�"��"�"�4�(�(�(�#�*�*�L�L�L�L�J�L�L�L�� � �� )�
�� ��)� ��%�%�)� )� )�� �
� �#�j�/�/�z�!�}�}�5�5�5�5s �B!D�D�Dc �R � ddl m} g }t t t � � j j � � } | t �� � 5 t j |gd�� � D ]�\ }}}|� d� � }t d� |D � � � � sd|v r�9t |� � }t j
|t j � � }d � |D � � }|� |� � �� d
d
d
� � n# 1 swxY w Y t! t# |� � t% d� � �� � S )
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 �( K � | ]
}|t v V � �d S r&