• Alberto Ferreira's avatar
    Feat/optimize single prediction (#2992) · fc79b366
    Alberto Ferreira authored
    * [performance] Add Fast methods to C API for SingleRow Predictions
    
     * Add methods to C API to make single-row predictions faster:
    
       - LGBM_BoosterPredictForMatSingleRowFastInit (setup)
       - LGBM_BoosterPredictForMatSingleRowFast (predict)
       - LGBM_FastConfigFree (cleanup setup outputs)
    
    * Code syle cleanup
    
    * Fix lint errors
    
    * [performance] Revert FastConfig improvement to pass data at init
    
    This reduces optimization by 5% / 30% with this branch but makes it so it can be used for higher level wrappers in MMLSpark.
    And outside it as well.
    
    * [performance] Introduce Fast variants for SingleRow predictors.
    
    Although this already provides performance gains by itself for any
    callers, two new functions were added to Java's SWIG interfaces to
    exploit that AND the GetPrimitiveArrayCritical data fetches.
    
    * [tests/profiling] Profile Fast predict methods
    
    Build with -DBUILD_PROFILING_TESTS=ON and copy the default
    model trained on the Higgs dataset from the benchmarks repo
    
     https://github.com/guolinke/boosting_tree_benchmarks.git
    
    
    
    to LightGBM repo root and run the lightgbm_profile_* binaries.
    
    The single instance used is the first row from that dataset.
    
    * Update comment on CMakeLists.
    
    * Fix doxygen-introduced issue (#threads)
    
    * Fix conflicts due to new RowFunctionFromCSR signature in master
    
    * Change FastConfig ncol to int32_t.
    
    * Removed profiling folder
    
    * fix doxygen typo include/LightGBM/c_api.h
    Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>
    
    * fix doxygen typo include/LightGBM/c_api.h
    Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>
    
    * fix doxygen typo include/LightGBM/c_api.h
    Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>
    
    * Doxygen: change new docstrings to double back-quote
    Co-authored-by: default avataralberto.ferreira <alberto.ferreira@feedzai.com>
    Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>
    fc79b366
c_api.cpp 94.5 KB