Skip to content

viluiz/fortran2xgb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fortran2xgb

Fortran API for XGBoost

Interface for calling XGBoost from Fortran. The idea is to train an XGBoost model externally, e.g. in Python, then save that model to disk (in the XGBoost internal binary format, e.g. using Booster.save_model() in Python), and later call the model from Fortran to make a prediction. The Fortran wrappers that invoke the XGBoost C functions are in xgb_fortran_api.F90. A Fortran test application that creates a very simple XGBoost model and then calls the Fortran wrappers is given in xgb_train.py and xgboost_test.F90, respectively.

Requirements

A Python version of XGBoost is required (https://github.com/dmlc/xgboost/tree/master/python-package/xgboost) and needs to be pointed at properly in the GNUmakefile. All tests done with version 0.82.

Example

  1. Create dummy xgbooster model and save to file (bst_from_py.bin):

python xgb_train.py

  1. Compile and execute Fortran code:

make

About

Call XGBoost from Fortran

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Fortran 76.4%
  • Python 17.1%
  • Makefile 6.5%