Installation
Create conda environment
It is recommended to install hgboost
from an isolated Python environment. Using Conda this can be done as following:
conda create -n env_hgboost python=3.10
conda activate env_hgboost
Pypi
Install via pip
(recommended):
pip install hgboost
Github source
Install directly from github source (beta versions):
pip install git+https://github.com/erdogant/hgboost
Graphviz
Tree plots are created using the treeplot
package which contains the required graphviz libraries.
In general, it should work out of the box for both Windows and Unix machines. However, in some cases it does require a manual installation of the graphviz package.
Binaries for graphviz can be downloaded from the graphviz project homepage, and the Python wrapper installed from pypi with pip install graphviz.
If you use the conda package manager, the graphviz binaries and the python package can be installed with conda install python-graphviz.
conda install python-graphviz
If you use the pip package manager, try the Python wrapper installed from Pypi.
pip install graphviz
An alternative example is to download and install this for Unix machines:
sudo apt install python-pydot python-pydot-ng graphviz
# or
sudo apt install graphviz
For Mac OS install it as follows:
brew install graphviz
Quickstart
A quick example how to learn a model on a given dataset.
# Import library
from hgboost import hgboost
# Initialize with default settings
hgb = hgboost()
# Find best model on the data
results = hgb.xgboost(X, y, pos_label)
# Plot
ax = hgb.plot()
Uninstalling
Remove installation
Note that the removal of the environment will also remove the hgboost
installation.
# Install from Pypi:
pip uninstall hgboost