hgboost是一个python包,用于分类和回归任务的xgboost、catboost和lightboost的超参数优化。

hgboost的Python项目详细描述


hgboost-超优化梯度提升

PythonPyPI VersionLicenseGithub ForksGitHub Open IssuesProject StatusDownloadsDownloadsSphinxOpen In Colab

Star it if you like it!

hgboostHyperoptimized Gradient Boosting的缩写,是一个python包,用于xgboostcatboost和{em1}$lightboost的超参数优化,并在独立的验证集上评估结果。 hgboost可用于分类和回归任务。在

hgboost很有趣,因为:

^{pr2}$

文档

回归示例 Open regression example In Colab

分类示例 Open classification example In Colab

hgboost示意图概述

安装环境

  • 从PyPI安装hgboost(推荐)。hgboost与python3.6+兼容,可在Linux、macosx和Windows上运行。在
  • 建议并创建一个新环境,如下所示:
condacreate-nenv_hgboostpython=3.6condaactivateenv_hgboost

从pypi

安装最新版本的hgboost
pip install hgboost

Force安装最新版本

pip install -U hgboost

从github源安装

pip install git+https://github.com/erdogant/hgboost#egg=master

导入hgboost包

importhgboostashgboost

xgboost、catboost和lightboost的分类示例:

# Load libraryfromhgboostimporthgboost# Initializationhgb=hgboost(max_eval=10,threshold=0.5,cv=5,test_size=0.2,val_size=0.2,top_cv_evals=10,random_state=42)
# Import datadf=hgb.import_example()y=df['Survived'].valuesy=y.astype(str)y[y=='1']='survived'y[y=='0']='dead'# Preprocessing by encoding variablesdeldf['Survived']X=hgb.preprocessing(df)
# Fit catboost by hyperoptimization and cross-validationresults=hgb.catboost(X,y,pos_label='survived')# Fit lightboost by hyperoptimization and cross-validationresults=hgb.lightboost(X,y,pos_label='survived')# Fit xgboost by hyperoptimization and cross-validationresults=hgb.xgboost(X,y,pos_label='survived')# [hgboost] >Start hgboost classification..# [hgboost] >Collecting xgb_clf parameters.# [hgboost] >Number of variables in search space is [11], loss function: [auc].# [hgboost] >method: xgb_clf# [hgboost] >eval_metric: auc# [hgboost] >greater_is_better: True# [hgboost] >pos_label: True# [hgboost] >Total dataset: (891, 204) # [hgboost] >Hyperparameter optimization..#  100% |----| 500/500 [04:39<05:21,  1.33s/trial, best loss: -0.8800619834710744]# [hgboost] >Best performing [xgb_clf] model: auc=0.881198# [hgboost] >5-fold cross validation for the top 10 scoring models, Total nr. tests: 50# 100%|██████████| 10/10 [00:42<00:00,  4.27s/it]# [hgboost] >Evalute best [xgb_clf] model on independent validation dataset (179 samples, 20.00%).# [hgboost] >[auc] on independent validation dataset: -0.832# [hgboost] >Retrain [xgb_clf] on the entire dataset with the optimal parameters settings.
# Plot searched parameter space hgb.plot_params()

# Plot summary resultshgb.plot()

# Plot the best treehgb.treeplot()

# Plot the validation resultshgb.plot_validation()

# Plot the cross-validation resultshgb.plot_cv()

# use the learned model to make new predictions.y_pred,y_proba=hgb.predict(X)

为分类创建集成模型

fromhgboostimporthgboosthgb=hgboost(max_eval=100,threshold=0.5,cv=5,test_size=0.2,val_size=0.2,top_cv_evals=10,random_state=None,verbose=3)# Import datadf=hgb.import_example()y=df['Survived'].valuesdeldf['Survived']X=hgb.preprocessing(df,verbose=0)results=hgb.ensemble(X,y,pos_label=1)# use the predictory_pred,y_proba=hgb.predict(X)

创建回归的集成模型

fromhgboostimporthgboosthgb=hgboost(max_eval=100,threshold=0.5,cv=5,test_size=0.2,val_size=0.2,top_cv_evals=10,random_state=None,verbose=3)# Import datadf=hgb.import_example()y=df['Age'].valuesdeldf['Age']I=~np.isnan(y)X=hgb.preprocessing(df,verbose=0)X=X.loc[I,:]y=y[I]results=hgb.ensemble(X,y,methods=['xgb_reg','ctb_reg','lgb_reg'])# use the predictory_pred,y_proba=hgb.predict(X)
# Plot the ensemble classification validation resultshgb.plot_validation()

引文

如果这对你的研究有用,请在你的出版物中引用hgboost。以下是BibTeX条目示例:

@misc{erdogant2020hgboost,title={hgboost},author={Erdogan Taskesen},year={2020},howpublished={\url{https://github.com/erdogant/hgboost}},}

引用

^{pr21}$

维护者

贡献

  • 欢迎投稿。在

许可证 有关详细信息,请参见LICENSE。在

咖啡

  • 这件作品是我在空闲时间创作和维护的。如果你想为这件工作给我买一件Coffee,我将不胜感激。在

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java查询,该查询应返回特定相关实体的实体   java创建了两个可运行的JAR,它们使用相同的库而不需要两次   java swing应用程序如何设置面板中组件的高度(和宽度)   在fat jar中找不到java JasperReport文件错误   kotlin在java中如何称呼这个构造函数?   java为什么被零除是一个不可恢复的问题?   java为SUTime添加用于解析季度的自定义规则   java merge 2带所有元素的排序列表   从字符串StringUtils Java中提取数字   java ForLoops最大和最小数   java我可以为嵌入式tomcat 8定义始终保持活动状态的最小executer线程数吗?   java当metod返回ResponseEntry<Resource>抛出错误时,如何返回ModelandView?   java片段翻译和电话定位错误   javagwt:如何让regex(模式和匹配器)在客户端工作   java EAR文件和“WebSphere增强的EAR”之间有什么区别?