
    sii]                        d Z ddlmZmZmZmZmZ ddlZddl	m
Z
 ddlmZmZ ddlmZmZ ddlmZ dd	lmZmZmZ d
dlmZmZmZ d
dlmZ dee         dee         ddfdZ G d de          Z G d de          Z eee            G d deee          Z  G d de          Z! ee e!            G d de          Z" G d de          Z# ee"e#           dS )z8Xgboost pyspark integration submodule for estimator API.    )AnyListOptionalTypeUnionN)keyword_only)ParamParams)HasProbabilityColHasRawPredictionCol   )Config)XGBClassifier	XGBRankerXGBRegressor   )_ClassificationModel_SparkXGBEstimator_SparkXGBModel)get_class_name	estimatormodelreturnc                    	                                   }dt          dt          f	fd	dt          dt          ddf 	fd}|                                D ]X}dt                                                      d	| }t          t          j                    ||
          } |||           Y 	                                }|                                D ]c}dt                                                      d| }|dk    r|dz  }t          t          j                    ||
          } |||           d 
                                }|                                D ]X}dt                                                      d| }t          t          j                    ||
          } |||           YdS )zyThis function automatically infer to xgboost parameters and set them
    into corresponding pyspark estimators and modelsvr   c                 8   t          | t          j                  r&t          j        |                                           S t          | t
                    r fd|                                 D             S t          | t                    rfd| D             S | S )Nc                 .    i | ]\  }}| |          S  r   ).0knvparam_value_converters      ]/var/www/html/bet.cuttalo.com/ml/venv/lib/python3.11/site-packages/xgboost/spark/estimator.py
<dictcomp>zS_set_pyspark_xgb_cls_param_attrs.<locals>.param_value_converter.<locals>.<dictcomp>#   s+    HHHUQA,,R00HHH    c                 &    g | ]} |          S r   r   )r   r!   r"   s     r#   
<listcomp>zS_set_pyspark_xgb_cls_param_attrs.<locals>.param_value_converter.<locals>.<listcomp>%   s%    :::"))"--:::r%   )
isinstancenpgenericarrayitemdictitemslist)r   r"   s    r#   r"   z?_set_pyspark_xgb_cls_param_attrs.<locals>.param_value_converter   s    a$$ 	&8A;;##%%%a 	IHHHHaggiiHHHHa 	;::::::::r%   	attr_nameparamNc                 Z    |_         t          | |           t          | |           d S N)typeConvertersetattr)r0   r1   r   r   r"   s     r#   set_param_attrsz9_set_pyspark_xgb_cls_param_attrs.<locals>.set_param_attrs(   s5    3	9e,,,y%(((((r%   zRefer to XGBoost doc of z for this param )namedocz.fit() for this param 	callbackszThe callbacks can be arbitrary functions. It is saved using cloudpickle which is not a fully self-contained format. It may fail to load with different versions of dependencies.z.predict() for this param )_get_xgb_params_defaultr   strr	   keysr   _xgb_clsr
   _dummy_get_fit_params_default_get_predict_params_default)
