Install LightGBM and CatBoost on Ubuntu 22.04

Install high performance algorithms (LightGBM, CatBoost & XGBoost) on your Linux device
Linux
LightGBM
CatBoost
XGBoost
Author

stesiam

Published

November 13, 2022

Introduction

When someone starts with Machine Learning he usually starts to build some simple models as logistic regression, naive Bayes, linear regression etc. And those alone are already enough for most use cases, as their simplicity is productivity-friendly and comes up with adequate accuracy. However, in enterprise level, accuracy can be important for a lot of reasons. Gradient Boosting Machines are some algorithms which outperform the aforementioned methods and are not complex enough to use them. Of course, before we build the model with (e.g. tidymodels) we have to install them.

Error - Missing LightGBM install

Thus, on this article I gather all that information.

Installation Guides Source
LightGBM Link
CatBoost Link
XGBoost Link

LightGBM

Option 1. Install R Package

If you are reading this blog, the most possible scenario in that you are using R too. The most easy way to install the corresponding R package :

R code
start_time_lightgbm <- Sys.time()
install.packages("lightgbm", repos = "https://cran.r-project.org")
end_time_lightgbm <- Sys.time()

Option 2. CMAKE

The LightGBM documentation are referring to this method of installation.

Terminal
sudo apt install cmake
Terminal
git clone --recursive https://github.com/microsoft/LightGBM
cd LightGBM
mkdir build
cd build
cmake ..
make -j4

CatBoost

Their realeases.

R code
install.packages("devtools")

On my occassion, when I tried to install devtools had an error status. According to my error status I had to add packages libharfbuzz-dev and libfribidi-dev. After that, my devtools installation completed without errors.

R code
start_time_catboost <- Sys.time()
devtools::install_url("https://github.com/catboost/catboost/releases/download/v1.1.1/catboost-R-Linux-1.1.1.tgz"[, INSTALL_opts = c("--no-multiarch", "--no-test-load")])
end_time_catboost <- Sys.time()

XGBoost

R code
start_time_xgboost <- Sys.time()
install.packages("xgboost")
end_time_xgboost <- Sys.time()

Summary

ML Model Method Installation time
LightGBM R package 7.79 min.
CatBoost R package (w/o devtools) 2.1 min.
XGBoost R package 6.16 min.

Citation

BibTeX citation:
@online{2022,
  author = {, stesiam},
  title = {Install {LightGBM} and {CatBoost} on {Ubuntu} 22.04},
  date = {2022-11-13},
  url = {https://www.stesiam.com//english-posts/2022-11-13-Install-LightGBM-CatBoost-Ubuntu},
  langid = {en}
}
For attribution, please cite this work as:
stesiam. (2022, November 13). Install LightGBM and CatBoost on Ubuntu 22.04. Retrieved from https://www.stesiam.com//english-posts/2022-11-13-Install-LightGBM-CatBoost-Ubuntu