`L i j dZddlmZddlZddlZddlZddlZddlmZddl m Z ddl m Z m Z ddlmZddlmZmZdd lmZmZddlZddlZdd lmZdd lmZdd lmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(d dl)m*Z*d dl+m,Z,m-Z-m.Z.m/Z/m0Z0d dl1m2Z2m3Z3m4Z4m5Z5m6Z6d dl7m8Z8m9Z9m:Z:m;Z;d dlm?Z?m@Z@mAZAd dlBmCZCmDZDmEZEd dlFmGZGmHZHmIZId dlJmKZKd dlLmMZMd dlNmOZOmPZPd dlQmRZRd dlSmTZTmUZUmVZVmWZWd dlSmXZYd dlZm[Z[m\Z\m]Z]ddl)m^Z^ddl_m`Z`dd lambZbmcZcmdZddd!lemfZfmgZgmhZhmiZimjZjmkZkdd"llmmZmmnZnmoZodd#lpmqZqmrZrmsZsmtZtmuZumvZvmwZwmxZxmyZymzZzm{Z{m|Z|dd$l}m~Z~mZmZdad%Zd&Zd'Zd(Zd)Zd*Zd+Zd,Zd-Zdd.Zd/Z d dd0Z d dd1Zd2ddd3 dd4Zd2dd5 dd6Zedd7gd7gedgecd8hdgecd9d8hdgedgd:d;< dd2dd8d9dd= dd>Zd?ZGd@dAZdBZdCZezeDdEZ ddFZ ddGZdHZdIZdJZdKZdLZezeDdMZezeDdNZezeDdOZezeDdPZezeDdQZdRZdSZdTZezeefDdUZdVZezdWZdXZezeDdYZezeDdZZd[ZezeDd\ZezeDd]Zezd^Zezd_Zezd`ZezeDddaZezeDdbZezeDdcZezeDddZdeZezdfZezdgZezdhZezdiZdjZezeDdkZezeDdlZezdmZezddnZezeDdoZezeDdpZezeDdqZezeDddrZezeDdsZezeDdtZezeDduZez ddvZdwZddxZdyZezeDdzZezeDd{ZezeDd|ZezeDd}ZezeDd~ZezeDdZezeDdZezdZezeDdZezdZdZdZezeDdZezeDd;ejfdZezdZezeDdZezeDdZezeDdZezeDdZezeDdZezeDdZezeDdZezeDdZezeDdZdZdZdZdZdeCfdZezeDdZezeDdZezeDdZezeDdZezeDdZezeDdZezeDdZdZdZdZdZdZdZezeDdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ ezeDdZ dZ dZ y)zQVarious utilities to check the compatibility of estimators with scikit-learn API.) annotationsN) nullcontext)deepcopy)partialwraps) signature)IntegralReal)CallableLiteral)sparse)rankdata) BaseEstimatorBiclusterMixinClassifierMixinClassNamePrefixFeaturesOutMixin DensityMixinMetaEstimatorMixinMultiOutputMixinOneToOneFeatureMixin OutlierMixinRegressorMixinTransformerMixin)config_context) ClusterMixinclone is_classifieris_outlier_detector is_regressor) load_iris make_blobsmake_classificationmake_multilabel_classificationmake_regression)DataConversionWarningEstimatorCheckFailedWarningNotFittedErrorSkipTestWarning)LinearClassifierMixin)accuracy_scoreadjusted_rand_scoref1_score) linear_kernelpairwise_distances rbf_kernel)LeaveOneGroupOut ShuffleSplittrain_test_split) _safe_split) make_pipeline)StandardScalerscale)_safe_indexing)_atol_for_type_convert_to_numpy get_namespace)yield_namespace_device_dtype_combinationsdevice)InvalidParameterErrorgenerate_invalid_param_valmake_constraint)shuffle) is_scalar_nan)Interval StrOptionsvalidate_params)ClassifierTags InputTags RegressorTags TargetTagsTransformerTagsget_tags)CROSS_DECOMPOSITION_get_check_estimator_ids_yield_instances_for_check) SkipTest_array_api_for_tests _get_argsassert_allcloseassert_allclose_dense_sparseassert_array_almost_equalassert_array_equalassert_array_lesscreate_memmap_backed_dataignore_warningsraisesset_random_state) _num_samplescheck_is_fittedhas_fit_parameterc t|}|jjdd}t||Ct d|j jd|d|d|jd|jd y) NMixin Estimator z seems to be a z , but the `zB` tag is not set. Either set the tag manually or inherit from the z2. Note that the order of inheritance matters, the z" should come before BaseEstimator.)rM__name__replacegetattr RuntimeError __class__) estimatortag_nameratagsestimator_types d/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sklearn/utils/estimator_checks.py_raise_for_missing_tagsrnqs I D^^++GR8NtX&,,556onEUV! #$$)NN#34"^^,,N P  'c#Kt|ts3tjd|jj dt t|}ttttttttt t"|j$rt&t(t*t,t.yw)Nrcz does not inherit from `sklearn.base.BaseEstimator`. This might lead to unexpected behavior, or even errors when collecting tests.category) isinstancerwarningswarnrhrd UserWarningrMcheck_estimator_cloneablecheck_estimator_tags_renamedcheck_valid_tag_typescheck_estimator_reprcheck_no_attributes_set_in_initcheck_fit_score_takes_y!check_estimators_overwrite_paramscheck_dont_overwrite_parameters!check_estimators_fit_returns_selfcheck_readonly_memmap_input requires_fitcheck_estimators_unfitted/check_do_not_raise_errors_in_init_or_set_params!check_n_features_in_after_fittingcheck_mixin_order"check_positive_only_tag_during_fit)rirks rm_yield_api_checksr}s i / ,,55672 2!   I D ## &&   )) !! ++ )) ++ %% '' 99 ++  ,,sCCc#K|jj}t|}tt |drdt t t|jjs6ttt|jjrt|jst t"t$|t&vrt(|jj*s|jst,|jjrt.t1|drt2t4t6t8t:t=t:d|j>rtA|D]}|tByw)N sample_weightsparsifyTreadonly_memmap)"rhrdrMcheck_estimators_dtypesr_"check_sample_weights_pandas_series!check_sample_weights_not_an_arraycheck_sample_weights_list input_tagspairwisecheck_sample_weights_shape$check_sample_weights_not_overwritten-check_sample_weight_equivalence_on_dense_datar .check_sample_weight_equivalence_on_sparse_data no_validationcheck_complex_datacheck_dtype_object$check_estimators_empty_data_messagesrNcheck_pipeline_consistency allow_nancheck_estimators_nan_infcheck_nonsquare_errorhasattrcheck_sparsify_coefficientscheck_estimator_sparse_tagcheck_estimator_sparse_arraycheck_estimator_sparse_matrixcheck_estimators_picklerarray_api_support_yield_array_api_checks"check_f_contiguous_array_estimator)rinamerkchecks rm _yield_checksrs1    ' 'D I D !!O400//'''', ,6 6? ?%%DD       22 &&(( ?? $ $T-?-?&& ##y*%)) $$ && '' "! )4 @@ ,Y7 EK  -,sFFc#Kt|dtt|}ttt t t|jjrttttdttddt|jjr t t"t$t&|j(s&t*|jj,rt.d|j1j3vrt4t6t8t;|t<r(d|j1j3vrt>t;|t<r(d|j1j3vrt>|jj@s tByyw)Nclassifier_tagsTrfloat32rX_dtype class_weight)"rnrrM"check_classifier_data_not_an_arraycheck_classifiers_one_label*check_classifiers_one_label_sample_weightscheck_classifiers_classes'check_estimators_partial_fit_n_features target_tags multi_outputcheck_classifier_multioutputcheck_classifiers_trainr#check_classifiers_regression_targetr multi_label6check_classifiers_multilabel_representation_invariance2check_classifiers_multilabel_output_format_predict8check_classifiers_multilabel_output_format_predict_proba)r<rcheck_array_api_input)rirr>rs rmrrUs? 3 4    !+!    s*,c#bK|jj}t|}|jjs5t j dj||jty|jr*t j dj|tyt|D]}||syt|D]}|t|rt|D]}|t|rt|D]}|t!|drt#|D]}|t%|t&rt)|D]}|t+|rt-|D]}|t.|j0st2t4t6t8t:t<t>t@tB|jDs6tFtHtJ|jLjNrtP|jjRr tTyyw)Nz8Can't test estimator {} which requires input of type {}z2Explicit SKIP via _skip_test tag for estimator {}.r)+rhrdrMr two_d_arrayrtruformatr) _skip_testrrrrr rrrrsrrrr&check_parameters_default_constructiblenon_deterministic%check_methods_sample_order_invariancecheck_methods_subset_invariancecheck_fit2d_1samplecheck_fit2d_1featurecheck_get_params_invariancecheck_set_paramscheck_dict_unchangedcheck_fit_idempotentcheck_fit_check_is_fittedrcheck_n_features_in check_fit1dcheck_fit2d_predict1drrequiredcheck_requires_y_none positive_onlycheck_fit_non_negative)rilegacyrrkrs rm_yield_all_checksrcs    ' 'D I D ?? & & F M Mdoo      @ G G M   "9-  y) Y-i8 EK I,Y7 EK y+&.y9 EK )\*-i8 EK 9%+I6 EK  00  ! !33--   %%    ##   !!##    $ $' ' $$$$%sH-H/ct|drt|jSt|tr|j j S|j S)N __wrapped__)r _check_namerrsrfuncrd)rs rmrrs?um$5,,--",UG"<5::  P%..Proct||\}|r||fS|jj|dk(r.|j||jj St fd}||fS)aMark the test as xfail or skip if needed. Parameters ---------- estimator : estimator object Estimator instance for which to generate checks. check : partial or callable Check to be marked. expected_failed_checks : dict[str, str], default=None Dictionary of the form {check_name: reason} for checks that are expected to fail. mark : "xfail" or "skip" or None Whether to mark the check as xfail or skip. pytest : pytest module, default=None Pytest module to use to mark the check. This is only needed if ``mark`` is `"xfail"`. Note that one can run `check_estimator` without having `pytest` installed. This is used in combination with `parametrize_with_checks` only. xfail)reason)marksc>tdtdd)Nz Skipping  for : )rQr)argskwargsrestimator_namers rmwrappedz_maybe_mark..wrappeds-K./u^4DBvhO ro)_should_be_skipped_or_markedrhrdparammarkrr) rirexpected_failed_checksr%pytestshould_be_markedr"r!rs ` @@rm _maybe_markr)s2 <50 f t|%((11N w||IuFKK4E4EV4E4T|UU u    '!!roc<|xsi}t|}||vrd||fSy)a>Check whether a check should be skipped or marked as xfail. Parameters ---------- estimator : estimator object Estimator instance for which to generate checks. check : partial or callable Check to be marked. expected_failed_checks : dict[str, str], default=None Dictionary of the form {check_name: reason} for checks that are expected to fail. Returns ------- should_be_marked : bool Whether the check should be marked as xfail or skipped. reason : str Reason for skipping the check. T)FzCheck is not expected to fail)r)rirr& check_names rmr#r#s6.49rU#J+++J777 1roTrr&r%c #K|dk(rddl}nd}t|j}|tt|ft ||D]1}t||}t ||D]}t|||||3yw)amIteratively yield all check callables for an estimator. This function is used by :func:`~sklearn.utils.estimator_checks.parametrize_with_checks` and :func:`~sklearn.utils.estimator_checks.check_estimator` to yield all check callables for an estimator. In most cases, these functions should be used instead. When implementing a custom equivalent, please refer to their source code to understand how `estimator_checks_generator` is intended to be used. .. versionadded:: 1.6 Parameters ---------- estimator : estimator object Estimator instance for which to generate checks. legacy : bool, default=True Whether to include legacy checks. Over time we remove checks from this category and move them into their specific category. expected_failed_checks : dict[str, str], default=None Dictionary of the form {check_name: reason} for checks that are expected to fail. mark : {"xfail", "skip"} or None, default=None Whether to mark the checks that are expected to fail as xfail(`pytest.mark.xfail`) or skip. Marking a test as "skip" is done via wrapping the check in a function that raises a :class:`~sklearn.exceptions.SkipTest` exception. Returns ------- estimator_checks_generator : generator Generator that yields (estimator, check) tuples. rrN)r)r&r%r')r'typerdrrwrrPr)) rirr&r%r'rrcheck_with_namecheck_instances rmestimator_checks_generatorr1sN w  ? # #D W6= =="9V< !%.8 J N'=    sA8A:)rr&cddl}td|Dr d}t|d}|jj d||||t S)aPytest specific decorator for parametrizing estimator checks. Checks are categorised into the following groups: - API checks: a set of checks to ensure API compatibility with scikit-learn. Refer to https://scikit-learn.org/dev/developers/develop.html a requirement of scikit-learn estimators. - legacy: a set of checks which gradually will be grouped into other categories. The `id` of each check is set to be a pprint version of the estimator and the name of the check with its keyword arguments. This allows to use `pytest -k` to specify which tests to run:: pytest test_check_estimators.py -k check_estimators_fit_returns_self Parameters ---------- estimators : list of estimators instances Estimators to generated checks for. .. versionchanged:: 0.24 Passing a class was deprecated in version 0.23, and support for classes was removed in 0.24. Pass an instance instead. .. versionadded:: 0.24 legacy : bool, default=True Whether to include legacy checks. Over time we remove checks from this category and move them into their specific category. .. versionadded:: 1.6 expected_failed_checks : callable, default=None A callable that takes an estimator as input and returns a dictionary of the form:: { "check_name": "my reason", } Where `"check_name"` is the name of the check, and `"my reason"` is why the check fails. These tests will be marked as xfail if the check fails. .. versionadded:: 1.6 Returns ------- decorator : `pytest.mark.parametrize` See Also -------- check_estimator : Check if estimator adheres to scikit-learn conventions. Examples -------- >>> from sklearn.utils.estimator_checks import parametrize_with_checks >>> from sklearn.linear_model import LogisticRegression >>> from sklearn.tree import DecisionTreeRegressor >>> @parametrize_with_checks([LogisticRegression(), ... DecisionTreeRegressor()]) ... def test_sklearn_compatible_estimator(estimator, check): ... check(estimator) rNc3<K|]}t|tywN)rsr.).0ests rm z*parametrize_with_checks..{s 7S:c4 7uPassing a class was deprecated in version 0.23 and isn't supported anymore from 0.24.Please pass an instance instead.c3|K|D]1}||dd}t|r |||d<tdi|Ed{3y7w)Nr)rirr%r&)callabler1) estimatorsrr&rirs rm_checks_generatorz2parametrize_with_checks.._checks_generatorsP# :I!*fgND./1G 1R-.19D9 9 9  : :s 0<:<zestimator, check)ids)r'any TypeErrorr% parametrizerO)r=rr&r'msgr>s rmparametrize_with_checksrD0sbR 7J 77 / n: ;; " "*f.DE $ # robooleanruraise) generate_onlyrr&on_skipon_failcallbackF)prefer_skip_nested_validation)rr&rHrIrJc :t|tr d}t||dk(r | tdt|j}|r)t j dtt||ddSg} t|||dD]L\}} t|| |\} } | ||t| dd| | d } | j| |sE|di| N| S#t$rc}|t| |d | | d } |d k(rBt j d t| d |dt|jd|tYd}~d}~wt$rU}|dk(r| s|t| || | d} | rd| d<nd| d<|d k(r tdi| }t j |Yd}~d}~wwxYw)aCheck if estimator adheres to scikit-learn conventions. This function will run an extensive test-suite for input validation, shapes, etc, making sure that the estimator complies with `scikit-learn` conventions as detailed in :ref:`rolling_your_own_estimator`. Additional tests for classifiers, regressors, clustering or transformers will be run if the Estimator class inherits from the corresponding mixin from sklearn.base. scikit-learn also provides a pytest specific decorator, :func:`~sklearn.utils.estimator_checks.parametrize_with_checks`, making it easier to test multiple estimators. Checks are categorised into the following groups: - API checks: a set of checks to ensure API compatibility with scikit-learn. Refer to https://scikit-learn.org/dev/developers/develop.html a requirement of scikit-learn estimators. - legacy: a set of checks which gradually will be grouped into other categories. Parameters ---------- estimator : estimator object Estimator instance to check. generate_only : bool, default=False When `False`, checks are evaluated when `check_estimator` is called. When `True`, `check_estimator` returns a generator that yields (estimator, check) tuples. The check is run by calling `check(estimator)`. .. versionadded:: 0.22 .. deprecated:: 1.6 `generate_only` will be removed in 1.8. Use :func:`~sklearn.utils.estimator_checks.estimator_checks_generator` instead. legacy : bool, default=True Whether to include legacy checks. Over time we remove checks from this category and move them into their specific category. .. versionadded:: 1.6 expected_failed_checks : dict, default=None A dictionary of the form:: { "check_name": "this check is expected to fail because ...", } Where `"check_name"` is the name of the check, and `"my reason"` is why the check fails. .. versionadded:: 1.6 on_skip : "warn", None, default="warn" This parameter controls what happens when a check is skipped. - "warn": A :class:`~sklearn.exceptions.SkipTestWarning` is logged and running tests continue. - None: No warning is logged and running tests continue. .. versionadded:: 1.6 on_fail : {"raise", "warn"}, None, default="raise" This parameter controls what happens when a check fails. - "raise": The exception raised by the first failing check is raised and running tests are aborted. This does not included tests that are expected to fail. - "warn": A :class:`~sklearn.exceptions.EstimatorCheckFailedWarning` is logged and running tests continue. - None: No exception is raised and no warning is logged. Note that if ``on_fail != "raise"``, no exception is raised, even if the checks fail. You'd need to inspect the return result of ``check_estimator`` to check if any checks failed. .. versionadded:: 1.6 callback : callable, or None, default=None This callback will be called with the estimator and the check name, the exception (if any), the status of the check (xfail, failed, skipped, passed), and the reason for the expected failure if the check is expected to fail. The callable's signature needs to be:: def callback( estimator, check_name: str, exception: Exception, status: Literal["xfail", "failed", "skipped", "passed"], expected_to_fail: bool, expected_to_fail_reason: str, ) ``callback`` cannot be provided together with ``on_fail="raise"``. .. versionadded:: 1.6 Returns ------- test_results : list List of dictionaries with the results of the failing tests, of the form:: { "estimator": estimator, "check_name": check_name, "exception": exception, "status": status (one of "xfail", "failed", "skipped", "passed"), "expected_to_fail": expected_to_fail, "expected_to_fail_reason": expected_to_fail_reason, } estimator_checks_generator : generator Generator that yields (estimator, check) tuples. Returned when `generate_only=True`. .. TODO(1.8): remove return value .. deprecated:: 1.6 ``generate_only`` will be removed in 1.8. Use :func:`~sklearn.utils.estimator_checks.estimator_checks_generator` instead. Raises ------ Exception If ``on_fail="raise"``, the exception raised by the first failing check is raised and running tests are aborted. Note that if ``on_fail != "raise"``, no exception is raised, even if the checks fail. You'd need to inspect the return result of ``check_estimator`` to check if any checks failed. See Also -------- parametrize_with_checks : Pytest specific decorator for parametrizing estimator checks. estimator_checks_generator : Generator that yields (estimator, check) tuples. Examples -------- >>> from sklearn.utils.estimator_checks import check_estimator >>> from sklearn.linear_model import LogisticRegression >>> check_estimator(LogisticRegression()) [...] r9rFNz9callback cannot be provided together with on_fail='raise'z`generate_only` is deprecated in 1.6 and will be removed in 1.8. Use :func:`~sklearn.utils.estimator_checks.estimator_checks_generator` instead.skipr,passed)rir+ exceptionstatusexpected_to_failexpected_to_fail_reasonskippedruzSkipping check rz because it raised r)rir+rOrQrRrrPfailedr;)rsr.rA ValueErrorrdrtru FutureWarningr1r#rrQr) Exceptionr'append)rirGrr&rHrIrJrCr test_resultsr test_can_failr check_resultewarnings rmcheck_estimatorr^s P)T" / n'h2TUU  ? # #D     * fT  L65  A% 5!= u4!  v2  ) V')%0!"$1+1 L L)   $| $CA%F o  ')%0#$1+1 L&  %k%&8%9tfDWAw''(1#/#  ''!-')%0$1+1 L*1 X&)1 X&& 5E E g&+ 's&C FAD99 FA FFc|t1tdddddd\}}tj|}||fatS)N rB@*) n_samples n_features n_informativebiasnoise random_state)REGRESSION_DATASETr%r6 fit_transform)Xys rm_regression_datasetrosM!  1   * *1 -T roc$eZdZdZdZddZdZy) _NotAnArrayzvAn object that is convertible to an array. Parameters ---------- data : array-like The data. c8tj||_yr4)npasarraydata)selfrus rm__init__z_NotAnArray.__init__sJJt$ roNc|jSr4)ru)rvdtypecopys rm __array__z_NotAnArray.__array__s yyrocj|jdk(rytdj|j)Nmay_share_memoryTz%Don't want to call array_function {}!)rdrAr)rvrtypesrr s rm__array_function__z_NotAnArray.__array_function__s- ==. .?FFt}}UVVro)NN)rd __module__ __qualname____doc__rwr{rr;rormrqrqs%Wrorqc8t|dd}t|dk(S)zReturns True if estimator accepts pairwise metric. Parameters ---------- estimator : object Estimator object to test. Returns ------- out : bool True if _pairwise is set to True and False otherwise. metricN precomputed)rfbool)rirs rm_is_pairwise_metricrs"Y$ /F -' ((roc#K|jdk(sJd|jfdD]}||j|f|jd}|jj d|_|j j d|_d|fdD]\}|j|}|j j d|_|jj d|_|dz|f^yw) auGenerate sparse matrices or arrays with {32,64}bit indices of diverse format. Parameters ---------- X_csr: scipy.sparse.csr_matrix or scipy.sparse.csr_array Input in CSR format. Returns ------- out: iter(Matrices) or iter(Arrays) In format['dok', 'lil', 'dia', 'bsr', 'csr', 'csc', 'coo', 'coo_64', 'csc_64', 'csr_64'] csr)doklildiabsrcsccoorint64coo_64)rr_64N)rrzasformatrowastypecolindicesindptr)X_csr sparse_formatX_coorms rm_generate_sparse_datars <<5   C; U^^M:::; NN5 !E   )EI   )EI E/'' NN= )II$$W- 88??7+e#Q&& 'sC;C=rqc&t|}tjjd}|j d}tj tj fD]}tjd|}t||}|j}|jdr0d|vs,|jdstj|rd}nd }nd}d |d } tt|| 5|j||dddy#1swYxYw) Nix)rasizerasklearn.test__testingzJInput (y|Y) contains infinity or a value too large for dtype\('float64'\).zInput (y|Y) contains NaN.rcz< should have raised error on fitting array y with inf value.matcherr_msg)rrsrandom RandomStatestandard_normalnaninffull_enforce_estimator_tags_yr startswithendswithisinfr[rUfit) restimator_origrirngrmvaluern module_namerrs rmrrs n%I ))   $C )A&&"&&!  GGB  %i 3**  ! !* - { "k&:&::&Fxx, 5E  JeW = MM!Q   1 0  s )DD c * t||}td\}}|j|d}t||}t ||}t |} |j ||} |j ||} | j||t| jD cic]#\} } t| tjs!| | %}} } t | }td5|j| | t| dj}d d d |jD]\} }t!|| }td5t|dj}d d d k(sJd | d |d |t#|t#| k(sJt%|| }|r&t'||| dt)|j*|j,|j,k(sJ|j*|j*k(rJd} tj | tj | |jdk7}|rIt | j| | }|D])}t!||d }||dk(r || | "|| +|D]}t!| |d }||dk(r~|||}td5t!||| | }d d d t|t4sJtt4sJ|r&t7||z t)|j*ksJ||}td5t!||| }d d d td5tdj}d d d k(sJd |d|d|dt#t#| k(sJt%|| }|r&t'|||dt)|j*nBt9|dr6|j,|j,k(sJ|j*|j*k(sJ|dk(st9| ds| j;|}td5|j;|}t|dj} d d d  |k(sJd|d| dt#t#| k(sJt%|| }!|r$t'||!dt)|j*\|j,|!j,k(sJ|j*|!j*k(rJy cc} } w#1swYxYw#1swYxYw#t.t0t2f$rd}YwxYw#1swYxYw#1swY$xYw#1swYxYw#1swYxYw)a_Check that the estimator can work consistently with the Array API By default, this just checks that the types and shapes of the arrays are consistent with calling the same estimator with numpy arrays. When check_values is True, it also checks that calling the estimator on the array_api Array gives the same results as ndarrays. rdrjFrzr=T)array_api_dispatchrN'z,' attribute is in wrong namespace, expected z got )xpz not the sameratol)score score_samplesdecision_functionrpredict_log_proba predict_probararray_api_strictrz)' output is in wrong namespace, expected , got .z# did not the return the same resultshaperinverse_transformz;'inverse_transform' output is in wrong namespace, expected z4inverse_transform did not the return the same result)rRr#r_enforce_estimator_tags_Xrrrtrvarsitemsrsrsndarrayrr;rdrf array_devicer:rTr9ryrrArgrUfloatabsrr)"rrrr>r check_valuesrrmrnr6X_xpy_xpkeyrarray_attributesest_xpinput_ns attribute est_xp_param attribute_nsest_xp_param_npmethodsnumpy_asarray_worksest_fitted_with_as_array method_namemethodresult result_xp result_ns result_xp_npinverse_resultinvese_result_xpinverse_result_nsinvese_result_xp_nps" rmrrs ov 6B B /DAq %(A!.!4A!.!4A  C ::a: 'D ::a: 'DGGAqM&*#Y__%6!sE*UBJJ:WU 3ZF 4 03 4 &q)223 +002<Yvs+ t 4 C(6q9BBL Cx' u@ K. " ' L)\$-????+LR@  %}-#AGG,  ??o&;&;; ;;??o&;&;; ;;+<0G$ 4 4!kk-??$):>>$#= # K5{DIF~g%tT"t  @I k40 >  ' !Aq\F48 E8GFK8tD  Efe, ,,i/ //6I-.1HHHH AYF48 ?8GFK8>  ?t 4 =%i03<rr)r)rrrr>rs rm check_array_api_input_and_valuesrs# ! '  rocjt|}tjjd}|dk(rdnd}|j |df}d||dk<|j dd|}t ||}t||}tj|}t|}|jjr |j||y d|d |jjd } |j||td|d|jjd#t$r.}d|d |jjd } t| |d }~wwxYw#tt f$r5}t#j$dt'|rYd }~y t| |d }~wt$r}t| |d }~wwxYw)zLCheck that estimator tag related with accepting sparse data is properly set.rSpectralCoclustering(r333333?rcz5 raised an exception. The tag self.input_tags.sparse=z might not be consistent with the estimator's ability to handle sparse data (i.e. controlled by the parameter `accept_sparse` in `validate_data` or `check_array` functions).Nzx raised an exception. The estimator failed when fitted on sparse data in accordance with its tag self.input_tags.sparse=z but didn't raise the appropriate error: error message should state explicitly that sparse input is not supported if this is not the case, e.g. by using check_array(X, accept_sparse=False).z [Ss]parsezd didn't fail when fitted on sparse data but should have according to its tag self.input_tags.sparse=z,. The tag is inconsistent and must be fixed.)rrsrruniformrandintrrr csr_arrayrMrrrWAssertionErrorrUrAresearchstr) rrrirrermrnrkr\rs rmrrsn%I ))   "C44"I )Q (AAa#gJ Aqy )A!)Q/A!)Q/AA I D  1 MM!Q 337??3I3I2JKO O  1 MM!Q &&*oo&<&<%=>9 :  7 1TF#226//2H2H1IJCC !)q 0 1(I& 1yyc!f- )q 0 1 )q 0 1sB3D$E E%)EEF2%F F F2! F--F2c8tjjd}|jd}d||dk<t ||}d|j|j dzj tj}tt5t|}dddt|}t|}t||D]\}}tt5t|}|dvr|jd dddd |vr d |d |d } nd |d} tt t"fddgd| 5tt5|j%||dddt'|dr||j)|} |j*j,r6|j*j.s | j |j ddfk(s!J| j |j dfk(sJt'|dr[|j1|} |j2j4s|j ddf} n|j ddf} | j | k(sJdddy#1swYxYw#1swYmxYw#1swYxYw#1swYxYw)Nr)rrrrrq)Scalerr6F) with_mean64rcz doesn't seem to support z` matrix, and is not failing gracefully, e.g. by using check_array(X, accept_large_sparse=False).z doesn't seem to fail gracefully on sparse data: error message should state explicitly that sparse input is not supported if this is not the case, e.g. by using check_array(X, accept_sparse=False).r SparseTrmay_passrrrBrr)rsrrrrrrint32rZrVrrrMr set_paramsr[rArUrrrrrrrrr) rr sparse_typerrmrnrirk matrix_formatrpredprobsexpected_probs_shapes rm!_check_estimator_sparse_containerr s~ ))   "C  !AAa#gJ!.!4A S[[aggaj[ ) )11"((;A - 0*.) *!)Q/A N #D1+a.A(; q m 4 6n-I33$$u$5 6 = TF";M?K== TF#77    #X&   ; !-8 $ a# $y), ((+##009I9I9W9W::!''!*a888::!''!*666y/2!//2++77,-GGAJ?(,-GGAJ?({{&::::) ; ;)(; **  6 60 $ $  ; ;s= I(("I5JJ%C7J(I25I? J JJ c:t||tjyr4)rr csr_matrixrrs rmrrBs%dNF1EEL R II: ;))QC"H%#//==#//<< QU +A  MM!QgM 6 %%+VD\     ;   sCD!C66$DDD2ct|}tjddgddgddgddgddgddgddgddgddgddgddgddgg }tt ||}tgd}tdgdz}t |}|j js;|j jr%t|jjdd}|j|||y) NrBrrrrrr) rrsrrqrrMrrrrureshaper)rrrirmrnrrks rmrrsn%I  F F F F F F F F F F F F  A -na@AA89A1#(#G I D    ) )d.>.>.K.K r1- . MM!QgM.roct|}tjjd}d}t ||j |df}tj |dz}t||}dg|z}|j|||y)Nrrrr) rrsrrrrarangerr)rrrirndrermrnrs rmrrs~n%I ))   "CI!.#++Iq>+2RSA )q A!)Q/AC)OM MM!QmM4roct|}tjddgddgddgddgddgddgddgddgddgddgddgddgddgddgddgddgg}tjgd}t||}|j ||tj t |tt5|j ||tj dt |zdddtt5|j ||tj t |dfdddy#1swYTxYw#1swYyxYw)NrBrrrrBrBrBrBrrrrrBrBrBrBrrrrr) rrsrrroneslenr[rU)rrrirmrns rmrrsXn%I  F F F F F F F F F F F F F F F F!  A( ABA!)Q/A MM!Qbggc!foM6  ? a"''!c!f**= >?  @ a"''3q61+*> ?@@??@@s34D:>3E:EEcdt|}t|}t|dt|dtjj d}d}|j ||dz}|j dd|}|j dd|} |} |} | j| d } | j| } t| | | d\} } } d |jvrtjtj| dtj|d tj|dg}tj| tj|tj|g} tj| ||g} tj| ||g} ttj!| | }|j#|tjtj| dtj|d tj|dg}tj| ||g} tj| ||g} ttj!| | }|j#|t%|| } t%|| } ||| } || } |j'| | d|j'| | | dD]J}t)||st+|||}t+|||}d|d|d}t-|||Ly)Nrrrdrrrrr)repeatsaxis)r%cvrB)groupsr')rnr)rrrrzComparing the output of rzn revealed that fitting with `sample_weight` is not equivalent to fitting with removed or repeated data points.r)rr\rsrrrandrrepeatrCrhstack full_like ones_likevstacklistr1splitrrrrrfrU)rrsparse_containerestimator_weightedestimator_repeatedrrermrnsw X_weighted y_weighted X_repeated y_repeatedgroups_weightedsplits_weightedgroups_repeatedsplits_repeatedrX_pred1X_pred2rs rm _check_sample_weight_equivalencerAs~.~.'a8'a8 ))   #CI IM*A Aqy )A Q  *BJJ""2A"6J""2".J!(ZRS!TJ B ~((**)) \\*a (",,q!*P Q YYBLLOR\\!_= >YY Aq12 YY Aq12    $ $Z $ H  %%%9)) \\*a (",,q!*P Q YY Aq12 YY Aq12    $ $Z $ H  %%%9*+=zJJ*+=zJJ#%j1 %j1 :4H:2FP L >6 *9g0&9!DQroc:t||tjyr4)rAr rrs rmrr,s$T>6;K;KLroct|}t|dtjddgddgddgddgddgddgddgddgddgddgddgddgddgddgddgddggtj}tjgdt }t ||}tj|jd}d |d<|j}|j||| |d }t||| y) NrrrBrrrryr!g$@rz8 overwrote the original `sample_weight` given during fitr*) rr\rsrfloat64r rr"rrzrrT)rrrirmrnsample_weight_originalsample_weight_fitrs rmrr0s n%IYQ/  F F F F F F F F F F F F F F F F! $jj' A* AMA!)Q/AWWQWWQZ0 $1.335 MM!Q&7M8NOG%'=wOroc0tjjd}t||j d}|j t }t|}|dddfdzj t}t|}t||}|j||t|dr|j|t|dr|j|d}tt dd | 5|j||j t ddd|j"j$s6d d i|d <d}tt&|5|j||dddy|j||y#1swYhxYw#1swYyxYw)Nr)rrarrrrzy with unknown label type is passed, but an error with no proper message is raised. You can use `type_of_target(..., raise_unknown=True)` to check and raise the right error, or include 'Unknown label type' in the error message.zUnknown label typeTrfoobarrrz#argument must be .* string.* numberr)rsrrrrrobjectrMr rrrrrrr[rWrstringrA) rrrrmrkrnrirrCs rmrrXsc ))   "C!.#++8+2LMA A N #D 1a41S!An%I!)Q/A MM!Qy)$!y+&A   !5g V+ a&)*+ ?? ! !%.$4 IS ) MM!Q     a!++  s3&FF F  Fctjjd}|jdd|jdzz}|j dd}|j ddd dz}t |}t|d ttd 5|j||dddy#1swYyxYw) Nrdrary?rrBrrlowhighrrzComplex data not supportedrM) rsrrrrrrr\r[rUr)rrrrmrnris rmrrs ))   #C  rCKKRK$888A "aA  +b0An%IYQ/  "> ? as B66B?ctjjd}d|jdz}t ||}|dddfj t }t|}t||}t|d|j||dD]T}t||s|jj}t||||j|k(rLJd|zy)Nrrr rrBrrrrz$Estimator changes __dict__ during %s)rsrrrrrr rrr\rr__dict__rzrf)rrrrmrnrir dict_befores rmrrs ))   "C CKKWK %%A!.!4A !Q$sAn%I!)Q/AY" MM!QP 9f %#,,113K &GIv &q )%%4 6? 4 rocL|jdxs|jd S)N_)rr)attrs rm_is_public_parameterr[s"$: c(: ;;roc>t|jdryt|}tjj d}d|j dz}t||}|dddfjt}t||}t|drd|_ t|drd|_ t|d|jj}|j!|||j}|j#Dcgc]}t%|s|} }| Dcgc]}||j#vs|} }| rJd d j'| z| Dcgc]}||||ur|} }| rJd d j'| zycc}wcc}wcc}w) Ndeprecated_originalrrr r n_componentsrB n_clusterszEstimator adds public attribute(s) during the fit method. Estimators are only allowed to add private attributes either started with _ or ended with _ but %s added, zEstimator changes public attribute(s) during the fit method. Estimators are only allowed to change attributes started or ended with _, but %s changed)rrwrrsrrrrrr rr^r_r\rVrzrrr[join) rrrirrmrndict_before_fitdict_after_fitrpublic_keys_after_fitattrs_added_by_fitattrs_changed_by_fits rmr~r~s~&&(=>n%I ))   "C CKKWK %%A!.!4A !Q$sA!)Q/Ay.)!" y,' Y"((--/O MM!Q''N&**,0DS0I -?;O;O;Q0Q " "&+=!>  ? !)  C s(; ;  $  "67  8 ##1sFF"F:FFctjjd}d|jdz}t ||}|dddfj t }t|}t||}t|drd|_ t|drd|_ t|d|j||dD]>}t||sttd 5t!|||dddd@y#1swYKxYw) Nrrr rr^rBr_rUzReshape your datarM)rsrrrrrr rrrr^r_r\rr[rUrf)rrrrmrnrirs rmr r s ))   "C CKKWK %%A!.!4A !Q$sAn%I!)Q/Ay.)!" y,' Y" MM!QP1 9f % *=> 1* 6*1Q40 1 11 1 1s C<<D c ||}|jd}|Dcgc]}||jd|}}t|tr|d}t t d|}t j|r-|j}|Dcgc]}|j}}tj|tj|fScc}wcc}w)NrBrc |dS)Nrr;)xs rmz#_apply_on_subsets..s QqTro) rrrstupler1mapr issparsetoarrayrsravel)rrm result_fullrfbatchresult_by_batchrjs rm_apply_on_subsetsrtsq'KJGHIetEMM!Z89IOI+u%!!n s>?CD {#!))+ 0?@1199;@@ 88K "((?"; ;;JAs CCctjjd}d|jdz}t ||}|dddfj t }t|}t||}t|drd|_ t|drd|_ t|d|j||dD]J}d j|| }t||s#tt!|||\}} t#|| d | Ly) Nrrr rr^rBr_rrrrrz={method} of {name} is not invariant when applied to a subset.rrHz>rr)rsrrrrrr rrrr^r_r\rrrtrfrT) rrrrmrnrirrCrqrss rmrr s  ))   "C CKKWK %%A!.!4A !Q$sAn%I!)Q/Ay.)!" y,' Y" MM!QROVVW  9f %+< 6*A, (K KtS QRroc tjjd}d|jdz}t ||}|dddfj tj }t|}|j|jjsd||dk(<t|}t||}t|drd|_ t|drd|_t|d|j!||tjj#|j$d}d D]e}d j'|| } t||s#t)t+t-||||t-||t+||d | gy)Nrrr rrBrr^r_rvzY{method} of {name} is not invariant when applied to a datasetwith different sample order.rw& .>ry)rsrrrrrrrMrrrrrr^r_r\r permutationrrrUr8rf) rrrrmrnrkriidxrrCs rmrr2sf ))   "C CKKWK %%A!.!4A !Q$rxx A N #D '0D0D0P0P!q& n%I!)Q/Ay.)!" y,' Y" MM!Q ))   +C + &T& * 9f % (9wy&9!!S+AB  roc$tjjd}d|jdz}t ||}|dddfj t }t|}t||}t|drd|_ t|drd|_ t|d|dk(r|jd |d k(r|jd gd}tt|d5|j!||dddy#1swYyxYw)Nrr)rBrarr^rBr_OPTICS?) min_samplesTSNE?) perplexity)z1 samplez n_samples = 1z n_samples=1z one samplez1 classz one classTrr)rsrrrrrr rrrr^r_r\rr[rUrrrrrmrnrimsgss rmrr_s ))   "C CKKWK %%A!.!4A !Q$sAn%I!)Q/Ay.)!" y,' Y" x- v~, D  $ 6 as *DDctjjd}d|jdz}t ||}|dddfj t }t|}t||}t|drd|_ t|drd|_ |dk(rd|_ |d k(rd |_ t||}t|dgd }tt |d 5|j#||dddy#1swYyxYw)Nrr)rarBrr^rBr_RandomizedLogisticRegressionRANSACRegressorr)z1 feature\(s\)zn_features = 1z n_features=1Tr)rsrrrrrr rrrr^r_sample_fractionresidual_thresholdr\r[rUrrs rmrrs ))   "C CKKWK %%A!.!4A !Q$sAn%I!)Q/Ay.)!" y,'  --$% !   '* $!)Q/AY" @D  $ 6 as C<<Dctjjd}d|jdz}|j t }t |}t||}t|drd|_ t|drd|_ t|dtt5|j||dddy#1swYyxYw)Nrrrcrr^rBr_)rsrrrrr rrrr^r_r\r[rUr)rrrrmrnris rmr r s ))   "C CKKbK ""A  An%I!)Q/Ay.)!" y,' Y"   as "B>>Cctdgdgdgddd\}}tj|}t||}|rt ||g\}}t ||||yNrrrrrBrBrBrr皙?recentersrjrf cluster_std)r"r6rlrrY_check_transformer)rrrrmrns rmrrsh I&  DAq &&q)A!+q1A(!Q01t[!Q/rocBtdgdgdgddd\}}tj|}t||}t |}t t j |}t||||t|||j|jyr) r"r6rlrrqrsrtrtolist)rrrmrnthis_Xthis_ys rmrrs I&  DAq &&q)A!+q1A ^F A 'Ft[&&9t[!((*ahhjAroct\}}t|}tttfd|d5|j |dddy#1swYyxYw)NzThe unfitted transformer z\ does not raise an error when transform is called. Perhaps use check_is_fitted in transform.r*)rorr[AttributeErrorrUr)rrrmrns rmrrsa  DAq $K  $ &!, ,  ! a  ! ! !s AActjjd}|jd}t ||}t |}|j |}|jd|jdk(sJy)ztCheck that using transform without prior fitting doesn't raise a NotFittedError for stateless transformers. rrcrrN)rsrrrrrrr)rrrrmX_transs rmrrsm ))   "C  !A!+q1A $K##A&G == qwwqz )) )roctj|j\}}t|}t ||t vritj tj|tj|f}|ddddfxxdzcc<t|trt|}n|}|j||t|}|j||} t| tr| D]} | jd|k(rJn| jd|k(sJt|dr|t vr&|j||} |j||} n$|j|} |j||} t|jr|dz} t!| t| trKt| tr;t#| | | D]*\} }}t%| |dd|z t%| |dd |z ,nDt%| | d|zd t%| | dd |z t'| |k(sJt'| |k(sJt|d rrt|j(r\|j*dk(rL|jddkDr9t-t.d |d5|j|ddddfdddyyyyyy#1swYyxYw)NrrBrnrr is non deterministic{Gz?z9fit_transform and transform outcomes not consistent in %sryz7consecutive fit_transform outcomes not consistent in %srrzThe transformer zr does not raise an error when the number of features in transform is different from the number of features in fit.r*r)rsrtrrr\rNc_rsrqrrlrlrrrMrrQziprUr]rndimr[rU)rtransformer_origrmrnrerfry_transformer_cloneX_predx_predr@X_pred3rCx_pred2x_pred3s rmrrsJJqM//Iz()K[! "" UU2::a="**Q-/ 0 3Q36 a a %RB OOArk*  , ,Q" , 5F&%  0F<<?i/ // 0||A)+++{K( & &!++Ar2G!//R/8G!++A.G!//R/8G $ % 7 700C3-  fe $GU)C,/,I (,W!" -U!"   )S   )Q   (I5 55(I5 55 Aw %22!  Q&tf-55 1%%a3B3i0 1 13 _)j 1 1s J??Kct|jr|dz}t|tdgdgdgddd\}}t ||t }t |}t||}t|t|}|j|||j||d d g}|D]<}t||d} | t||} | ||} | ||} t| | >y) Nrrrrrrrrkernelrrl) rMrrQr"rr0rrr\r5rrfrU) rrrCrmrnripipelinefuncs func_namer func_pipeliner result_pipes rmrrYs11,,sm I&  DAq ".!JGAn%I!)Q/AYY'H MM!Q LLA o &E> y)T2  #Hi8M!QZF'1-K ( = >roc ttfttfttfttft tft tfttfttfttfttfttfg }g}t|j}|D]F\}}||vs ||vs|j||j|kDs4|j||fHdj!d|D}|r J|d|y)z5Check that mixins are inherited in the correct order. c3XK|]"\}}|jd|j$yw)z comes before/left side of Nrd)r5mixin_amixin_bs rmr7z$check_mixin_order..s6 GW    78H8H7IJs(*a is inheriting from mixins in the wrong order. In general, in mixin inheritance, more specialized mixins must come before more general ones. This means, for instance, `BaseEstimator` should be on the right side of most other mixins. You need to change the order so that: N)rrrrrrrrrrrrr.mroindexrXra)rrdag violationsrrr violation_strs rmrrzs -( ' }% =) ' }- (-8 }% }% ]+ =) CJ ~  " " $C2 sN3 '"SYYw%77   w0 1 2II *M &@ /  >zroc 0tjjd}d}|j|df}t ||}tj |dz}t |}t||}t|gd}|D]}t||d} | | ||t| jjD cgc]} | j} } | ddk(r| dd} | ddvrkJd |d t|jd | d ycc} w) Nrrrr)rr partial_fitrrlrvrB)rnYz.Expected y or Y as second argument for method  of z. Got arguments: r)rsrrrrrrrr\rfr parametersvaluesrr.rd) rrrrermrnrirrrprs rmr|r|s ))   "CI )Q (A!.!4A )q An%I!)Q/AY KE  y)T2   AJ$-dO$>$>$E$E$GHqAFFHDHAw& ABx7j( d9o66> ( IsDctjjd}d|jdj tj z}t ||}|j tj}|j tj}|j tj}tjddgdztj}t||}gd }||||fD]Q} t|} t| d| j| ||D]!} t| | st!| | | #Sy) NrrrrrBrrarErU)rsrrrrrrrFrrrrrr\rrrf) rrr X_train_32 X_train_64X_train_int_64X_train_int_32rnrX_trainrirs rmrrs ))   "CS[[g[.55bjjAAJ*>:FJ""2::.J&&rxx0N&&rxx0N !Q"BHH-A!.!4ALG NNK4.) A& gq! 4Fy&)* 6*73 4 4roc ht|}t|dr|jdtdgdgdgdd \}}t j |}t ||}t|jjD]}|j|}t||j ||}|j||j|}t||gd d gD]F\} } t| t r| d} | j"|k(r+J|d | d |d| j"dy)N set_outputdefaultrrrrrr)rerrjrrlrz (method=z3) does not preserve dtype. Original/Expected dtype=z , got dtype=r)rrrr"r6rlrrMrrrr\rrrrsrlry) rrrrmrnryX_castX_trans1X_trans2Xtrs rmrrsI()K{L)3 I&  DAq &&q)A!"2A6A*+<<LL%%,,VQ7??61-77?x2_k4RS JB"e$U88u$ & &*++0'bhhZqJ $  roct|}t|dtjdj dd}d|d}t t |5|j|gdddtjdj dd}t|tjgd}d }t t | 5|j||dddy#1swY~xYw#1swYyxYw) NrBrrThe estimator zc does not raise a ValueError when an empty data is used to train. Perhaps use check_array in train.r*r) rBrrBrrBrrBrrBrrBrzG0 feature\(s\) \(shape=\(\d*, 0\)\) while a minimum of \d* is required.rM) rr\rsemptyrr[rUrrr)rrr\X_zero_samplesrX_zero_featuresrnrCs rmrrs nAQXXa[((A.N I I   G ," nb!"hhqk))"a0O "!RXX.R%STA TC  # &" oq!""""""sC$C0$C-0C9ctjjd}t||j d}|j d}tj |d<|j d}tj |d<tjd}d|ddt||}d|d}d|d }d|d } ||fD]} tt 5t|} t| d ttd dg|5| j| |ddd| j||t!| dr.ttd dg|5| j#| dddt!| dr.ttd dg| 5| j%| ddddddy#1swYxYw#1swYZxYw#1swY,xYw#1swYxYw)NrrarrrLrarrcz& doesn't check for NaN and inf in fit.z* doesn't check for NaN and inf in predict.z, doesn't check for NaN and inf in transform.rqrBrNaNrrr)rsrrrrrrr"rrZrVrr\r[rUrrrr) rrrX_train_finite X_train_nan X_train_infrnerror_string_fiterror_string_predicterror_string_transformrris rmrr s ))   "C.  1N++7++KK++7++KK  A AbqE!.!4A#D6)OP'v-WX TFFG -1 m 4 1n-I Y * 5%.BRS * gq) * MM.! ,y), %.0/ %%g. /y+. %.21 ''0 1) 1 11  * *//11) 1 1sT,GF-:GF9 (GGG-F6 2G9G >GG GG ctdd\}}t|}ttd|d5|j ||dddy#1swYyxYw)z8Test that error is thrown when non-square data provided.rcra)rerfzThe pairwise estimator z+ does not raise an error on non-square datar*N)r"rr[rUrrrrmrnris rmrrC s[ r 2DAqn%I %dV+V W   a s A  Ac`gd}tdgdgdgddd\}}t||t }t|}|jj r_t jjd }|j|jd d }t j|jd|<t|} t| |}t| | j!|||r t#| } nbt%j&| } | j(} | j+drd| vs| j-dsd| vsJt%j.| } t1} |D]$}t3| |st5| ||| |<&| D]#}t5| ||}t7| ||%y)z'Test that we can pickle all estimators.rUrrrrrrrrrdraF)rerrrrs_sklearn_versionN)r"rr0rMrrrsrrchoicerrrrrr\rrYpickledumpsrrrloadsdictrrfrU)rrr check_methodsrmrnrkrmaskriunpickled_estimatorpickled_estimatorrrrunpickled_results rmrrS sSM I&  DAq ".!JGA N #D   ii##B'zz!&&"ez4 ff " dn%I!)Q/AY MM!Q7 B#LL3**  ! !* - { "k&:&::&F'*;; ;;$ll+<= VF; 9f %7WY7:F6N;G?7#6?B$VF^5EFGroct|dsyt|}tdd\}}t||}t ||} t |r*t j|}|j|||n|j||ttd|d5|j|dddd f|dddy#t$rYywxYw#1swYyxYw) Nr2rBrerjclassesrzZ does not raise an error when the number of features changes between calls to partial_fit.r*r) rrr"rrrrsuniquerNotImplementedErrorr[rU)rrrirmrnrs rmrr s >= 1n%I  3DAq!.!4A!.!4A  #iilG  ! !!Q ! 8  ! !!Q ' TF#G G , a3B3i+,, ,,sACC CCCc d\}}}t|}t|}td|||\}}t||}|j |||j |} | j ||fk(s#Jdj||f| j | jjdk(sJt|dr|j|} t| tjsJ| j ||fk(s#Jdj||f| j | dkDjt } |j"| } t%| | t|d r7|j'|} t| t(r|j*j,st/|D]z}| |j |d fk(s&Jd j|d f| |j t%tj0| |d jt | dd|f|nw|j*j,sa| j ||fk(s#Jd j||f| j t%| j3jt | t|drlt|d r_t/|D]P}|j'|dd|f}|j|}t%t5|t5|dd|fRyyy)N)rdrrrd)rjren_labels n_classeszSThe shape of the prediction for multioutput data is incorrect. Expected {}, got {}.irzaThe shape of the decision function output for multioutput data is incorrect. Expected {}, got {}.rrrzTThe shape of the probability for multioutput data is incorrect. Expected {}, got {}.rBr&)rMrr$rrrrrrykindrrrsrsrrr classes_rWrr1r poor_scorerangeargmaxroundr)rrrerrrkrirmrny_preddecisiondec_preddec_expy_probry_proba y_decisions rmrr s%-"Ix N #Dn%I )9x9 DAq ")Q/A MM!Q   q !F <? ?? ? ;;288G,bhhw.?@ @@ @ " "7 +F IIf%Mryyq!1=3Dq3HI  w && &y,'Y 5 A~r!2222(-))s J..J8c&tdd\}}t|}t|t|dr_|j |j |}|j d|j |j |}t||yy)z2Check that predict is invariant of compute_labels.rcrrcompute_labelsF)r N)r"rr\rrrrrW)rrrmrnrr?r@s rmrr: s  3DAqn%IYy*+--"**1-E2--"**1-7G, ,rocd}d}t|}tjjd}|j d}|j d}t |||\}}tj d}tt5ttd d | 5} |j||ddd jr dddyt|j||| dddy#1swYExYw#1swYyxYw) Nz6Classifier can't train when only one class is present.z8Classifier can't predict when only one class is present.rrrX_testrarqclassTrr*)rrsrrrrr"rZrVr[rUrraised_and_matchedrWr) rclassifier_origrrrrrr#rncms rmrrI sOU'J ))   "Ckkwk'G [[g[ &F/ GFSOGV  A - 0 X  g>N  '  NN7A & '   X X :--f5qBVW X X ' ' X Xs* DC40DD4C= 9DD c^|d}|d}tjjd}|jd}|jd}tjddz}|j }t |} t| drd |g} ttf|} } nd } ttfd } } t| | d | 5} | j|||| jr d d d y t| j|tj d|d d d y #1swYy xYw)zCheck that classifiers accepting sample_weight fit or throws a ValueError with an explicit message if the problem is reduced to one class. zu failed when fitted on one label after sample_weight trimming. Error message is not explicit, it should have 'class'.z; prediction results should only output the remaining class.r)rararrarrz\bclass(es)?\bz\bsample_weight\bNTrrr*)rsrrrrrzrr_rrUrAr[rr%rWrr")rr& error_fit error_predictrrr#rnrrrerr_typerr's rmrra s( &; ;fWXM ))   "Ckkxk(G [[h[ 'F " AFFHM'J_5"M2+Z8)'$& 3T' g F  "w?        v & ]     s?"D#*0D##D,c tdd\}}|j|}t||d\}}tj |}||dk7}||dk7}|dvr&||j z}||j z}|rt ||||g\}}}}||fg}t|} | jjr|j||f|D]\} } tj| } t| } | j\}}t|}t!|| } t#|| } t%|| j&s3t)t*d|d  5|j-| | dd ddd|j-| | |j-| j/| j/t1|d sJ|j3| }|j|fk(sJ| jj4st7| |d kDsJd}d}| j&s| j8j:rLt)t*|j=|d 5|j3| j?d ddddnEt)t*|j=|d 5|j3| j@dddt1|drl |jC| }| dk(rn| jDjFr|j|fk(sJ|j|dfk(sJ|jIdkDjtJ}tM||n4|j|| fk(sJtMtjN|d|| j&s| j8j:rLt)t*|j=|d 5|jC| j?d ddddnEt)t*|j=|d 5|jC| j@dddt1|dsy|jS| }|j|| fk(sJtMtjN|d|tUtjV|dtjX|| j&s| j8j:rLt)t*|j=|d 5|jS| j?d ddddnEt)t*|j=|d 5|jS| j@dddt1|ds|j[| }t]|tj^|ddtMtj`|tj`|y#1swYxYw#1swYAxYw#1swYNxYw#1swYxYw#1swYxYw#tP$rYwxYw#1swYxYw#1swYxYw)N,rrrrr) BernoulliNB MultinomialNB ComplementNB CategoricalNBThe classifier does not raise an error when incorrect/malformed input data for fit is passed. The number of training examples is not the same as the number of labels. Perhaps use check_X_y in fit.r*rrg(\?zuThe classifier {} does not raise an error when shape of X in {} is not equal to (n_test_samples, n_training_samples)z|The classifier {} does not raise an error when the number of features in {} is different from the number of features in fit.rrBrrrrr{)r)1r"rrCr6rlminrYrMrrrXrsrr#rrrrr\rr[rUrrrrrr+rrrrTrrrrpr rWrrrrVsumr"rrTlogargsort)rr&rrX_my_my_bX_bproblemsrkrmrnrrrerfrr msg_pairwiserCrrr y_log_probs rmrr sCa8HC **W CsCa0HC   ( ( -C cQh-C cQh-C PP swwy swwy6S#s7KLS#sc |H O $D ''c #pO1))A,L ! :?+ %j! 4 %j! 4$!!%dV,<< *q!CR&) * q!qxxz188:.z:...##A&|| |+++##..!!V,t3 33 G    !!''(//i@9&&qyyQ'78 99 J 40KL,&&qss+, :2 3 %77:>''55'~~)==='~~)Q??? ( 01 4<>i-CCCC&ryy'BFK))//#&$0$7$7>Q$RK'882q9IJ KK $&$'JJt5H$I>'88= > : /--a0F<P Q%%??++" , 3 3D/ JC#002q1AB CC  " # 4 A6#005 6 z#67'99!<  BFF6NADI"2::j#92::f;MNapO * *H99 ,,(KK >> '  CC 66sW3"X%X C;X4"X4*X4X':X4 "YY3W= X X X$ X4'X1 ,X44 YYY Y c||kr|}|dz}n|}|dz}tj|}d}ttj|||dk(sJ|y)NrBzThe number of predicted outliers is not equal to the expected number of outliers and this difference is not explained by the number of ties in the decision_function values)rssortr#r) num_outliersexpected_outliersrstartendsorted_decisionrCs rmcheck_outlier_corruptionrH so''!#!Q ggh'O 9 ryys34 5 :?C? :rocd}t|d\}}t|d}|r t|}|j\}}t |}t ||j ||j |j|j|}|j|fk(sJ|jjdk(sJttj|tjddg|j|} |j!|} | | fD]8} | jtjd k(sJ| j|fk(r8Jt#t$5|j|j&ddd| dk\j)t*} d| | dk(<t| |t#t$5|j|j&ddd| |j,z } t/| | t#t$5|j!|j&dddt1|d rt1|d sxd }||z }|j3| |j ||j|}tj4|dk7}||k7r|j|} t7||| yyyy#1swYIxYw#1swYxYw#1swYxYw)Nr-rrrrrrrBrrnoveltyrr)r"rCrYrrr\rrrryrrWrsrrrrr[rUr6rr offset_rTrrr7rH)rrrrermrYrfrirrscoresoutputry_decrDrrCs rmrr' sI   :DAq"A %a (GGIzn%IYMM! MM!((*   q !F <rightneitherz:contamination constraint should be an interval in (0, 0.5]) rrQr@rsrErr.r leftrSclosed)rrcontamination_constraintsc constraints rmrro s >#; <nCCC . E Eo V 1JKA 1h'K L R  0L j( +4'OOs*$$+__q(J,=,=AU,U  L L  LWL LsC c tddddddd\}}t|}|dd |dd }}|d d}t||| \}}|j}t |}t |} t | | j||j|} | j||j|} | j||j|} t| | t| | | j| jk(sJ| j| jk(sJt| t| k(sJt| t| k(sJy) NrrrrrTrrerfrrlengthallow_unlabeledrjPr") r$r7rrr1rr\rrrWryr.) rr&rmrnry_trainr#y_train_list_of_listsy_train_list_of_arraysrry_pred_list_of_listsy_pred_list_of_arrayss rmrr sc ) DAq aA"vq"vWG rsVF/QWXOGV#NN,!']'JZ ^^GW - 5 5f =F%>>'3HIQQ'NN74JKSSv45v34 <<066 66 6 <</55 55 5 <4 56 66 6 <4 45 55 5roc t|}t|d\}}}t|d|dddd\}}t|}|d| || d} }|d| || d} } t ||| \}} |j || d } t || d} | t|d | d | | }t|tjsJ|d t|d|j| jk(s$J|d|jd| jd|j| jk(s$J|d|jd| jdy)zeCheck the output of the `predict` method for classifiers supporting multilabel-indicator targets.rrrrrTrr[Nr"r does not have a  method.z2.predict is expected to output a NumPy array. Got instead.z(.predict outputs a NumPy array of shape instead of rz>.predict does not output the same dtype than the targets. Got )rr\r$r7rrrfrQrsrsrr.rry)rr&rre test_size n_outputsrmrnrr#r_y_testresponse_method_namepredict_methodrs rmrr s'JZ &0#Iy) ) DAq aA )na nVG )na nVG/QWXOGVNN7G$$Z)=tDN$01E0FhOPP F #F fbjj ) &B <.  # ) <<6<< ' &8Gll^1 & ' <<6<< ' &||nLa 9 'roc ,t|}t|d\}}}t|d|dddd\}}t|}|d| || d} }|d| } t ||| \}} |j || d } t || d} | t|d | d | | } t| trt| |k(sJd |dt| d|d| D]}|j|dfk(sJd |d|jd|dfd|jjdk(sJd |d|jdd |d}t|jdd|yt| t j"r| j||fk(sJd |d| jd||fd| jjdk(sJd |d| jdd |d}t%d| |t%| d|yt'dt)| d|d)zkCheck the output of the `predict_proba` method for classifiers supporting multilabel-indicator targets.rerrrTrr[Nr"rrgrhzWhen zn.predict_proba returns a list, the list should be of length n_outputs and contain NumPy arrays. Got length of rjrzx.predict_proba returns a list, this list should contain NumPy arrays of shape (n_samples, 2). Got NumPy arrays of shape fzW.predict_proba returns a list, it should contain NumPy arrays with floating dtype. Got riz.predict_proba returns a list, each NumPy array should contain probabilities for each class and thus each row should sum to 1 (or close to 1 due to numerical errors).rBrr*zX.predict_proba returns a NumPy array, the expected shape is (n_samples, n_outputs). Got zN.predict_proba returns a NumPy array, the expected data type is floating. Got z.predict_proba returns a NumPy array, this array is expected to provide probabilities of the positive class and should therefore contain values between 0 and 1.zUnknown returned type z by z4.predict_proba. A list or a Numpy array is expected.)rr\r$r7rrrfrQrsr1r#rryrrTr7rsrrXrUr.)rr&rrerkrlrmrnrr#r_rnpredict_proba_methodrrrs rmrr s'JZ &0#Iy) ) DAq aA )na nVG )nG/QWXOGVNN7G$*":/CTJ#$01E0FhOPP !& )F &$6{i' D6f+l9+Q 8 '  BD::)Q/ v))- Lq>"!% / ::??c) vA::,i) )v%%  DHH!H,a A' B( FBJJ '|| 955 D6==C\\NIy12! 5 5 ||  C' D6339<<.  K ' D6C C  !VW5&!W5$T&\N$tf=B B  roc Tt|}t|d\}}}t|d|dddd\}}t|}|d| || d} }|d| } t ||| \}} |j || d } t || d} | t|d | d | | } t| tjsJ|d t| d| j||fk(sJ|d| jd||fd| jjdk(sJ|d| jdy)zoCheck the output of the `decision_function` method for classifiers supporting multilabel-indicator targets.rerrrTrr[Nr"rrgrhz<.decision_function is expected to output a NumPy array. Got riz].decision_function is expected to provide a NumPy array of shape (n_samples, n_outputs). Got rjrrqz?.decision_function is expected to output a floating dtype. Got )rr\r$r7rrrfrQrsrsrr.rryr)rr&rrerkrlrmrnrr#r_rndecision_function_methodrs rmrr7 s'JZ &0#Iy) ) DAq aA )na nVG )nG/QWXOGVNN7G$.&z3GN'$01E0FhOPP %f -F fbjj ) &V ~Y ( ) <+2RSA )q A!.!4An%IY MM!Q   q !FY   -+h(=>h7 a1bjj=)*+!!!$I 5 cS9 C    ( (1vz3z 7:= >  >FLLNIOO$56++ s AGG G crtj|}t|}|dk(r||jkD}t ||j |||j |}t|dr^|j|}t|tjsJt|dk(r|jdkDjt}|j|} t!| |d|ddj#t%t&| ddj#t%t&|d  nt)|d d d k(rtj*|d jt} |j| } t!| |d|ddj#t%t&| ddj#t%t&|d  t!||jd|ddj#t%t&|ddj#t%t&|jd  y)Nr.rrrz0decision_function does not match classifier for z : expected 'r`z', got 'rr*decision_function_shapeovrrBrz"Unexpected classes_ attribute for )rsrrmeanr\rrrrrsrr#rprr rrWrarmrrfr) rmrnrr&rrrrrr decision_yy_exps rmcheck_classifiers_predictionsr siilG'J } LZ NN1a    "Fz.///2(BJJ/// w<1  (1,44S9H ))(3G  IIc#w/0IIc#v./ Z!:E Be K8!4;;C@J'' 3E  IIc#uo.IIc#v./   IIc#w' ( IIc#z223 4   roc|dvr|S|S)N)LabelPropagationLabelSpreadingSelfTrainingClassifierr;)rrny_namess rm _choose_check_classifiers_labelsr s! S S roctddd\}}t||d\}}tj|}||dk7}||dk7}t ||}t ||}gd}d d g}t j ||}t j ||} ||| fg} t|jjr| j|||f| D]9\} } } | | jd fD]}t|| |}t| |||;d d g}t j ||} t||| }t||||y)Nrrr)rerjrrrr)onetwothreerrOrrB)r"rCr6rlrrstakerMrrrXrrr)rr& X_multiclass y_multiclassX_binaryy_binarylabels_multiclass labels_binaryy_names_multiclassy_names_binaryr>rmrnr y_names_irs rmrr sh!+1#"L,")|RS!TL,!#11,?LLA-.HLA-.H,_lKL((CH/ENM!2LAWW]H5N8^45H 00<<|5GHI!H 1g!7>>##67 HI1$9EB )!R G HH GMWW]H5N/hOH!(HdOLroc t\}}t||dd}tjj d}|j d|j d}t||}tjj d}t|}t|}t|t||tvrDtj|d|z|j dt|zg}|j}n|}|j|||j|} |j||j!t"|j|} t%| | d|y)Nrrrrrrry)rorrsrrrrrrr\rNr0r#r6rrrrrT) rregressor_origrmrYrrn regressor_1 regressor_2rpred1rs rmrr> s+  DAq!.!CR&9A ))   "C AAGGAJ 'A!.!4A ))   "C'K'K[![! "" YY1q53;;qs1v;#>>? @ TT OOAr    "EOOAryy'(    "EE5tT:roc t\}}|j|}t|}t|}t ||}t ||}|t vrctjjd}tj|d|z|jdt|zg}|j}n|}|rt|||g\}}}t|dst|drd|_|dk(rd|_t%t&d|d  5|j)||dd dddt+||j)|||j)|j-|j-|j/|} | j0|j0k(sJt3|j4j6s|j9||d kDsJyy#1swYxYw) NrrralphasalpharPassiveAggressiveRegressorr2r3r*rr)rorr7rrrrNrsrrr0rr#r6rYrrCr[rUrr\rrrrMrrr) rrrrrmrnrrrrs rmrrZ s  DAq A aAn%I!)Q/A!)Q/A ""ii##A& YY1q53;;qs1v;#>>? @ TT ,aBZ81b 9h 'GIw,G  ++  dV$$ $  !  a3B  !Y MM!R MM!((*biik*   q !F <<288 ## # I  - - 8 8q"%+++ 9) ! !s GG$ctjjd}t|}|j d}t ||}t ||dddf}|j||gd}|D]}t||sJy)Nr)rarr)rrr) rsrrrnormalrrrr)rrrrrmrnrrs rmrr s ))   "Cn%I   A!.!4A!)Qq!tW5A MM!Q GE1 9i0001rocxt|jjrddg}ndg}|D]}t|dd\}}t ||dd\}}}} t|j j rt||}t||}ttj|}|dk(rdd d } ndd d d } t|j| } t| d r| jdt| dr| jdt| dr| jdt| dr| jdt| | j||| j!|} t|jj"rqtj$| dk(dkDrJy)Nrrrrc)rrjrrrkrjg-C6?)rrB)rrBrrn_iterrrrrmin_weight_fraction_leafr)rn_iter_no_change)rgףp= ?)rMrrr"r3rrr0r#rsrrrrr\rrrr) rr&r> n_centersrmrnrr#r_rmrrrs rmrr s 00<<q63#/ )!L1+; qCa, (& O $ / / 8 80F '2G '*+ >#/L#6:L?+66L6Q :x (  ! ! ! - :z *  ! !4 ! 0 :9 :  ! !4 ! @ :1 2  ! !2 ! 6$w(##F+(88CC776Q;'$. ..G#/roct|}t|dr|jdt|dr|jdt||j |||j |}|jd|j |||j |} t || d t ||d kDsJy) Nrrrrrrbalancedrweighted)average)rrrr\rrr-) rr&rr_r#rmrrry_pred_balanceds rm'check_class_weight_balanced_classifiersr s'Jz8$S)z:&t,Z NN7G$    'Fz2NN7G$ ((0O FOZ @8 D  rocJtjddgddgddgddgddgg}tjgd}t|}t|dr|j d t|d r|j d t|d r|j d t ||j d|j ||jj}t|}tttj|}|tj|dk(|zz |tj|dk(|zz d}|j ||j ||jj} t|| d|zy)z4Test class weights with non-contiguous class labels.rgrrR)rBrBrBrrrrrrrr'rr)rrrBr)rBrz>Classifier %s is not computing class_weight=balanced properly.r*N)rsrrrrr\rcoef_rzr#rrr7rT) rrrmrnr coef_balancedrerr coef_manuals rmrr s} 4,q D$<#sc3ZPQA "#A~&Jz8$ T*z:&t,z4 #Z z2NN1a(..335MAIc"))A,'(I qAv2 3 R94 5L|4..A&,,113KPSWWroc tdd\}}t||t}t|}t ||}t ||j }t|}|j|||j }|jD]I\}} ||} tj| tj| k(r7Jd|d|d| d| d y) Nrryrzrrcz, should not change or mutate the parameter z from z to z during fit.) r"rr0rrr\rrrrjoblibhash) rrrmrnriparamsoriginal_params new_params param_nameoriginal_value new_values rmr}r} s 1 3DAq!.!JGAn%I!)Q/AY ! ! #Fv&OMM!Q%%'J&5&;&;&=  " Nz* {{9%^)DD Z < D  roc* t|}tt|jdryt t|j}dt|j DDcgc] }|D]}| }}}tt|t|z t|z }t|Dcgc]}|jdr|c}}|rJd|dt|dy#t$rtd|dwxYwcc}}wcc}w) zCheck setting during init.rcz9 should store all parameters as an attribute during init.r]Nc32K|]}t|ywr4)rS)r5parents rmr7z2check_no_attributes_set_in_init..>sVFi/VsrYzR should not set any attribute apart from parameters during init. Found attributes r) rrrr.rwrS__mro__setrrsorted) rrri init_params params_parentr$parents_init_params invalid_attrrZs rmr{r{,s# .) tI'')>?DO445KWd9o>U>UV "   tI'#k*::SAT=UULRT__S=QRSL  % ' |'  W X   Ss C.*D 2D D.Dc ntjddgddgddgddgddgddgddgddgddgg }tjgd}t||}t|}|j |||j |}|j tj|jsJ|j |}t||tjtj|}tj|jsJ|j |}t||y)NrrBr) rBrBrBrrrrrr)rsrrrrrrr rnrrWrrr)rrrmrnr6 pred_origrs rmrrMs  H H H F F F H F H  A ,-A!.!4A  CGGAqM AILLN ??399 %% % ;;q>DtY' ,,v||C( )C ??399 %% % ;;q>DtY'roctjddgddgddgddgddgddgddgddgddgddgddgddgg }t||}tjgd}t||}dD]}t |||||y)NrrrBrr) rBrBrBrrrrBrBrBrrr NotAnArrayPandasDataframe)rsrrr"check_estimators_data_not_an_arrayrrrmrnobj_types rmrrps  F F F F F F F F F F F F  A ".!4A 56A!.!4A5Q*4AxPQroczt\}}t||}t||}dD]}t|||||y)Nr)rorrrrs rmrrsG  DAq!.!4A!.!4A5Q*4AxPQroc|tvr tdt|}t|}t|t||dvrt dj ||dk(r=t tj|}t tj|}nv ddl } tj|}|jdk(r| j|d}n| j|d}| jtj|d}|j|||j|} |j|||j|} t!| | d | y#t$r td wxYw) NzoSkipping check_estimators_data_not_an_array for cross decomposition module as estimators are not deterministic.rzData type {0} not supportedrrrBFrzDpandas is not installed: not checking estimators for pandas objects.rry)rNrQrr\rUrrqrsrtrrrrrrrrT) rrrmrnr estimator_1 estimator_2rX_rrrs rmrrsZ "" %  'K'K[![!886==hGHH< A ' A '  ABww!|YYrY.\\"5\1bjjm%8BOOB    #EOOAq    "EE5tT: V  s !A5E,,Fcd t|y#t$r}td|d|d|d}~wwxYw)z+Checks whether the estimator can be cloned.z Cloning of  failed with error: rN)rrWr)rrr\s rmrwrws@R n R{4&0DQCqIJPQQRs  /*/czt|} t|y#t$r}td|d|d|d}~wwxYw)z0Check that the estimator has a functioning repr.zRepr of rrN)rreprrWr)rrrir\s rmrzrzsHn%IO Y Oxv-A!AFGQNOs  :5:cR|j}t|}tt5|j |usJt |j d|j } d}d}t|jjDcgc]}||s |j}}t|jjDcgc] }||s |} }|j} | D cic] } | |vr| | | } } |di| }|j} | D]}ttt t"t$t'dt&h}|j)t*j,jt'|j.|vxst1|j.}|sbJd|jd|j2dt'|j.j2d|jd t5d |Dd |j| j7vr0|j."Jd |jd|j2d 9| |j}t9|t*j:rt=||j.zd|jd}t?|r||j.urJ|||j.k(rJ| dddycc}wcc}w#ttf$r YdddywxYwcc} w#1swYyxYw)Nrqr]c|jdk7xrO|j|jk7xr4|j|jk7xr|j|j k7Sz*Identify hyper parameters of an estimator.rvrr VAR_KEYWORDVAR_POSITIONALrrrs rmparam_default_valuezCcheck_parameters_default_constructible..param_default_valuesXFFf$-!--/-!"2"22- QWW, roc|jdk7xrO|j|jk7xr4|j|jk7xr|j|j k(Srrrs rmparam_requiredz>check_parameters_default_constructible..param_requiredsZFFf$ -!--/ -!"2"22 - QWW, roz Parameter 'z' of estimator 'z ' is of type z which is not allowed. 'z(' must be a callable or must be of type c34K|]}|jywr4r)r5r.s rmr7z9check_parameters_default_constructible..7s?t}}?srzEstimator parameter 'zT' is not returned by get_params. If it is deprecated, set its default value to None.z Parameter z> was mutated on init. All parameters must be stored unchanged.r;) rhrrZrVrrfrwrrrrrArUrrr rrrlr.updaters sctypeDictrr<rdrrrsrrWrD)rr Estimatorriinitrrrrequired_params_namesdefault_value_params old_paramsr$rr init_param allowed_types allowed_value param_value failure_texts rmrrsj((In%I - 0uK##%222y))+@)BTBTU(   $!*$ : : A A C%~VWGX% !% %T?55<<>$BUVWBX$ $))+ $ -- :e$ $  , , %%'.3 KJT M  !5!5!7 8Z''(M9- ++, ! joo./&&'} **+4456OO$$L???@ C =fkkm3!))1+JOO+<=!**+,JJ1  1K+rzz2"; 0B0BC! 12;;!-&**<*<<JlJ<&**<*<<JlJ: .n%I ;D IIt{{rA "9b 1BY"!.!4A MM!R 66"**Y../14 5 ? 5rocht|}t|dr|tvrgdgdgdgdg}ddgdd gdd gd dgg}n%td gd gdgddd\}}t ||}t |d|j |||tvr|jD] }|dk\r Jy|jdk\sJyy)Nr)rRrRr)rrRrR)@rr)rrb@rgɿg?g?gg333333?rrrrrrrB)rrrNr"rr\rr )rrrirmriter_s rmrrsn%Iy*% & & /?OTA+SzC;d DB"I. EAr*.!.sNtt{((**Ns)rrr r)rrr\shallow_paramsrs @rmrrsL nA\\u\-N,,D,)K N~7K7K7MN NN Nroc t|}|jd}d}|jdi||jd}t|j t|j k(sJ||j D]\}}|||urJ|t j t jdg}t|} |j D]} || } |D]} | | | < |jdi| |jd}t| j t|j k(sJ||j D]\}}| ||urJ|| | | <y#ttf$r} | jj}tjdj|| |dj|}|}|jd} t|j t|j k(sJ|j D]\}}|||urJn$#t $rtj|YnwxYwYd} ~ d} ~ wwxYw)NFrz>get_params result does not match what was passed to set_paramszn{0} occurred during set_params of param {1} on {2}. It is recommended to delay parameter validation until fit.z9Estimator's parameters changed after set_params raised {}r;)rrrrrrrsrrrArUrhrdrtrurr)rrri orig_paramsrC curr_paramskv test_values test_paramsr default_valuerr\e_typechange_warning_msgparams_before_exceptions rmrrsn%I&&E&2K JCI';'&&E&2K {! "c+*:*:*<&= =BsB =!!#(11~"'C'"(FF7BFFD)K;'K!&&(#0 #J/  4E&+K # 4$ $$3{34(222> ;++-.#k6F6F6H2IIN3NI'--/4DAq&q>Q.33.4? 4B#0 JG#0 z* 6-- ,,2F6:t,LPVV# +6''222> 66;;=>##((*C!, 1 1 3?16q9Q>>>?%6MM"456- 6sD4FI9A!I43AI I  I4 I+ (I4*I+ +I44I9ct\}}t||}t|}d}d}t|js.t t ||5|j||dddyy#1swYyxYw)NzWhen a classifier is passed a continuous target, it should raise a ValueError with a message containing 'Unknown label type: ' or a message indicating that a continuous target is passed and the message should include the word 'continuous'zUnknown label type: |continuousr)rorrrMrr[rUr)rrrmrnr\rrCs rmrr1s|  DAq!.!4A nA  ,C A; $ $ Jc7 ;  EE!QK   %  s A--A6c ddg}tddd|dd\}}t||d d \}}}}t|} t| d rt| d r| j ||| j |ddd fj d} | j|j d} t| t| } } t| | yyy#t$rtjtj| Dcgc]}| | |k(jncc}wc}}tj|}t!|tj"t%|YywxYw)N)rr)rrrrrrT)rerjrfrrrC皙?rrrrBra)decimals)r"r3rrrrrrrrVrrsrrrr9rWrr#)rrrrmrnrr#r_rmriab rank_proba rank_scoregroupgrouped_y_score sorted_idxs rmrrEsb vG   DAq(8 1!($GVWfn%Iy-.79o3V gw'  # #F +AqD 1 7 7 7 D  ' ' / 5 5r 5 B!)!hqkJ  G %j* =4W. G !hh<>IIjNFFMM'7#$  9f % * 6*622FY MM'7# 9f %3F3F;Jz7+   "++1"((:#3#34888"((2::.222 (vd^d^@GGO  s.&I'ctjjd}t|}t |d|j vr|j dd}|jd|df}t||}t|r|j|}n|jd d| }t||}t|jr. t|t|j j"d |j'|| t|y#t$$rY*wxYw#t$$r}t%d |d}~wwxYw) Nrdr3Fr4rrr5rrrQz) passes check_is_fitted before being fit!zFEstimator fails to pass `check_is_fitted` even though it has been fit.)rsrrrr\rrrrr rrrMrr^rrhrdr(r)rrrrirermrnr\s rmr r sD ))   #Cn%IYy++--.I s)Q 0A!)Q/AN# JJIJ & KKAAIK 6!)Q/A ''  I & &&//01  MM!Q "      T  s*-D D, D)(D), E5 EEctjjd}t|}t |d|j vr|j dd}|jd|df}t||}t|r|j|}n|jdd| }t||}t|d rJ|j||t|d sJ|j|jd k(sJy) Nrr3Fr4rrr5rrQn_features_in_rB)rsrrrr\rrrrr rrrrrDr)rrrrirermrns rmr r  s ))   "Cn%IYy++--.I s)Q 0A!)Q/AN# JJIJ & KKAAIK 6!)Q/Ay"233 3 MM!Q 9. // /  # #qwwqz 11 1roc8tjjd}t|}t |d}|j d|df}t ||}d} |j|dy#t$r tfd|DsYdydwwxYw)Nrrrr5)z1requires y to be passed, but the target y is Nonez.:s?c3#b'>?s) rsrrrr\rrrrUr@)rrrrirermexpected_err_msgsrGs @rmrr$s ))   "Cn%IYI s)Q 0A!)Q/A  a ?->??H@sA00 B9BBc vt|}|jjxs|jj}|r |jryt j jd}t|}t|d|jvr|jdd}|j|df}t||}t|r|j|}n|jdd| }t!||}d j#| } |j%||t'|d sJ| |j(|j*d k(sJ| gd} |ddd gf} d} t-j.| } d|j*d d} | D]a} t'|| st1|| }| dk(r t3||}t5t6| | j#|| 5|| dddct'|dsyt|}t9|r(|j;||t j<|n|j;|||j(|j*d k(sJt5t6| 5|j;| |dddy#1swYxYw#1swYyxYw)Nrr3Fr4rarrrrQz`{name}.fit()` does not set the `n_features_in_` attribute. You might want to use `sklearn.utils.validation.validate_data` instead of `check_array` in `{name}.fit()` which takes care of setting the attribute.rrDrB)rrrrra `{name}.{method}()` does not check for consistency between input number of features with {name}.fit(), via the `n_features_in_` attribute. You might want to use `sklearn.utils.validation.validate_data` instead of `check_array` in `{name}.fit()` and {name}.{method}()`. This can be done like the following: from sklearn.utils.validation import validate_data ... class MyEstimator(BaseEstimator): ... def fit(self, X, y): X, y = validate_data(self, X, y, ...) ... return self ... def {method}(self, X): X = validate_data(self, X, ..., reset=False) ... return X z'X has 1 features, but \w+ is expecting z features as inputrr)rrrrrrM)rMrrrrrsrrrr\rrrrr rrrrrrDrtextwrapdedentrfrr[rUrrr)rrrkis_supported_X_typesrrirermrnrrX_badrCrcallable_methods rmrr>s N #D??66U$//:U:U 4#5#5 ))   "Cn%IYy++--.I A 'A!)Q/AI JJIJ & KKAAIK 6!)Q/A VV&  MM!Q 9. /88 /  # #qwwqz 1:7: 1M a!fIEG(oog&G 4QWWQZL@R SC #y&) !)V4 W %o;O  c7>>tF>+S  # E " # # # 9m ,n%IYaBIIaL9a#  # #qwwqz 11 1  # &(eQ'((! # # ((s' J"J/"J, /J8c t|ds Jd|dd}t|}t|jtt dfsJ|t|j tsJ|t|jtt dfsJ|t|jtt dfsJ|t|jtt dfsJ|t|jtsJ|t|j t"sJ|t|j$t"sJ|t|j&t"sJ|t|j(t"sJ|t|j*t"sJ|t|j j,t"sJ|t|j j.t"sJ|t|j j0t"sJ|t|j j2t"sJ|t|j j4t"sJ|t|j j6t"sJ|t|jj8t"sJ|t|jj:t"sJ|t|jj<t"sJ|t|jj>t"sJ|t|jj@t"sJ|t|jjBt"sJ|t|jjDt"sJ|t|jjFt"sJ|t|jjHt"sJ|t|jj2t"sJ||jt|jjJt"sJ|t|jjLt"sJ|t|jjNt"sJ||j+t|jjJt"sJ||j,t|jjPtRsJ|yy)z$Check that estimator tags are valid.__sklearn_tags__rcz does not have `__sklearn_tags__` method. This method is implemented in BaseEstimator and returns a sklearn.utils.Tags instance.ztTag values need to be of a certain type. Please refer to the documentation of `sklearn.utils.Tags` for more details.N)*rrMrsrlrr.rrKrrHrrJrrLrrIrrrrrrr one_d_labels two_d_labelsrrrrrr rrOrrr three_d_arrayrrrrr1)rrirrks rmryrysW 90 1 TFS S 1  V  I D d))Cd+< =FwF = d&& 3w> 5 doo// 6?? 6 doo,,d 3sJ|j<j@tBk(sJtE|j<| |jF}|jIdr2d|vs.|jKdsd|jLvrt9d|dg}dD]@}t7||stO||}|dk(r tQ|| }|jS||fB|D]G\}}t-j.5t-j0d d t2d || dddI| ddddft#| D cgc]} d|  c} df| dddtU| dddfg}|jWjYDcic] \}}d|vr||}}}t[d |j]D}|D]\}}|j%| |d}t_j`d!|}|D]+\}}tct8||d"#5||ddd-t7|d$r|rqt|}te|r*tjf| }|ji| | |%n|ji| | tct8|&5|ji|| dddy#t$r tdwxYwcc} w#1swYxYw#1swYxYwcc} wcc}}w#1swY xYw#1swYKxYw)'NrHpandas is not installed: not checking column name consistency for pandas)r4rcol_FcolumnsrzrrQerrorz#X does not have valid feature namessklearn)messagerrmodulefeature_names_in_zTEstimator does not have a feature_names_in_ attribute after fitting with a dataframerrrrcz2 does not document its feature_names_in_ attribute)rrrrrrrrrrz.Zs L5$ LszBThe feature names should match those that were passed during fit. z did not raiserrrrM)5rrrQrMrrrrrsrrrr\rrrrrrr rrrtrfilterwarningsrvrrrUrsrdrryrNrWrrrrrfrrXr5rrr@rrescaper[rrr)rrrrkrMrriX_origrerfrnamesrmrnrrrrOrY invalid_namesrrrearly_stopping_enabled invalid_nameadditional_messagerN expected_msgrs rm(check_dataframe_column_names_consistencyrqs  N #D??66U$//:U:U 4#5#5 ))   "Cn%IY ZZXZ &F &y& 9F"LLIz HH% *;> >  & & , , 66 6y22E:!++Kz*K';+?+? +K )?)? @P Q  M8y&) !)V4 W %o;Ofo678"# 6  $ $ &   # #=$   1I   ttTU,1*,= >qqc " >&  "1IB3uQRy>BRRT U  M $..0668 C s " U F ! LFMMO LL,9,( ( Q 5 Ayy Q!" $ * LD&,4&8O u    y-04J .)  #iilG  ! !!Q ! 8  ! !!Q ' Jl 3 ,  ! !% + , ,3,[   V   *=`   ?  " , ,sMQ Q00Q5!&R' R0R5 R:R'Q-5Q?R R$ 'R1 ct|}|jjr |jryt dgdgdgddd\}}t j |}t|}t||}|jd}t||}|tvrMtjtj|tj|f}|ddddfxxdzcc<|j || }t|D cgc]} d |  } } t!t"d 5|j%| dddddd|j%| } | Jt'| tj(sJ| j*t,k(sJt/d | DsJt'|t0r|djd} n|jd} t3| | k(sJd| dt3| ycc} w#1swYxYw)NrrrrrrrrBrfeaturez'input_features should have length equalrMc3<K|]}t|tywr4)rsr)r5rs rmr7z:check_transformer_get_feature_names_out..sCz$$Cr8 Expected  feature names, got )rMrrrr"r6rlrrrr\rNrsrrtrr[rUrvrsrryrNr rlr#) rrrkrmrnrrfr X_transformrinput_featuresfeature_names_outn_features_outs rm'check_transformer_get_feature_names_outr{ys $ %D ?? & &$*<*< I&  DAq &&q)A()K!+q1AJ[! B "" UU2::a="**Q-/ 0 3Q36 a ++A+4K-2:->?sm?N?  "K L?)).1*=>?$99.I  (( ( ' 44 4  " "f ,, , C1BC CC C+u%$Q--a0$**1-  !^ 3 N##7>HcP ddl}t|}|jj r |j rytdgdgdgddd\}}tj|}t|}t||}|jd }t||}|tvrMtj tj"|tj"|f}|dddd fxxdzcc<t%|D cgc]} d |  } } |j'|| d } |j| | } t%|D cgc]} d|  } } t)t*d5|j-| ddd|j-}|j-| }t/||t1| t2r| djd }n| jd }t5||k(sJd|dt5|y#t$r tdwxYwcc} wcc} w#1swYxYw)Nrr[rrrrrrrBrFr^rbadz0input_features is not equal to feature_names_in_rMrurv)rrrQrMrrrr"r6rlrrrr\rNrsrrtrrr[rUrvrWrsrlr#)rrrrkrmrnrrfrrfeature_names_indfrwinvalid_feature_namesfeature_names_out_defaultfeature_names_in_explicit_namesrzs rm.check_transformer_get_feature_names_out_pandasrs6  $ %D ?? & &$*<*< I&  DAq &&q)A()K!+q1AJ[! B "" UU2::a="**Q-/ 0 3Q36 a +0+<=a#aS == a!1 >B++B"+5K16j0AB1s1#YBB  "T UA))*?@A!, A A C&1&G&G'#02QR+u%$Q--a0$**1- ( )^ ; N##7 CAAs#G:; H= HH:HH%c tjjd}|jd}|j ddd}t ||}t |}|jdj}|r_|jj}t|t|z }t|t|z } d|d |d | } ||k(sJ| td d i} gd } |D]} |j| }|dk(rtd|Dr$td|Drtd| d|dd| d|d}|d| d} t|}|jd i| | i| D]}t!||s|d| d} t#t$|| 5|j&j(s|j&j*rt-|||nt-||||ddd|Dcgc] }t/|}}|D]} t1|}|jd i| |i| D]}t!||s|d| d} t#t$|| 5|j&j(s|j&j*rt-|||nt-||||dddy#1swY]xYwcc}w#t2$rYwxYw#1swYxYw)NrrrrrcFrz>Mismatch between _parameter_constraints and the parameters of z%. Consider the unexpected parameters z% and expected but missing parameters BadTyper;)rrrlrrc3fK|])}t|txr|jtk(+ywr4)rsrEr.r r5rYs rmr7z)check_param_validation..s0  z8 , LH1L L /1c3fK|])}t|txr|jtk(+ywr4)rsrEr.r rs rmr7z)check_param_validation.. s0  z8 , HD1H H rzThe constraint for parameter rzc can't have a mix of intervals of Integral and Real types. Use the type RealNotInt instead of Real.zThe 'z' parameter of z must be .* Got .* instead.z@ does not raise an informative error message when the parameter z% does not have a valid type or value.zc does not have a valid type. If any Python type is valid, the constraint should be 'no_validation'.ra  does not have a valid value. Constraints should be disjoint. For instance [StrOptions({'a_string'}), str] is not a acceptable set of constraint because generating an invalid string for the first constraint will always produce a valid string for the second constraint.)rsrrrrrrMrrrQrr.r@rUrrrr[r?rrRrSrfrAr@r)rrrrmrnrkestimator_paramsvalidation_paramsunexpected_paramsmissing_paramsrparam_with_bad_type fit_methodsr constraintsrrirrY bad_values rmcheck_param_validationrs ))   "C  !A Aqr "A!.!4A N #D%00e0<AAC*AAFFH 12S9I5JJ-.5F1GGLTFS44E3FG##1"2 4  !$44=g=42$y"b13HK&S9 $;;JG / )   )   )  / |4vF$$   OD69TUf# $I K  .)   A ,?@A! 5F9f-&< DD  -UGL 5##00D4D4D4Q4Q.GIv.q1.GIv.q!4  5 5 5*FQQzz2Q Q% 9J 6zB  !I ;J #: ;% 9y&1f!!+ -""1P9''448H8H8U8U2 62152 621a8 99 9 9oS9V 5 5R '  (99s2!AK K K'AK+ K  K('K(+K4 c` t|}|jjr |jrytj j d}t|}|jd t|  |jddd t|  t| fd} fd}||d}|jD]e\}t|}t|s||} tvr| d} |j!d ||} tvr| d} t#| | gy) Nrrrrrcctvr"|jjS|jjSr4)rNrr)r6rmrrns rmfit_then_transformz6check_set_output_transform..fit_then_transformdsD & &771a=**1a0 0wwq!}&&q))roc(|jSr4)rl)r6rmrns rmrlz1check_set_output_transform..fit_transformis  A&&ro)rrlrr)rMrrrrsrrrrrrrr\rrrNrrU) rrrkrrrrltransform_methodstransform_methodX_trans_no_settingX_trans_defaultrmrns ` @@rmcheck_set_output_transformrTs< $ %D ?? & &$*<*< ))   "C()K  !A!"2A6A Aqr "A!"2A6A[!* '(&#4"9"9";JK( {D) -k: & &!3A!6 3*;7 & &-a0O %%7I#Jroci}d||fd||fd||fd||fg}tfddDra|D]\\}}} j|||tvrj| |\} } nj| } | j f||<^d|fd|fg}t d rO|D]J\}} |tvrj | |\} } nj | |} | j f||<L|S) zGenerate output to test `set_output` for different configuration: - calling either `fit.transform` or `fit_transform`; - passing either a dataframe or a numpy array to fit; - passing either a dataframe or a numpy array to transform. zfit.transform/df/dfzfit.transform/df/arrayzfit.transform/array/dfzfit.transform/array/arrayc36K|]}t|ywr4)r)r5methrs rmr7z-_output_from_fit_transform..s G$7; % Gs)rrzfit_transform/dfzfit_transform/arrayrl)r rrNrrvrrl) rrrmrrnoutputscasescasedata_fitdata_transformrrYrus ` rm_output_from_fit_transformrsHG B' !2q) !1b) $a+  E  G2F GG  K    OOHa (**(22>1E %//?$k&G&G&IJGDM K R " E{O, KJD$**(66tQ? %33D!<$k&G&G&IJGDM  K Nroc|\}} |\} } || sJ|jdr|nd} ||| | } || | y#t$r}t|d|d||d}~wwxYw)aCheck if the generated DataFrame by the transformer is valid. The DataFrame implementation is specified through the parameters of this function. Parameters ---------- name : str The name of the transformer. case : str A single case from the cases generated by `_output_from_fit_transform`. index : index or None The index of the DataFrame. `None` if the library does not implement a DataFrame with an index. outputs_default : tuple A tuple containing the output data and feature names for the default output. outputs_dataframe_lib : tuple A tuple containing the output data and feature names for the pandas case. is_supported_dataframe : callable A callable that takes a DataFrame instance as input and return whether or E.g. `lambda X: isintance(X, pd.DataFrame)`. create_dataframe : callable A callable taking as parameters `data`, `columns`, and `index` and returns a callable. Be aware that `index` can be ignored. For example, polars dataframes would ignore the idnex. assert_frame_equal : callable A callable taking 2 dataframes to compare if they are equal. rNr_rz, does not generate a valid dataframe in the z] case. The generated dataframe is not equal to the expected dataframe. The error message is: )rr)rrroutputs_defaultoutputs_dataframe_libis_supported_dataframecreate_dataframeassert_frame_equalrfeature_names_defaultdf_transfeature_names_dataframe_libexpected_indexexpected_dataframer\s rm_check_generated_dataframersJ&5"G ",A)H) !( ++ + #mmD1UtN)4N8%78 f@G001s 4   s A A" AA"c t|}|jjr |jrytj j d}t|} |jd} t|| } |jddd} t|| } t| t| jdD cgc]} d|  } } t| jdD cgc]} d |  }} || | | }t| jd }t!||| || }|d k(r&t| j| }t#}nt| }t%|} |5t!||| || }ddd|D]}t-|||||||||ycc} wcc} w#1swY3xYw#t&$r7}|j)}t+|}|d|vs d|vsJ|Yd}~yd}~wwxYw)aCheck that a transformer can output a DataFrame when requested. The DataFrame implementation is specified through the parameters of this function. Parameters ---------- name : str The name of the transformer. transformer_orig : estimator The original transformer instance. dataframe_lib : str The name of the library implementing the DataFrame. is_supported_dataframe : callable A callable that takes a DataFrame instance as input and returns whether or not it is supported by the dataframe library. E.g. `lambda X: isintance(X, pd.DataFrame)`. create_dataframe : callable A callable taking as parameters `data`, `columns`, and `index` and returns a callable. Be aware that `index` can be ignored. For example, polars dataframes will ignore the index. assert_frame_equal : callable A callable taking 2 dataframes to compare if they are equal. context : {"local", "global"} Whether to use a local context by setting `set_output(...)` on the transformer or a global context by using the `with config_context(...)` NrrrrrcrBrrrrrlocal)transform_outputz% output does not support sparse data.z.The transformer outputs a scipy sparse matrix.)rMrrrrsrrrrrrrr\rrrrrrrU capitalizerr)rr dataframe_librrrcontextrkrrrmrnrr~rrtransformer_defaultrtransformer_dfcontext_to_use outputs_dfr\capitalized_lib error_messagers rm%_check_set_output_transform_dataframers!J $ %D ?? & &$*<*< ))   "C()K  !A!"2A6A Aqr "A!"2A6A[!+0+<=a#aS =="' "3 4QuQC[ 4E 4 !%5U CB ,77)7L01DdArSTUO'{+666O${+'G   T3ND!RQRSJ T  "    D ! t  "     7> 4 T T '224A D E V?=P    Q s<< F$$ F)*F:,F.<F:.F73F:: G:-G55G:c  ddlt||dfdfdjj |y#t$r tdwxYw)Nrz0pandas is not installed: not checking set outputrc0t|jSr4rsr)rmrs rmrkz<_check_set_output_transform_pandas_context..RAr||)Droc.j||d|S)NF)r_rzr)r)rmr_rrs rmrkz<_check_set_output_transform_pandas_context..Ss2<< wU%4@4 rorrrrr)rrrQrtestingr)rrrrs @rm*_check_set_output_transform_pandas_contextrHsXK* D ::88  KIJJKs 4A ct||dyNrrrrs rm!check_set_output_transform_pandasr[.t5EwOroct||dyNglobalrrs rm$check_global_output_transform_pandasr_.t5ExProc  ddlddlm}fd}t ||dfd|||y#t$r t dwxYw)Nr)rz0polars is not installed: not checking set outputct|tjr|j}j ||dS)Nr)schemaorient)rsrsrrr)rmr_rpls rmrzD_check_set_output_transform_polars_context..create_dataframejs2 grzz *nn&G||Age|<.trror)rpolars.testingrrrQr)rrrrrrs @rm*_check_set_output_transform_polars_contextrcsRK5= * D)- KIJJKs (=ct||dyrrrs rm!check_set_output_transform_polarsr{rroct||dyrrrs rm(check_global_set_output_transform_polarsrrroctjjd}t|}t |d}t |d|\}}t ||}|dvrtj|}t|drtj|d<t|r|j|}n|jdd | }t||}|j}|jd |j!||t|d r|j#||j$j&rJt)||y)aCheck that estimators able to do inplace operations can work on read-only input data even if a copy is not explicitly requested by the user. Make sure that a copy is made and consequently that the input array and its writeability are not modified by the estimator. rrr)rerfrj)Lasso ElasticNetMultiTaskElasticNetMultiTaskLassomissing_valuesrLrrrQF)writerN)rsrrrr\r"rr rrr rrrrzsetflagsrrflags writeablerT) rrrrirermrYrnX_copys rmcheck_inplace_ensure_writeablers ))   "Cn%IYI  ac JDAq!)Q/A OO   a y*+&&$I JJIJ & KKAAIK 6!)Q/A VVXFJJUJ MM!Qy+&Aww   Avroct|}t|j}dddtjddgdgigg}|D],}|Dcic]}||}}|di|}|j di|.ycc}w) z3Check that init or set_param does not raise errors.rg@ helloworldrrrBNr;)r.rrrsrr) rrrrsmoke_test_valuesrrrr6s rmrrs^$I y ! , ,FS,#s0Dqc2rR"%,23Sc5j3 3%*% $$%3s A2ct|}t|tddddd\}}dj|}t j |}t td| 5|j||d d d y #1swYy xYw) zCheck that if the classifier has tags.classifier_tags.multi_class=False, then it should raise a ValueError when calling fit with a multiclass dataset. This test is not yielded if the tag is not False. rrrBr)rerrgn_clusters_per_classrja The estimator tag `tags.classifier_tags.multi_class` is False for {name} which means it does not support multiclass classification. However, it does not raise the right `ValueError` when calling fit with a multiclass dataset, including the error message 'Only binary classification is supported.' This can be achieved by the following pattern: y_type = type_of_target(y, input_name='y', raise_unknown=True) if y_type != 'binary': raise ValueError( 'Only binary classification is supported. The type of the target ' f'is {{y_type}}.' ) rJz(Only binary classification is supported.rN) rr\r#rrKrLr[rUr)rrrirmrnrs rmrrs n%IY   DAq  D oog&G Dg   as #A??B)rr)NNN)r&dict[str, str] | Noner%Literal['xfail', 'skip', None]r4)r&rreturnztuple[bool, str])rrr&rr%r)rrr&Callable | None)NF) rrr&rrHzLiteral['warn'] | NonerIzLiteral['raise', 'warn'] | NonerJr)NrFF)NrF)F)FrF)T(r __future__rrrrKrt contextlibrrzr functoolsrrinspectrnumbersr r typingr r rnumpyrsscipyr scipy.statsr sklearn.baserrrrrrrrrrrrbrbaserrrrr datasetsr!r"r#r$r% exceptionsr&r'r(r)linear_model._baser*metricsr+r,r-metrics.pairwiser.r/r0model_selectionr1r2r3model_selection._validationr4rr5 preprocessingr6r7utilsr8utils._array_apir9r:r;r<r>rutils._param_validationr?r@rArC_missingrD_param_validationrErFrG_tagsrHrIrJrKrLrM_test_common.instance_generatorrNrOrPrrQrRrSrTrUrVrWrXrYrZr[r\ validationr]r^r_rkrnrrrrrrrrrrr)r#r1rDrr<r^rorqrrrVrrrrrrrrrrrrrArrrrvrrrr[r~r rtrrrrr rrrrrrrr|rrrrrrrrrrrrrrrHrrrrrrrwrrrrrrrrrFrrrrrr}r{rrrrrwrzrrrrrrrrrrrrr r r rrryrxrqr{rrrrrrrrrrrrrrrr;rormrsR W# "$"$       7CCLLNN5$1" 6 #DD    IH  -84-n,9^20'> 62$  ;%|Q59+/  *"2*" ) *"\GK2.C22F48+/ 9 92 9 ) 9~.2 ^ ^, ^B#+#',x($/0148t$ #( {48&,/6 ${  { 2 { $ {-{{ {|  WW*)$'B-( ) L  oIl  "1 h3;lON,-(+ )+ \=*/+/:=* 5+ 5-(!@)!@H-(CL)CLLRM%PP=+67'8'T (<-(5)5p-(1)1.<$-(!R)!RH-()))X%%P<$-(0)0"-(B)B"-( !) ! -( *) *X1v>>@%%P:44,D-(")".-(-1)-1`  2G2Gj-(,),8-(:N):Nz-()2-(73)73v-( -) --(X)X.-(! )! H:CGOGOT@,EPPL6-(&6)&6R-(*)*Z-(Q )Q h-(+)+\-( *) *-( ,) ,-(,),$..:-(7)7D77tMD-(;);6-(*//,)/,d 1 1 -()/))/X-()*-(%)%P-( ) B-()@-(()(D-(Q)Q0-(Q)Q-(+;)+;\RO|K~ *48 )X-( 1) 1F-().-(*)*<-(O)O-(50)50p-()&-()G))GX(PV9x$N244-(_()_(D2Pj,J,Z-`6ro9d-J`*Z:zW t&PQ0PQ-(*)*Z % #ro