
    bcg
                     D    d dl Z ddlmZ ddlmZ ddlmZ  G d d      Zy)    N   )CatBoostError)FactorUtils)_NumpyAwareEncoderc                   Z    e Zd Z	 	 	 ddZd Zd Zed        Zd Zd Z	d Z
d	 Zd
 Zd Zy)ExecutionCaseNc                 N   t        |      }|||d<   t               }d|v r|j                  t        |d                ||j                  |       t        |      |d<   ||nd| _        || _        t        j                  | j
                        | _        | j                  |       y)a)  
            Instances of this class are cases which will be compared during evaluation
            Params are CatBoost params
            label is a string which will be used for plots and other visualisations
            ignored_features is a set of additional feature indices to ignore
        Nlearning_rateignored_features )
dictsetupdatelist_label_ignored_featuresr   factors_to_ranges_string_ignored_features_str_ExecutionCase__set_params)selfparamslabelr   r
   case_paramsall_ignored_featuress          W/var/www/html/bid-api/venv/lib/python3.12/site-packages/catboost/eval/execution_case.py__init__zExecutionCase.__init__
   s     6l$+8K("u, ''K8J,K(LM' ''(89*./C*D&'$0eb!1%0%I%I$J`J`%a"+&    c                 z    || _         t        t        j                  | j                   dt                    | _        y )NT)	sort_keyscls)_paramshashjsondumpsr   _params_hash)r   r   s     r   __set_paramszExecutionCase.__set_params(   s(     DLLDN`!abr   c                 Z    |)|dk7  r#| j                   }||d<   | j                  |       y y y )Nthread_count)r!   r   )r   r)   r   s      r   _set_thread_countzExecutionCase._set_thread_count,   s8    #(:\\F%1F>"f% );#r   c                 N    |D ]   }|| v st        dj                  |             y )NzEFeature {} is in ignored set and in tmp-features set at the same time)r   format)r   eval_featureseval_features      r   _validate_ignored_featuresz(ExecutionCase._validate_ignored_features2   s3    )L//#[bbcopr r *r   c                 ,    t        | j                        S N)r   r!   r   s    r   
get_paramszExecutionCase.get_params9   s    DLL!!r   c                     | j                   S r1   )r   r2   s    r   	get_labelzExecutionCase.get_label<   s    {{r   c                     t        | j                        dk(  rdj                  | j                        S dj                  | j                        S )Nr   z
Ignore: {}z{})lenr   r,   r   r2   s    r   __str__zExecutionCase.__str__?   s=    t{{q &&t'A'ABB;;t{{++r   c                 "    | j                         S r1   )r8   r2   s    r   __repr__zExecutionCase.__repr__E   s    ||~r   c                 j    | j                   |j                   k(  xr | j                  |j                  k(  S r1   )r!   r   )r   others     r   __eq__zExecutionCase.__eq__H   s'    ||u}},L1LLr   c                 D    t        | j                  | j                  f      S r1   )r"   r   r%   r2   s    r   __hash__zExecutionCase.__hash__K   s    T[[$"3"3455r   )NNN)__name__
__module____qualname__r   r   r*   staticmethodr/   r3   r5   r8   r:   r=   r?    r   r   r   r      sR     "&#	'<c& r r",M6r   r   )r#   r   r   eval.factor_utilsr   corer   r   rD   r   r   <module>rG      s      + %D6 D6r   