� I�g�!��`�dZddlZddlZddlmZddlmZddlmZhd�Z d d�Z d�Z d �Z d �Z dS) z+Utilities to discover scikit-learn objects.�N)� import_module)� itemgetter)�Path>�setup�tests�conftest� externals� experimental�estimator_checksc�&����ddlm�m}m}m}m}ddlm}d��g}ttt��j j ��}|t���5tj|gd���D]�\}} }| �d ��} t!d �| D����sd | vr�9t#| ��} t%j| t$j��} d �| D��} |�| ���� d d d ��n #1swxYwYt-|��}�fd�|D��} �fd�| D��} |��t/|t0��s|g}nt1|��}g}||||d�}|���D]?\}�||vr6|�|��|��fd�| D�����@|} |r t7dt9|���d ����t;t-| ��t=d�����S)a1Get 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��sdSt|j��sdSdS)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_abstractSs7����0�1�1� ��5��1�(�)�)� ��5��t���category�sklearn.��path�prefix�.c3�(K�|] }|tvV��dS�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>hsB�����$1�D�'�D�O�O�TW�DX�DX���w����rNc�X��g|]&}t|d���r|ddk�$|��'S)rrr�� issubclass)r*rrs �rr5z"all_estimators.<locals>.<listcomp>psJ������ � �q��t�]� +� +��12�!���0G�0G� �0G�0G�0Grc�6��g|]}�|d���|��S�r�)r*rrs �rr5z"all_estimators.<locals>.<listcomp>vs,���A�A�A��{�{�1�Q�4�/@�/@�A�!�A�A�Ar)� classifier� regressor� transformer�clusterc�@��g|]}t|d����|��Sr:r7)r*�est�mixins �rr5z"all_estimators.<locals>.<listcomp>�s,���L�L�L�S�*�S��V�U�2K�2K�L�S�L�L�Lrz_Parameter type_filter must be 'classifier', 'regressor', 'transformer', 'cluster' or None, got r��key)�baserrrrr�_testingr�strr�__file__�parent� FutureWarning�pkgutil� walk_packages�split�anyr�inspect� getmembers�isclass�extend�set� isinstance�list�items�remove� ValueError�repr�sortedr)� type_filterrrrrr� all_classes�rootr1� module_name� module_parts�module�classes� estimators�filtered_estimators�filtersr3rrrBs @@@r�all_estimatorsres,�����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 �D c�R�ddlm}g}ttt��jj��}|t ���5tj|gd���D]�\}}}|� d��}td�|D����sd|vr�9t|��}tj |tj��}d �|D��}|�|���� d d d ��n #1swxYwYt!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'>) rrrr r!r$c3�(K�|] }|tvV��dSr&r'r)s rr,zall_displays.<locals>.<genexpr>�r-rr.c�p�g|]3\}}|�d���|�d���/||f��4S)r1�Display)r2�endswith)r*r3� display_classs rr5z all_displays.<locals>.<listcomp>�sY�����'�D�-����s�+�+��15� � �i�0H�0H���}�%���rNrrC)rFrrGrrHrIrJrKrLrMrNrrOrPrQrRrZrSr)rr\r]r1r^r_r`ras r� all_displaysrl�s���"*�)�)�)�)�)��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���+2����G� � � �w� '� '� '� '� (�(�(�(�(�(�(�(�(�(�(�(����(�(�(�(�" �#�k�"�"� �1� � � 6� 6� 6�6s�B!C3�3C7�:C7c���tj|��sdS|j�d��rdS|j}|�d��r|�d��rdSdS)NFr1r r T)rO� isfunction�__name__r2� __module__rj)�item�mods r�_is_checked_functionrs�sp�� � �d� #� #���u� �}����$�$���u� �/�C� �>�>�*� %� %�����6H�)I�)I���u� �4rc�H�ddlm}g}ttt��jj��}|t ���5tj|gd���D]�\}}}|� d��}td�|D����sd|vr�9t|��}tj |t��}d �|D��}|�|���� d d d ��n #1swxYwYt!t#|��t%d ��� ��S) a�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' rrrr r!r$c3�(K�|] }|tvV��dSr&r'r)s rr,z all_functions.<locals>.<genexpr>�r-rr.c�P�g|]#\}}|�d���|j|f��$Sr0)r2ro)r*r3�funcs rr5z!all_functions.<locals>.<listcomp>�sE������D�$����s�+�+�����%���rNrrC)rFrrGrrHrIrJrKrLrMrNrrOrPrsrRrZrSr)r� all_functionsr]r1r^r_r`� functionss rrxrx�s���$*�)�)�)�)�)��M� �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��*�6�3G�H�H�I���"+����I� � � �� +� +� +� +� ,�,�,�,�,�,�,�,�,�,�,�,����,�,�,�,�* �#�m�$�$�*�Q�-�-� 8� 8� 8�8s�BC.�.C2�5C2r&)�__doc__rOrK� importlibr�operatorr�pathlibrr(rerlrsrxr;rr�<module>r~s���1�1� ��������#�#�#�#�#�#�����������������@6�@6�@6�@6�F(7�(7�(7�V � � �-9�-9�-9�-9�-9r
Memory