Package: constrained-gb
Constrained Gradient BoostingConstrained Optimization of Gradient Boosting models which is written on top of Sklearn gradient boosting.Explore the docs Â»Table of ContentsAbout The ProjectBuilt WithGetting StartedPrerequisitesInstallationUsageRoadmapContributingLicenseContactAcknowledgementsAbout The ProjectThis is the companion code for the Master Thesis entitled "".
The master thesis is done in Bosch Center of AI research, and licenced by GNU AFFERO GENERAL PUBLIC LICENSE.
The code allows the users to apply constrained for one type of error, such as
false negative rate to do safe classification using gradient boosting. Besides, one can reproduce the
results in the paper as it is provided in the examples.This library enables user to define their own constraints and apply them on for the gradient boosting.
To see how to do this visithere.Built WithThis project language is Python and it is built on top ofscikit-learngradient boosting. For hyper-parameter optimizationGPyOptbayesian optimization is used.scikit-learnGPyOptGetting StartedThis is an example of how you may give instructions on setting up your project locally.
To get a local copy up and running follow these simple example steps.PrerequisitesTo use theconstrained_gblibrary, you need to havescikit-learn>=0.22.0installed,
which is probably installed if you are using Machine Learning algorithm in Python.
To do hyper-parameter optimization using.optimize(), you need to haveGPyOptinstalled.
To installGPyOptsimply runpipinstallgpyoptIf you have problem withGPyOptinstallation visithere.InstallationClone the repogitclonehttps://github.com/maryami66/constrained_gb.gitInstallpipinstallconstrained_gbUsageIn this example, we are looking for a classifier to
Use this space to show useful examples of how a project can be used. Additional screenshots, code examples and demos work well in this space. You may also link to more resources.importconstrained_gbasgbmco
fromsklearn.datasetsimportload_breast_cancer
fromsklearn.model_selectionimporttrain_test_split
fromsklearn.metricsimport*

X,y=load_breast_cancer(return_X_y=True)X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.5,random_state=2)constraints=[gbmco.FalseNegativeRate(0.001)]parms={'constraints':constraints,'multiplier_stepsize':0.01,'learning_rate':0.1,'min_samples_split':99,'min_samples_leaf':19,'max_depth':8,'max_leaf_nodes':None,'min_weight_fraction_leaf':0.0,'n_estimators':300,'max_features':'sqrt','subsample':0.7,'random_state':2}clf=gbmco.ConstrainedClassifier(**parms)clf.fit(X_train,y_train)test_predictions=clf.predict(X_test)print("Test F1 Measure: {} \n".format(f1_score(y_test,test_predictions)))print("Test FNR: {} \n".format(1-recall_score(y_test,test_predictions)))LicenseDistributed under the GNU AFFERO GENERAL PUBLIC LICENSE License v3 or later (GPLv3+). SeeLICENSEfor more information.ContactMaryam Bahrami -maryami_66@yahoo.comProject Link:https://github.com/maryami66/constrained_gbAcknowledgementsMy master thesis supervisor at Bosch center of AI research,Andreas SteimerMy master thesis supervisor at Hildesheim University,Lukas BrinkmeyerMy professor at Hildesheim University,Prof. Lars Schmidt-ThiemeMy friend at BCAI, Damir Shakirov, who guided me for hyper-parameter optimization with Bayesian Optimization.Img ShieldsBest-README-Template