Граф коммитов

28 Коммитов

Автор SHA1 Сообщение Дата
James Lamb 631e0a2a7b
[ci] prevent trailing whitespace, ensure files end with newline (#6373) 2024-03-18 23:24:14 -05:00
Scott Votaw 0957ab72f7
Add SWIG byte pointers (#5832) 2023-05-11 10:52:28 -05:00
Scott Votaw 0a5c5838eb
feature: Add true streaming APIs to reduce client-side memory usage (#5299)
* Extract streaming to own PR

* small merge fixes and cleanup

* linting fixes

* fix cast warning

* Fix accidental deletion during branch transfer

* responded to initial triage comments

* Added more tests to use create-from-samples APIs

* added mutex and adjusted nclasses logic

* Fix thread-safety for pushing data to sparse bins through Push APIs

* lint and doc fixes

* Small SWIG fix

* nit fix

* Responded to StrikerRUS comments

* fix breaking change after merge with master

* Extract streaming to own PR

* small merge fixes and cleanup

* Fix accidental deletion during branch transfer

* responded to initial triage comments

* Added more tests to use create-from-samples APIs

* Fix rstcheck call in ci

* remove TODOs

* Extract streaming to own PR

* small merge fixes and cleanup

* Fix accidental deletion during branch transfer

* responded to initial triage comments

* Added more tests to use create-from-samples APIs

* Small SWIG fix

* remove ci change

* responded to shiyu1994 comments

* responded to StrikerRUS comments

* Fixes from StrikerRUS comments
2022-08-10 16:31:32 +08:00
Nikita Titov 6a195a1bec
[SWIG] fix compiler warning about unused variable in SWIG (#4419)
* Update StringArray.i

* Update StringArray_API_extensions.i
2021-06-30 14:16:02 +03:00
Roman Grebennikov 434573eef2
[swig] add wrapper for LGBM_DatasetGetFeatureNames (#4103) 2021-04-15 22:34:35 +03:00
Nikita Titov 7bf81f8c6d
[ci] apply cpplint to cpp tests (#4092)
* Update chunked_array.hpp

* Update ChunkedArray_API_extensions.i

* Update StringArray.i

* apply cpplint to cpp tests

* Update test_chunked_array to please cpplint (#4121)

* Update test_chunked_array to please cpplint

* Simplify var name

* Add comment

Co-authored-by: Alberto Ferreira <AlbertoEAF@users.noreply.github.com>
2021-03-28 15:52:42 +03:00
Alberto Ferreira 4ded1342ae
[SWIG] Add streaming data support + cpp tests (#3997)
* [feature] Add ChunkedArray to SWIG

* Add ChunkedArray
* Add ChunkedArray_API_extensions.i
* Add SWIG class wrappers

* Address some review comments

* Fix linting issues

* Move test to tests/test_ChunkedArray_manually.cpp

* Add test note

* Move ChunkedArray to include/LightGBM/utils/

* Declare more explicit types of ChunkedArray in the SWIG API.

* Port ChunkedArray tests to googletest

* Please C++ linter

* Address StrikerRUS' review comments

* Update SWIG doc & disable ChunkedArray<int64_t>

* Use CHECK_EQ instead of assert

* Change include order (linting)

* Rename ChunkedArray -> chunked_array files

* Change header guards

* Address last comments from StrikerRUS
2021-03-21 15:07:21 +03:00
Roman Grebennikov a60d45c56d
[SWIG] add size_t manipulation functions (#3895) 2021-02-06 02:55:32 +03:00
Alberto Ferreira 716451b102
[refactor] SWIG - Split pointer manipulation to individual .i file (#3538)
* [refactor] SWIG - Split pointer manipulation to individual .i file

* Update module docstring

* space
2020-11-24 12:49:49 +08:00
Nikita Titov 7a51ae042a
fix type casting warning (#3437) 2020-10-07 13:02:25 +03:00
shiyu1994 82e2ff7a01
[Python] / [R] add start_iteration to python predict interface (fix #3058) (#3272)
* [python] add start_iteration to python predict interface (#3058)

* Apply suggestions from code review

* Update lightgbm_R.h

* Apply suggestions from code review

* Apply suggestions from code review

* fix R interface

* update R documentation

Co-authored-by: Guolin Ke <guolin.ke@outlook.com>
2020-08-06 20:40:33 +08:00
Alberto Ferreira b5027de349
Fast single row predict API v2 (#3268)
* Fix bug introduced in PR #2992 for Fast predict

* Faster Fast predict API

* Add const to SingleRow Fast methods
2020-08-05 23:05:20 +08:00
Nikita Titov 5056057348
[SWIG] removed commented code (#3233) 2020-07-20 20:33:57 +08:00
Alberto Ferreira fc79b36615
Feat/optimize single prediction (#2992)
* [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: Nikita Titov <nekit94-08@mail.ru>

* fix doxygen typo include/LightGBM/c_api.h

Co-authored-by: Nikita Titov <nekit94-08@mail.ru>

* fix doxygen typo include/LightGBM/c_api.h

Co-authored-by: Nikita Titov <nekit94-08@mail.ru>

* Doxygen: change new docstrings to double back-quote

Co-authored-by: alberto.ferreira <alberto.ferreira@feedzai.com>
Co-authored-by: Nikita Titov <nekit94-08@mail.ru>
2020-07-15 22:50:56 +03:00
Guolin Ke 87d46489f3
feature importance type in saved model file (#3220)
* feature importance type in saved model file

* fix nullptr

* fixed formatting

* fix python/R

* Update src/c_api.cpp

* Apply suggestions from code review

Co-authored-by: James Lamb <jaylamb20@gmail.com>

* fix c_api test

* fix swig

* minor docs improvements and added defines for importance types

Co-authored-by: StrikerRUS <nekit94-12@hotmail.com>
Co-authored-by: James Lamb <jaylamb20@gmail.com>
2020-07-15 22:18:53 +03:00
Ilya Matiach 0d3e204653
[SWIG][mmlspark] allow allocating more than int max array (#2859) 2020-04-19 16:34:43 +03:00
Ilya Matiach 6ba84d540c
[SWIG][mmlspark] fix seg fault in LGBM_BoosterGetEvalNamesSWIG (#2958) 2020-04-01 17:25:09 +03:00
Alberto Ferreira 91185c3aa4
Fix SWIG methods that return char** (#2850)
* [swig] Fix SWIG methods that return char** with StringArray.

+ [new] Add StringArray class to manage and manipulate arrays of fixed-length strings:

  This class is now used to wrap any char** parameters, manage memory and
  manipulate the strings.

  Such class is defined at swig/StringArray.hpp and wrapped in StringArray.i.

+ [API+fix] Wrap LGBM_BoosterGetFeatureNames it resulted in segfault before:

  Added wrapper LGBM_BoosterGetFeatureNamesSWIG(BoosterHandle) that
  only receives the booster handle and figures how much memory to allocate
  for strings and returns a StringArray which can be easily converted to String[].

+ [API+safety] For consistency, LGBM_BoosterGetEvalNamesSWIG was wrapped as well:

  * Refactor to detect any kind of errors and removed all the parameters
    besides the BoosterHandle (much simpler API to use in Java).
  * No assumptions are made about the required string space necessary (128 before).
  * The amount of required string memory is computed internally

+ [safety] No possibility of undefined behaviour

  The two methods wrapped above now compute the necessary string storage space
  prior to allocation, as the low-level C API calls would crash the process
  irreversibly if they write more memory than which is passed to them.

* Changes to C API and wrappers support char**

To support the latest SWIG changes that enable proper char**
return support that is safe, the C API was changed.

The respecive wrappers in R and Python were changed too.

* Cleanup indentation in new lightgbm_R.cpp code

* Adress review code-style comments.

* Update swig/StringArray.hpp

Co-Authored-By: Nikita Titov <nekit94-08@mail.ru>

* Update python-package/lightgbm/basic.py

Co-Authored-By: Nikita Titov <nekit94-08@mail.ru>

* Update src/lightgbm_R.cpp

Co-Authored-By: Nikita Titov <nekit94-08@mail.ru>

Co-authored-by: alberto.ferreira <alberto.ferreira@feedzai.com>
Co-authored-by: Nikita Titov <nekit94-08@mail.ru>
2020-03-20 04:05:38 +03:00
Joan Fontanals 3e3d76f64b [Java] MMLSPARK-ISSUE-720 - Create SWIG version of BoosterDumpModel that returns string to be used in Java (#2560) 2019-11-13 16:47:16 +03:00
Ilya Matiach 7b2963d9a5 [Java] add missing JNI exception checks to fix warnings (#2405)
* add missing JNI exception checks to fix warnings

* updated based on comments

* removed rethrow logic

* replace tabs with spaces
2019-09-26 13:01:26 +08:00
Ilya Matiach 254a8699c9 [java][mmlspark] fix lightgbm on windows (#2364) 2019-08-30 09:59:54 +08:00
Nikita Titov 716fe4d015
fixed cpplint errors about spaces and indents (#2282) 2019-07-25 14:46:59 +03:00
Ilya Matiach 7156c9b09e [SWIG] fix swig build warnings/errors on windows (#2141) 2019-05-04 21:39:20 +03:00
Ilya Matiach de82ed5851 [SWIG] added typemap for string arrays in SWIG interface (#2118)
* added typemap for string arrays in SWIG interface

* added voidp pointer casts
2019-04-29 16:43:29 +08:00
Markus Cozowicz beeb6e0fd5 Added additional APIs to better support JNI on Spark (#2032)
* added API changes required for JNI performance optimizations (e.g. predict is 3-4x faster)

* removed commented variables

* removed commented header

* renamed method to make it obvious it is created for Spark

* fixed comment alignment

* replaced GetPrimitiveArrayCritical with GetIntArrayElements for training. fixed dead-lock on databricks
2019-03-19 07:37:48 +08:00
Ilya Matiach 95246cdaec lightgbm SWIG Java wrapper changes needed to add early stopping in mmlspark (#2047)
* lightgbm SWIG Java wrapper changes needed to add early stopping in mmlspark

* updated based on comments
2019-03-16 14:29:41 +08:00
Ilya Matiach 08c82ee6ec update LightGBM SWIG wrapper (#1610) 2018-08-25 16:20:42 +08:00
Ilya Matiach 6d58decf51 Adding SWIG Java wrappers to LightGBM (#1223)
* Adding Java wrappers to LightGBM by updating CMakeLists and adding SWIG file

* Set SWIG generation to OFF by default

* Added -package option to SWIG_FLAGS

* Fixed jar structure to have class files in proper location

* removed link with OpenMP flags
2018-01-31 14:20:41 +08:00