当前位置: 首页>>代码示例>>Python>>正文


Python xgboost.__version__方法代码示例

本文整理汇总了Python中xgboost.__version__方法的典型用法代码示例。如果您正苦于以下问题:Python xgboost.__version__方法的具体用法?Python xgboost.__version__怎么用?Python xgboost.__version__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xgboost的用法示例。


在下文中一共展示了xgboost.__version__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: xgboost_installed

# 需要导入模块: import xgboost [as 别名]
# 或者: from xgboost import __version__ [as 别名]
def xgboost_installed():
    """
    Checks that *xgboost* is available.
    """
    try:
        import xgboost  # noqa F401
    except ImportError:
        return False
    from xgboost.core import _LIB
    try:
        _LIB.XGBoosterDumpModelEx
    except AttributeError:
        # The version is not recent enough even though it is version 0.6.
        # You need to install xgboost from github and not from pypi.
        return False
    from xgboost import __version__
    vers = LooseVersion(__version__)
    allowed = LooseVersion('0.7')
    if vers < allowed:
        warnings.warn('The converter works for xgboost >= 0.7. Earlier versions might not.')
    return True 
开发者ID:microsoft,项目名称:onnxconverter-common,代码行数:23,代码来源:utils.py

示例2: create_model_wrapper

# 需要导入模块: import xgboost [as 别名]
# 或者: from xgboost import __version__ [as 别名]
def create_model_wrapper(params, featurizer, ds_client=None):
    """Factory function for creating Model objects of the correct subclass for params.model_type.

    Args:
        params (Namespace) : Parameters passed to the model pipeline
        featurizer (Featurization): Object managing the featurization of compounds
        ds_client (DatastoreClient): Interface to the file datastore

    Returns:
        model (pipeline.Model): Wrapper for DeepChem, sklearn or other model.

    Raises:
        ValueError: Only params.model_type = 'NN', 'RF' or 'xgboost' is supported.
    """
    if params.model_type == 'NN':
        return DCNNModelWrapper(params, featurizer, ds_client)
    elif params.model_type == 'RF':
        return DCRFModelWrapper(params, featurizer, ds_client)
    elif params.model_type == 'xgboost':
        if not xgboost_supported:
            raise Exception("Unable to import xgboost. \
                             xgboost package needs to be installed to use xgboost model. \
                             Installatin: \
                             from pip: pip3 install xgboost.\
                             livermore compute (lc): /usr/mic/bio/anaconda3/bin/pip install xgboost --user \
                             twintron-blue (TTB): /opt/conda/bin/pip install xgboost --user/ \ "
                            )
        elif float(xgb.__version__) < 0.9:
            raise Exception(f"xgboost required to be >= 0.9 for GPU support. \
                             current version = {float(xgb.__version__)} \
                             installatin: \
                             from pip: pip3 install --upgrade xgboost \
                             livermore compute (lc): /usr/mic/bio/anaconda3/bin/pip install --upgrade xgboost --user \
                             twintron-blue (TTB): /opt/conda/bin/pip install --upgrade xgboost --user/ "
                            )
        else:
            return DCxgboostModelWrapper(params, featurizer, ds_client)
    else:
        raise ValueError("Unknown model_type %s" % params.model_type)

# **************************************************************************************** 
开发者ID:ATOMconsortium,项目名称:AMPL,代码行数:43,代码来源:model_wrapper.py

示例3: __init__

# 需要导入模块: import xgboost [as 别名]
# 或者: from xgboost import __version__ [as 别名]
def __init__(self, params):
        super(XgbAlgorithm, self).__init__(params)
        self.library_version = xgb.__version__

        self.explain_level = params.get("explain_level", 0)
        self.boosting_rounds = additional.get("max_rounds", 10000)
        self.max_iters = 1
        self.early_stopping_rounds = additional.get("early_stopping_rounds", 50)

        self.learner_params = {
            "tree_method": "hist",
            "booster": "gbtree",
            "objective": self.params.get("objective"),
            "eval_metric": self.params.get("eval_metric"),
            "eta": self.params.get("eta", 0.01),
            "max_depth": self.params.get("max_depth", 1),
            "min_child_weight": self.params.get("min_child_weight", 1),
            "subsample": self.params.get("subsample", 0.8),
            "colsample_bytree": self.params.get("colsample_bytree", 0.8),
            "silent": self.params.get("silent", 1),
            "seed": self.params.get("seed", 1),
        }

        # check https://github.com/dmlc/xgboost/issues/5637
        if self.learner_params["seed"] > 2147483647:
            self.learner_params["seed"] = self.learner_params["seed"] % 2147483647
        if "num_class" in self.params:  # multiclass classification
            self.learner_params["num_class"] = self.params.get("num_class")

        self.best_ntree_limit = 0
        logger.debug("XgbLearner __init__") 
开发者ID:mljar,项目名称:mljar-supervised,代码行数:33,代码来源:xgboost.py

示例4: get_default_conda_env

# 需要导入模块: import xgboost [as 别名]
# 或者: from xgboost import __version__ [as 别名]
def get_default_conda_env():
    """
    :return: The default Conda environment for MLflow Models produced by calls to
             :func:`save_model()` and :func:`log_model()`.
    """
    import xgboost as xgb

    return _mlflow_conda_env(
        additional_conda_deps=None,
        # XGBoost is not yet available via the default conda channels, so we install it via pip
        additional_pip_deps=[
            "xgboost=={}".format(xgb.__version__),
        ],
        additional_conda_channels=None) 
开发者ID:mlflow,项目名称:mlflow,代码行数:16,代码来源:xgboost.py


注:本文中的xgboost.__version__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。