r   r   params_dictr6   r7   r8   	param_objfit_params_dictpredict_params_dictr"   s
   ``       @r#    _set_pyspark_xgb_cls_param_attrsrE      s[   
 3355K       )3 )u ) ) ) ) ) ) ) ) )
   "" ) )Li002233L LEIL L 	
 !tEEE	i((((7799O$$&& ) ),~i6H6H6J6J'K'K , ,%), , 	 ;6C
 &-//#>>>	i((((#??AA#((** ) )0~i6H6H6J6J'K'K 0 0)-0 0 	 &-//#>>>	i(((() )r%   c            "       T    e Zd ZdZeddddddddddddddd	d
eeee         f         dededee         dee         dee         dee         de	dee         de
de
de
de
dee         deddf  fd            Zedee         fd            Zeded         fd            Zd fdZ xZS ) SparkXGBRegressora  SparkXGBRegressor is a PySpark ML estimator. It implements the XGBoost regression
    algorithm based on XGBoost python library, and it can be used in PySpark Pipeline
    and PySpark ML meta algorithms like
    - :py:class:`~pyspark.ml.tuning.CrossValidator`/
    - :py:class:`~pyspark.ml.tuning.TrainValidationSplit`/
    - :py:class:`~pyspark.ml.classification.OneVsRest`

    SparkXGBRegressor automatically supports most of the parameters in
    :py:class:`xgboost.XGBRegressor` constructor and most of the parameters used in
    :py:meth:`xgboost.XGBRegressor.fit` and :py:meth:`xgboost.XGBRegressor.predict`
    method.

    To enable GPU support, set `device` to `cuda` or `gpu`.

    SparkXGBRegressor doesn't support setting `base_margin` explicitly as well, but
    support another param called `base_margin_col`. see doc below for more details.

    SparkXGBRegressor doesn't support `validate_features` and `output_margin` param.

    SparkXGBRegressor doesn't support setting `nthread` xgboost param, instead, the
    `nthread` param for each xgboost worker will be set equal to `spark.task.cpus`
    config value.


    Parameters
    ----------

    features_col:
        When the value is string, it requires the features column name to be vector type.
        When the value is a list of string, it requires all the feature columns to be numeric types.
    label_col:
        Label column name. Default to "label".
    prediction_col:
        Prediction column name. Default to "prediction"
    pred_contrib_col:
        Contribution prediction column name.
    validation_indicator_col:
        For params related to `xgboost.XGBRegressor` training with
        evaluation dataset's supervision,
        set :py:attr:`xgboost.spark.SparkXGBRegressor.validation_indicator_col`
        parameter instead of setting the `eval_set` parameter in `xgboost.XGBRegressor`
        fit method.
    weight_col:
        To specify the weight of the training and validation dataset, set
        :py:attr:`xgboost.spark.SparkXGBRegressor.weight_col` parameter instead of setting
        `sample_weight` and `sample_weight_eval_set` parameter in `xgboost.XGBRegressor`
        fit method.
    base_margin_col:
        To specify the base margins of the training and validation
        dataset, set :py:attr:`xgboost.spark.SparkXGBRegressor.base_margin_col` parameter
        instead of setting `base_margin` and `base_margin_eval_set` in the
        `xgboost.XGBRegressor` fit method.

    num_workers:
        How many XGBoost workers to be used to train.
        Each XGBoost worker corresponds to one spark task.
    device:

        .. versionadded:: 2.0.0

        Device for XGBoost workers, available options are `cpu`, `cuda`, and `gpu`.

    force_repartition:
        Boolean value to specify if forcing the input dataset to be repartitioned
        before XGBoost training.
    repartition_random_shuffle:
        Boolean value to specify if randomly shuffling the dataset when repartitioning is required.
    enable_sparse_data_optim:
        Boolean value to specify if enabling sparse data optimization, if True,
        Xgboost DMatrix object will be constructed from sparse matrix instead of
        dense matrix.
    launch_tracker_on_driver:
        Boolean value to indicate whether the tracker should be launched on the driver side or
        the executor side.
    coll_cfg:
        The collective configuration. See :py:class:`~xgboost.collective.Config`

    kwargs:
        A dictionary of xgboost parameters, please refer to
        https://xgboost.readthedocs.io/en/stable/parameter.html

    Note
    ----

    The Parameters chart above contains parameters that need special handling.
    For a full list of parameters, see entries with `Param(parent=...` below.

    This API is experimental.


    Examples
    --------

    >>> from xgboost.spark import SparkXGBRegressor
    >>> from pyspark.ml.linalg import Vectors
    >>> df_train = spark.createDataFrame([
    ...     (Vectors.dense(1.0, 2.0, 3.0), 0, False, 1.0),
    ...     (Vectors.sparse(3, {1: 1.0, 2: 5.5}), 1, False, 2.0),
    ...     (Vectors.dense(4.0, 5.0, 6.0), 2, True, 1.0),
    ...     (Vectors.sparse(3, {1: 6.0, 2: 7.5}), 3, True, 2.0),
    ... ], ["features", "label", "isVal", "weight"])
    >>> df_test = spark.createDataFrame([
    ...     (Vectors.dense(1.0, 2.0, 3.0), ),
    ...     (Vectors.sparse(3, {1: 1.0, 2: 5.5}), )
    ... ], ["features"])
    >>> xgb_regressor = SparkXGBRegressor(max_depth=5, missing=0.0,
    ... validation_indicator_col='isVal', weight_col='weight',
    ... early_stopping_rounds=1, eval_metric='rmse')
    >>> xgb_reg_model = xgb_regressor.fit(df_train)
    >>> xgb_reg_model.transform(df_test)

    featureslabel
