o
    \i                     @   s*   d Z ddlmZ ddlmZ d	ddZdS )
z&This module contains utility routines.   )is_classifier   )
_BinMapperlightgbmNc                 C   s  |dvrt d||  }|d dkrt d|d r!tddd	|d
kr)dndddd}i d||d  d|d d|d d|d d|d d|d d|d d|d dddd d!d"d#|d$ rjd%nd&d'd(d)d*d+t jd,d-d.|d/ }|d d0kr|d
kr|d  d
9  < |d1ur|d  ||d  9  < d2d3|d
krd4nd5d6d7d}d8d9||d  |d |d |d |d pd"|d |d d |d$ rd
nd"|d$ d"kd:|d/ d;}d<d=|d
krd>nd?d1d@d}||d  |d |d |d |d |d dAdBt|d$ dC	}	|dDkr+d"dElm}
m	} t
| r$|
dIi |S |dIi |S |dFkrKd"dGlm}m} t
| rD|dIi |S |dIi |S d"dHlm}m} t
| r_|dIi |	S |dIi |	S )Ja  Return an unfitted estimator from another lib with matching hyperparams.

    This utility function takes care of renaming the sklearn parameters into
    their LightGBM, XGBoost or CatBoost equivalent parameters.

    # unmapped XGB parameters:
    # - min_samples_leaf
    # - min_data_in_bin
    # - min_split_gain (there is min_split_loss though?)

    # unmapped Catboost parameters:
    # max_leaves
    # min_*
    )r   xgboostcatboostz:accepted libs are lightgbm, xgboost, and catboost.  got {}lossautozaauto loss is not accepted. We need to know if the problem is binary or multiclass classification.early_stoppingz%Early stopping should be deactivated.regression_l2regression_l1   binary
multiclassgammapoisson)squared_errorabsolute_errorlog_lossr   r   	objectivelearning_raten_estimatorsmax_iter
num_leavesmax_leaf_nodes	max_depthmin_data_in_leafmin_samples_leaf
reg_lambdal2_regularizationmax_binmax_binsmin_data_in_binr   min_sum_hessian_in_leafgMbP?min_split_gain    	verbosityverbose
   iboost_from_averageTenable_bundleFsubsample_for_binpoisson_max_delta_stepg-q=feature_fraction_bynodemax_featuresr   Nz
reg:linear LEAST_ABSOLUTE_DEV_NOT_SUPPORTEDzreg:logisticzmulti:softmaxz	reg:gammazcount:poissonhist	lossguide)tree_methodgrow_policyr   r   r   
max_leavesr   lambdar    min_child_weightr&   silentn_jobscolsample_bynodeRMSE LEAST_ASBOLUTE_DEV_NOT_SUPPORTEDLogloss
MultiClassPoissonMedianNewton)	loss_functionr   
iterationsdepthr   r    feature_border_typeleaf_estimation_methodr'   r   )LGBMClassifierLGBMRegressorr   )XGBClassifierXGBRegressor)CatBoostClassifierCatBoostRegressor )
ValueErrorformat
get_paramsNotImplementedErrorr   	subsampleboolr   rG   rH   r   r   rI   rJ   r   rK   rL   )	estimatorlib	n_classessklearn_paramslightgbm_loss_mappinglightgbm_paramsxgboost_loss_mappingxgboost_paramscatboost_loss_mappingcatboost_paramsrG   rH   rI   rJ   rK   rL   rM   rM   /var/www/www-root/data/www/176.119.141.140/sports-predictor/venv/lib/python3.10/site-packages/sklearn/ensemble/_hist_gradient_boosting/utils.pyget_equivalent_estimator
   s   	
	










r_   )r   N)__doc__baser   binningr   r_   rM   rM   rM   r^   <module>   s    