`L i3 dZddlZddlZddlZddlZddlmZddlmZddl m Z ddl Z ddl m Z ddlZddlmZddlmZdd lmZdd lmZmZdd lmZdd lmZmZdd lmZmZm Z m!Z!ddl"m#Z#ddl$m%Z%m&Z&m'Z'ddl(m)Z)m*Z*ddl+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8dZ9dCdZ:GddeZ;e jxj{dee:ddfe:dfee:ddfeddfeddd d!"d#fe;d$fgd%Z>e8e?e'e&&d'Z@d(ZAe jxjd)e jxjd*d+ZCd,ZDd-ZEd.ZFd/ZGe?e e'eedgeGZHe jxj{d0eHe%1d2ZId3d4gZJd5ZKe'd6Dcgc] }eK|r|c}ZLe jxj{d6eLe%1d7ZMe'Dcgc]}eN|d8s |c}ZOe jxj{d0eOe%1d9ZPe jxj{d0e?e'e%1d:ZQe?e e'd6ee!ee d;<ed=>gZRe jxj{d0eRe%1d?ZSe jxj{d0eRe%1e jxj{d@e4e/e5e0gdAZTe jxj{d0e'e%1dBZUycc}wcc}w)Dz. General tests for all estimators in sklearn. N)partial) isgenerator)chain) LinAlgWarning) BaseEstimator)ColumnTransformer)ConvergenceWarning)enable_halving_search_cvenable_iterative_imputer)LogisticRegression) FeatureUnion make_pipeline)FunctionTransformer MinMaxScaler OneHotEncoderStandardScaler)all_estimators)_get_check_estimator_ids_get_expected_failed_checks_tested_estimators)SkipTestignore_warnings) (check_dataframe_column_names_consistencycheck_estimator!check_get_feature_names_out_error$check_global_output_transform_pandas(check_global_set_output_transform_polarscheck_inplace_ensure_writeablecheck_param_validationcheck_set_output_transform!check_set_output_transform_pandas!check_set_output_transform_polars'check_transformer_get_feature_names_out.check_transformer_get_feature_names_out_pandasparametrize_with_checksctD]<\}}dj|}|jjds7J|y)NzDBase estimators such as {0} should not be included in all_estimatorsbase)rformatlower startswith)name Estimatormsgs _/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sklearn/tests/test_common.py test_all_estimator_no_base_classr/@sJ)+8i R &, ::<**627C72 8cyN)xys r. _sample_funcr7Isr0ceZdZdZdZy)CallableEstimatorzqDummy development stub for an estimator. This is to make sure a callable estimator passes common tests. cyr3r4)selfs r.__call__zCallableEstimator.__call__Ss r0N)__name__ __module__ __qualname____doc__r<r4r0r.r9r9Ms   r0r9z val, expected)r6z_sample_func(y=1)r7worldg@)CzLogisticRegression(C=2.0)z newton-cgbalancedT) random_statesolver class_weight warm_startz]LogisticRegression(class_weight='balanced',random_state=1,solver='newton-cg',warm_start=True)zCallableEstimator()c$t||k(sJyr3)r)valexpecteds r.test_get_check_estimator_idsrKWs. $C (H 44 4r0)expected_failed_checksc~tttttf5||dddy#1swYyxYwNcategory)r FutureWarningr UserWarningr) estimatorcheckrequests r.test_estimatorsrVqs8 !3[-P  is 3<ctjtd5tt d}dddt sJy#1swYxYw)zTCheck that check_estimator with generate_only=True raises a deprecation warning.z$`generate_only` is deprecated in 1.6matchT) generate_onlyN)pytestwarnsrQrr r)all_instance_gen_checkss r..test_check_estimator_generate_only_deprecationr^}sL m+Q R "1  #   . // /   s AAzZignore:Since version 1.0, it is not needed to import enable_hist_gradient_boosting anymorezGignore:Importing from sklearn.utils._estimator_html_repr is deprecated.c~tjjtjg}t j |dd}|Dcgc]\}}}| }}}|dgzD]R}d|vsd|vr d|vrt|d }t|d d D]%}t||rJd j||Tycc}}w) Nsklearn.cyr3r4_s r.z-test_import_all_consistency..r0)pathprefixonerrorsklearnz.tests.zsklearn.externalszsklearn._build_utilsdummy)fromlist__all__r4z#Module '{0}' has no attribute '{1}') osrfdirnameri__file__pkgutil walk_packages __import__getattrhasattrr() sklearn_pathpkgsrcmodnamesubmodspackager+s r.test_import_all_consistencyrzsGGOOG$4$456L  *n D-11=1gqw1G1i[(   #6'#A  !W , Ww7GY3 D7D) +P+W+W, )  2s B9ctjjtjg}d}t j |dD]4\}}}d|vs|jds||vr!|tjvr4Jy)N)utilstestsr'conftestcyr3r4rbs r.rdz3test_root_import_all_completeness..rer0)rfrh.rc) rmrfrnrirorprqr*rl)ru EXCEPTIONSrcrws r.!test_root_import_all_completenessrsyGGOOG$4$456L7J .. >* 7A '>W//4:8M '//))) *r0ctjd}hd}tjj t j g}tj|dDcic] \}}}|| }}}}|jDcgc]%\}}|r||vr|j|s |dz|vr|'}}}|gk(sJdj|ycc}}}wcc}}w)Nz(?x) \.externals(\.|$)| \.tests(\.|$)| \._ >sklearn.datasets.datasklearn.datasets.descrsklearn.datasets.imagesr`)rgz.testszn{0} do not have `tests` subpackages. Perhaps they require __init__.py or a meson.build in the parent directory) recompilermrfrnrirorprqitemssearchr()HAS_TESTS_EXCEPTIONSresource_modulesrurcr+ispkglookup missing_testss r.test_all_tests_are_importablers:: * GGOOG$4$456L&33LT AtU e F "<<> D%  ( ($++D1 8O6 ) M B  F=)  s #C*Ccd}tjt|5ttdddtjt|5t tgdddy#1swY>xYw#1swYyxYw)Nz8Passing a class was deprecated.* isn't supported anymorerX)r[raises TypeErrorrr r%r-s r.test_class_support_removedrsl EC y ,,*+, y ,6!3 4566,,66sA+A7+A47Bc#KtD]}t|j}d|vr|jdd6d|vrh|jdd}|jj dvr8t j|t jjd  |d |vs|jd yw) N oob_scoreT)r bootstrapearly_stoppingr1)rn_iter_no_change> MLPRegressor MLPClassifierzMLP still validates in fitr)marksr)r) rset get_params set_params __class__r=r[parammarkxfail)rS est_paramsests r._estimators_that_predict_in_fitrs'); --/0 * $&&&F F  +&&dQ&OC}}%%)JJllv{{005Q0R : -&&&: :;s B1C 4C rS)idsct|trtjddt |vrtjdt t 5tjd5}t|jj|dddD]}dt|jvrJ dddy#1swY3xYw#1swYyxYw)Nz$ColumnTransformer is not tested hererzCEstimator does not support check_dataframe_column_names_consistencyrOT)recordz was fitted without feature names) isinstancerr[skiprrrQwarningscatch_warningsrrr=strmessage)rSrwarnings r.#test_pandas_column_name_consistencyrs)./ :;15P6  Q  = 2R  $ $D 1 V 4##,,i   RG5S=QQ QQ R RR  RRs*C/!C$C5CC CCensemblekernel_approximationcht|dry|jjdd}|tvS)Nget_feature_names_outTrr1)rtr>split"GET_FEATURES_OUT_MODULES_TO_IGNORE) transformermodules r.'_include_in_get_feature_names_out_checkrs7{34  # # ) )# .q 1F ; ;;r0rctt5t|jj|t |jj|dddy#1swYyxYwrN)rrQr#rr=r$)rs r.'test_transformers_get_feature_names_outr*sU = 2 /  ! ! * *K  7  ! ! * *K    s AAA$rcH|jj}t||yr3)rr=r)rSestimator_names r.+test_estimators_get_feature_names_out_errorr<s((11N%ni@r0ct|trtjd|jj }t ||y)NzFeatureUnion is not tested here)rr r[rrr=rrSr+s r.test_check_param_validationrDs6)\* 56    ' 'D4+r0F) sparse_outputz one-to-one)feature_names_outc|jj}t|dstjd|dt t 5t|jj|dddy#1swYyxYw)N set_outputz(Skipping check_set_output_transform for z!: Does not support set_output APIrO)rr=rtr[rrrQr rs r.test_set_output_transformrZsu    ' 'D 9l + 6tf=   = 2L"9#6#6#?#?KLLLs !A66A? check_funcc|jj}t|ds&tjd|jd|dt t 5||jj|dddy#1swYyxYw)Nrz Skipping z for z%: Does not support set_output API yetrO)rr=rtr[rrrQ)rSrr+s r.$test_set_output_transform_configuredrhs~    ' 'D 9l +  ++,E$8" "  = 2<9&&//;<<rs   &&-148 ) "8     #%89 ~& w '8 c "$?@ "'  6   34#,5-,5  7R0, M **#L 6;*  )A. /0')'-ERR*&" <"-0 .s3.4L  &') 738O+PC)% 6