predictionNr   FT)features_col	label_colprediction_colpred_contrib_colvalidation_indicator_col
weight_colbase_margin_colnum_workersdeviceforce_repartitionrepartition_random_shuffleenable_sparse_data_optimlaunch_tracker_on_drivercoll_cfgrK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   kwargsr   c                p    t                                                       | j        } | j        di | d S Nr   super__init___input_kwargs	setParams)selfrK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   input_kwargs	__class__s                    r#   r^   zSparkXGBRegressor.__init__   sA    ( 	)&&&&&&&r%   c                     t           S r3   r   clss    r#   r=   zSparkXGBRegressor._xgb_cls       r%   SparkXGBRegressorModelc                     t           S r3   )ri   rf   s    r#   _pyspark_model_clsz$SparkXGBRegressor._pyspark_model_cls   s    %%r%   c                     t                                                       |                     | j                  rt	          d          d S )NzCSpark Xgboost regressor estimator does not support `qid_col` param.r]   _validate_params	isDefinedqid_col
ValueErrorra   rc   s    r#   rn   z"SparkXGBRegressor._validate_params   sN      """>>$,'' 	U  	 	r%   r   N)__name__
__module____qualname____doc__r   r   r;   r   r   intboolr   r   r^   classmethodr   r   r=   rk   rn   __classcell__rc   s   @r#   rG   rG   O   s       o ob  /9 **.26$()- $"'+0).)-%)!' ' ' CcN+' 	'
 ' #3-' #+3-' SM' "#' ' '  ' %)' #'' #''  6"!'" #'$ 
%' ' ' ' ' \'. l+    [ &4(@#A & & & [&         r%   rG   c                   :    e Zd ZdZedee         fd            ZdS )ri   zt
    The model returned by :func:`xgboost.spark.SparkXGBRegressor.fit`

    .. Note:: This API is experimental.
    r   c                     t           S r3   re   rf   s    r#   r=   zSparkXGBRegressorModel._xgb_cls   rh   r%   N)rt   ru   rv   rw   rz   r   r   r=   r   r%   r#   ri   ri      sJ          l+    [  r%   ri   c            &       `    e Zd ZdZedddddddddddd	d	d	d
dddeeee         f         dededededee         dee         dee         dee         de	dee         de
de
de
de
dee         deddf$ fd            Zedee         fd            Zeded          fd!            Zd# fd"Z xZS )$SparkXGBClassifierat  SparkXGBClassifier is a PySpark ML estimator. It implements the XGBoost
    classification algorithm based on XGBoost python library, and it can be used in
    PySpark Pipeline and PySpark ML meta algorithms like
    - :py:class:`~pyspark.ml.tuning.CrossValidator`/
    - :py:class:`~pyspark.ml.tuning.TrainValidationSplit`/
    - :py:class:`~pyspark.ml.classification.OneVsRest`

    SparkXGBClassifier automatically supports most of the parameters in
    :py:class:`xgboost.XGBClassifier` constructor and most of the parameters used in
    :py:meth:`xgboost.XGBClassifier.fit` and :py:meth:`xgboost.XGBClassifier.predict`
    method.

    To enable GPU support, set `device` to `cuda` or `gpu`.

    SparkXGBClassifier doesn't support setting `base_margin` explicitly as well, but
    support another param called `base_margin_col`. see doc below for more details.

    SparkXGBClassifier doesn't support setting `output_margin`, but we can get output
    margin from the raw prediction column. See `raw_prediction_col` param doc below for
    more details.

    SparkXGBClassifier doesn't support `validate_features` and `output_margin` param.

    SparkXGBClassifier doesn't support setting `nthread` xgboost param, instead, the
    `nthread` param for each xgboost worker will be set equal to `spark.task.cpus`
    config value.


    Parameters
    ----------

    features_col:
        When the value is string, it requires the features column name to be vector type.
        When the value is a list of string, it requires all the feature columns to be numeric types.
    label_col:
        Label column name. Default to "label".
    prediction_col:
        Prediction column name. Default to "prediction"
    probability_col:
        Column name for predicted class conditional probabilities. Default to probabilityCol
    raw_prediction_col:
        The `output_margin=True` is implicitly supported by the
        `rawPredictionCol` output column, which is always returned with the predicted margin
        values.
    pred_contrib_col:
        Contribution prediction column name.
    validation_indicator_col:
        For params related to `xgboost.XGBClassifier` training with
        evaluation dataset's supervision,
        set :py:attr:`xgboost.spark.SparkXGBClassifier.validation_indicator_col`
        parameter instead of setting the `eval_set` parameter in `xgboost.XGBClassifier`
        fit method.
    weight_col:
        To specify the weight of the training and validation dataset, set
        :py:attr:`xgboost.spark.SparkXGBClassifier.weight_col` parameter instead of setting
        `sample_weight` and `sample_weight_eval_set` parameter in `xgboost.XGBClassifier`
        fit method.
    base_margin_col:
        To specify the base margins of the training and validation
        dataset, set :py:attr:`xgboost.spark.SparkXGBClassifier.base_margin_col` parameter
        instead of setting `base_margin` and `base_margin_eval_set` in the
        `xgboost.XGBClassifier` fit method.

    num_workers:
        How many XGBoost workers to be used to train.
        Each XGBoost worker corresponds to one spark task.
    device:

        .. versionadded:: 2.0.0

        Device for XGBoost workers, available options are `cpu`, `cuda`, and `gpu`.

    force_repartition:
        Boolean value to specify if forcing the input dataset to be repartitioned
        before XGBoost training.
    repartition_random_shuffle:
        Boolean value to specify if randomly shuffling the dataset when repartitioning is required.
    enable_sparse_data_optim:
        Boolean value to specify if enabling sparse data optimization, if True,
        Xgboost DMatrix object will be constructed from sparse matrix instead of
        dense matrix.
    launch_tracker_on_driver:
        Boolean value to indicate whether the tracker should be launched on the driver side or
        the executor side.
    coll_cfg:
        The collective configuration. See :py:class:`~xgboost.collective.Config`

    kwargs:
        A dictionary of xgboost parameters, please refer to
        https://xgboost.readthedocs.io/en/stable/parameter.html

    Note
    ----

    The Parameters chart above contains parameters that need special handling.
    For a full list of parameters, see entries with `Param(parent=...` below.

    This API is experimental.

    Examples
    --------

    >>> from xgboost.spark import SparkXGBClassifier
    >>> from pyspark.ml.linalg import Vectors
    >>> df_train = spark.createDataFrame([
    ...     (Vectors.dense(1.0, 2.0, 3.0), 0, False, 1.0),
    ...     (Vectors.sparse(3, {1: 1.0, 2: 5.5}), 1, False, 2.0),
    ...     (Vectors.dense(4.0, 5.0, 6.0), 0, True, 1.0),
    ...     (Vectors.sparse(3, {1: 6.0, 2: 7.5}), 1, True, 2.0),
    ... ], ["features", "label", "isVal", "weight"])
    >>> df_test = spark.createDataFrame([
    ...     (Vectors.dense(1.0, 2.0, 3.0), ),
    ... ], ["features"])
    >>> xgb_classifier = SparkXGBClassifier(max_depth=5, missing=0.0,
    ...     validation_indicator_col='isVal', weight_col='weight',
    ...     early_stopping_rounds=1, eval_metric='logloss')
    >>> xgb_clf_model = xgb_classifier.fit(df_train)
    >>> xgb_clf_model.transform(df_test).show()

    rH   rI   rJ   probabilityrawPredictionNr   FT)rK   rL   rM   probability_colraw_prediction_colrN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rK   rL   rM   r   r   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   r   c                    t                                                       | j        } | j        di | |                     d            d S )N)	objectiver   )r]   r^   r_   r`   _setDefault)ra   rK   rL   rM   r   r   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rb   rc   s                      r#   r^   zSparkXGBClassifier.__init__r  sZ    , 	
 )&&&&&4(((((r%   c                     t           S r3   r   rf   s    r#   r=   zSparkXGBClassifier._xgb_cls      r%   SparkXGBClassifierModelc                     t           S r3   )r   rf   s    r#   rk   z%SparkXGBClassifier._pyspark_model_cls  s    &&r%   c                     t                                                       |                     | j                  rt	          d          |                     d          rt	          d          d S )NzDSpark Xgboost classifier estimator does not support `qid_col` param.r   zHSetting custom 'objective' param is not allowed in 'SparkXGBClassifier'.)r]   rn   ro   rp   rq   getOrDefaultrr   s    r#   rn   z#SparkXGBClassifier._validate_params  s{      """>>$,'' 	V   [)) 	Z  	 	r%   rs   )rt   ru   rv   rw   r   r   r;   r   r   rx   ry   r   r   r^   rz   r   r   r=   rk   rn   r{   r|   s   @r#   r   r      s       w wr  /9 *,"1*.26$()- $"'+0).)-%)%) ) ) CcN+) 	)
 ) )  ) #3-) #+3-) SM) "#) ) )  ) %))  #'!)" #'#)$ 6"%)& ')( 
)) ) ) ) ) \)< m,    [ '4(A#B ' ' ' ['	 	 	 	 	 	 	 	 	 	r%   r   c                   :    e Zd ZdZedee         fd            ZdS )r   zu
    The model returned by :func:`xgboost.spark.SparkXGBClassifier.fit`

    .. Note:: This API is experimental.
    r   c                     t           S r3   r   rf   s    r#   r=   z SparkXGBClassifierModel._xgb_cls  r   r%   N)rt   ru   rv   rw   rz   r   r   r=   r   r%   r#   r   r     sJ          m,    [  r%   r   c            $       f    e Zd ZdZedddddddddddddddd	d
eeee         f         dededee         dee         dee         dee         dee         de	dee         de
de
de
de
dee         deddf" fd            Zedee         fd            Zeded         fd            Zd  fdZ xZS )!SparkXGBRankeraJ  SparkXGBRanker is a PySpark ML estimator. It implements the XGBoost
    ranking algorithm based on XGBoost python library, and it can be used in
    PySpark Pipeline and PySpark ML meta algorithms like
    :py:class:`~pyspark.ml.tuning.CrossValidator`/
    :py:class:`~pyspark.ml.tuning.TrainValidationSplit`/
    :py:class:`~pyspark.ml.classification.OneVsRest`

    SparkXGBRanker automatically supports most of the parameters in
    :py:class:`xgboost.XGBRanker` constructor and most of the parameters used in
    :py:meth:`xgboost.XGBRanker.fit` and :py:meth:`xgboost.XGBRanker.predict` method.

    To enable GPU support, set `device` to `cuda` or `gpu`.

    SparkXGBRanker doesn't support setting `base_margin` explicitly as well, but support
    another param called `base_margin_col`. see doc below for more details.

    SparkXGBRanker doesn't support setting `output_margin`, but we can get output margin
    from the raw prediction column. See `raw_prediction_col` param doc below for more
    details.

    SparkXGBRanker doesn't support `validate_features` and `output_margin` param.

    SparkXGBRanker doesn't support setting `nthread` xgboost param, instead, the
    `nthread` param for each xgboost worker will be set equal to `spark.task.cpus`
    config value.


    Parameters
    ----------

    features_col:
        When the value is string, it requires the features column name to be vector type.
        When the value is a list of string, it requires all the feature columns to be numeric types.
    label_col:
        Label column name. Default to "label".
    prediction_col:
        Prediction column name. Default to "prediction"
    pred_contrib_col:
        Contribution prediction column name.
    validation_indicator_col:
        For params related to `xgboost.XGBRanker` training with
        evaluation dataset's supervision,
        set :py:attr:`xgboost.spark.SparkXGBRanker.validation_indicator_col`
        parameter instead of setting the `eval_set` parameter in :py:class:`xgboost.XGBRanker`
        fit method.
    weight_col:
        To specify the weight of the training and validation dataset, set
        :py:attr:`xgboost.spark.SparkXGBRanker.weight_col` parameter instead of setting
        `sample_weight` and `sample_weight_eval_set` parameter in :py:class:`xgboost.XGBRanker`
        fit method.
    base_margin_col:
        To specify the base margins of the training and validation
        dataset, set :py:attr:`xgboost.spark.SparkXGBRanker.base_margin_col` parameter
        instead of setting `base_margin` and `base_margin_eval_set` in the
        :py:class:`xgboost.XGBRanker` fit method.
    qid_col:
        Query id column name.
    num_workers:
        How many XGBoost workers to be used to train.
        Each XGBoost worker corresponds to one spark task.
    device:

        .. versionadded:: 2.0.0

        Device for XGBoost workers, available options are `cpu`, `cuda`, and `gpu`.

    force_repartition:
        Boolean value to specify if forcing the input dataset to be repartitioned
        before XGBoost training.
    repartition_random_shuffle:
        Boolean value to specify if randomly shuffling the dataset when repartitioning is required.
    enable_sparse_data_optim:
        Boolean value to specify if enabling sparse data optimization, if True,
        Xgboost DMatrix object will be constructed from sparse matrix instead of
        dense matrix.
    launch_tracker_on_driver:
        Boolean value to indicate whether the tracker should be launched on the driver side or
        the executor side.
    coll_cfg:
        The collective configuration. See :py:class:`~xgboost.collective.Config`

    kwargs:
        A dictionary of xgboost parameters, please refer to
        https://xgboost.readthedocs.io/en/stable/parameter.html

    .. Note:: The Parameters chart above contains parameters that need special handling.
        For a full list of parameters, see entries with `Param(parent=...` below.

    .. Note:: This API is experimental.

    Examples
    --------

    >>> from xgboost.spark import SparkXGBRanker
    >>> from pyspark.ml.linalg import Vectors
    >>> ranker = SparkXGBRanker(qid_col="qid")
    >>> df_train = spark.createDataFrame(
    ...     [
    ...         (Vectors.dense(1.0, 2.0, 3.0), 0, 0),
    ...         (Vectors.dense(4.0, 5.0, 6.0), 1, 0),
    ...         (Vectors.dense(9.0, 4.0, 8.0), 2, 0),
    ...         (Vectors.sparse(3, {1: 1.0, 2: 5.5}), 0, 1),
    ...         (Vectors.sparse(3, {1: 6.0, 2: 7.5}), 1, 1),
    ...         (Vectors.sparse(3, {1: 8.0, 2: 9.5}), 2, 1),
    ...     ],
    ...     ["features", "label", "qid"],
    ... )
    >>> df_test = spark.createDataFrame(
    ...     [
    ...         (Vectors.dense(1.5, 2.0, 3.0), 0),
    ...         (Vectors.dense(4.5, 5.0, 6.0), 0),
    ...         (Vectors.dense(9.0, 4.5, 8.0), 0),
    ...         (Vectors.sparse(3, {1: 1.0, 2: 6.0}), 1),
    ...         (Vectors.sparse(3, {1: 6.0, 2: 7.0}), 1),
    ...         (Vectors.sparse(3, {1: 8.0, 2: 10.5}), 1),
    ...     ],
    ...     ["features", "qid"],
    ... )
    >>> model = ranker.fit(df_train)
    >>> model.transform(df_test).show()
    rH   rI   rJ   Nr   FT)rK   rL   rM   rN   rO   rP   rQ   rp   rR   rS   rT   rU   rV   rW   rX   rK   rL   rM   rN   rO   rP   rQ   rp   rR   rS   rT   rU   rV   rW   rX   rY   r   c                p    t                                                       | j        } | j        di | d S r[   r\   )ra   rK   rL   rM   rN   rO   rP   rQ   rp   rR   rS   rT   rU   rV   rW   rX   rY   rb   rc   s                     r#   r^   zSparkXGBRanker.__init__/  sA    * 	)&&&&&&&r%   c                     t           S r3   r   rf   s    r#   r=   zSparkXGBRanker._xgb_clsH      r%   SparkXGBRankerModelc                     t           S r3   )r   rf   s    r#   rk   z!SparkXGBRanker._pyspark_model_clsL  s    ""r%   c                     t                                                       |                     | j                  st	          d          d S )Nz@Spark Xgboost ranker estimator requires setting `qid_col` param.rm   rr   s    r#   rn   zSparkXGBRanker._validate_paramsP  sN      """~~dl++ 	R  	 	r%   rs   )rt   ru   rv   rw   r   r   r;   r   r   rx   ry   r   r   r^   rz   r   r   r=   rk   rn   r{   r|   s   @r#   r   r     s       x xt  /9 **.26$()-!% $"'+0).)-%)#' ' ' CcN+' 	'
 ' #3-' #+3-' SM' "#' #' ' '  ' %)' #''  #'!'" 6"#'$ %'& 
'' ' ' ' ' \'0 i    [ #4(=#> # # # [#         r%   r   c                   :    e Zd ZdZedee         fd            ZdS )r   zq
    The model returned by :func:`xgboost.spark.SparkXGBRanker.fit`

    .. Note:: This API is experimental.
    r   c                     t           S r3   r   rf   s    r#   r=   zSparkXGBRankerModel._xgb_cls_  r   r%   N)rt   ru   rv   rw   rz   r   r   r=   r   r%   r#   r   r   X  sI          i    [  r%   r   )$rw   typingr   r   r   r   r   numpyr)   pysparkr   pyspark.ml.paramr	   r
   pyspark.ml.param.sharedr   r   
collectiver   sklearnr   r   r   corer   r   r   utilsr   rE   rG   ri   r   r   r   r   r   r%   r#   <module>r      s   > >
 4 3 3 3 3 3 3 3 3 3 3 3 3 3                 * * * * * * * * J J J J J J J J       < < < < < < < < < <         
 " ! ! ! ! !5)&'5)04^0D5)	5) 5) 5) 5)pW W W W W* W W Wt	 	 	 	 	^ 	 	 	 !  !24J K K Kj j j j j+->@S j j jZ	 	 	 	 	2 	 	 	 !  !35L M M Ma a a a a' a a aH	 	 	 	 	. 	 	 	 !  1D E E E E Er%   