1000 Commits

Author SHA1 Message Date
James Lamb 644d71abf3 [python-package] remove unnecessary LGBM_BoosterGetCurrentIteration() call (#7350) 2026-07-24 20:45:28 -05:00
James Lamb c0d30b50c8 [docs] bump development version to 4.7.0.99 (#7370)
bump development version to 4.7.0.99
2026-07-22 07:41:04 -05:00
James Lamb 8f7036f036 release v4.7.0 (#7129) 2026-07-18 15:10:03 -05:00
James Lamb 497b57f203 [python-package] allow access to eval result attributes by name (#7161) 2026-07-18 12:19:51 -05:00
Max Zwager 96dfee9c68 [python-package] Allow to pass Arrow array & Polars series as position (#7260) 2026-07-18 16:29:23 +00:00
James Lamb 75c0190c70 [python-package] remove unnecessary old import paths in compat.py (#7358) 2026-07-14 16:15:33 +00:00
James Lamb cf16013c30 change default branch from 'master' to 'main' (#7287) 2026-07-09 21:54:12 -05:00
James Lamb 30adba2776 [CUDA] support CUDA 13, support user-supplied CUDA architecture list, update default GPU architectures (#7271) 2026-07-03 23:25:10 -05:00
James Lamb 5c40066497 [python-package] make some imports lazy: 'dask', 'graphviz', 'joblib', 'matplotlib', 'psutil' (#7340)
Co-authored-by: José Morales <jmoralz92@gmail.com>
2026-06-25 22:25:29 -05:00
Max Zwager ddcdbba023 [python-package] Make Dataset.set_position() update self.position (#7344) 2026-06-24 13:17:29 -05:00
James Lamb 8e4ba09aca [python-package] remove dependency on typing_extensions.TypeGuard (#7339) 2026-06-23 06:41:39 -05:00
Oliver Borchert 4299538a6f [c++][python-package] Leverage Arrow PyCapsule Interface for Arrow interoperability (including polars support) (#7275) 2026-06-20 13:06:46 +00:00
James Lamb 431d988230 [ci] use pixi to manage end-of-life Python environments (#7328)
Co-authored-by: Oliver Borchert <me@borchero.com>
Co-authored-by: Oliver Borchert <oliver.borchert@quantco.com>
2026-06-16 20:40:23 -05:00
James Lamb 2d15b31bc7 [python-package] [dask] remove an unnecessary check on Dask installation (#7332) 2026-06-07 22:19:26 -05:00
Francisco Romaldo Mendes 4475d4fbf6 [python-package] fix misleading feature name warning on sklearn 1.6+ predict() (#7232)
Co-authored-by: James Lamb <jaylamb20@gmail.com>
2026-05-24 22:24:54 -05:00
James Lamb a3734ed272 [python-package] publish nightlies to pypi.anaconda.org (#7245) 2026-05-17 05:30:14 +00:00
James Lamb eda8bdccf2 [ci] [R-package] fix docs build, test pkgdown build in CI (#7268)
Co-authored-by: James Lamb <jaylamb20@gmail.com>
2026-05-17 03:53:03 +08:00
Oliver Borchert 8490fde16a [python-package] Add official support for Python 3.14 (#7279)
* [python-package] Add official support for Python 3.14

* Fix lint

* Update .github/workflows/python_package.yml
2026-05-16 18:59:52 +00:00
Oliver Borchert d452cf8409 [python-package] Bump minimum pyarrow version to v16.0.0 (#7280)
* [python-package] Bump minimum pyarrow version to v16.0.0

* snappy
2026-05-17 01:27:47 +08:00
Oliver Borchert 634c864bc7 [python-package] Enable ruff rule B905 (#7278)
* [python-package] Enable ruff rule `B905`

* Use strict true

* Fix

* Fix

* Fix test
2026-05-16 10:57:01 +00:00
Oliver Borchert fe2673720a [python-package] Bump minimum supported Python version to 3.10 (#7276) 2026-05-15 10:15:04 -05:00
Oliver Borchert cf4121dd75 [python-package] Bump minimum pyarrow dependency version to v14.0.2 (#7277) 2026-05-14 19:26:44 -05:00
Arjun Prakash 2ccb9fd104 [python-package] fix misleading redundant parameter warnings in Booster.refit() (#7124)
Co-authored-by: James Lamb <jaylamb20@gmail.com>
2026-04-23 09:55:01 -05:00
James Lamb 4472f3901e [ci] adapt to scikit-learn ClassifierChain changes, fix {fs} install, work around pyarrow type-checking issues (#7236) 2026-04-22 23:13:23 -05:00
James Lamb a7d00a9611 [python-package] standardize variable naming for evaluation results (#7163) 2026-04-01 11:38:47 -05:00
CoderWota 180e35c47d [python-package] Add decision_function() to LGBMClassifier (#7159)
Co-authored-by: Wota <wota@wota.com>
Co-authored-by: James Lamb <jaylamb20@gmail.com>
2026-03-31 23:10:01 -05:00
James Lamb 1d878207fc [docs] [ci] Update docs and source code for org change (#7188)
* update organization reference, copyrights

* add note about the repo change

* make all GPU CI manual-only
2026-03-11 07:02:01 -05:00
Juan Flores 55a26969b7 [python-package] plot_importance(): raise clearer exception when model has 0 splits (#7160)
* [python-package] fix plot_importance() crash when model has 0 splits

* address review: use load_breast_cancer + min_data_in_bin

---------

Co-authored-by: Juan Flores <juanf-0gravity@users.noreply.github.com>
Co-authored-by: James Lamb <jaylamb20@gmail.com>
2026-03-01 14:17:55 -06:00
James Lamb fb973c0ecf [python-package] [dask] [ci] fix predict() type hints, enforce mypy in CI (#7140) 2026-02-12 21:11:04 -06:00
James Lamb 6af94aadf3 [python-package] use PEP 639 license metadata, bump toscikit-build-core>=0.11.0, use hatchling instead of setuptools (#7135) 2026-01-21 08:59:22 -06:00
Austin Wagner 56be785e0d [python-package] cast numpy integer to float in plot_importance ax.text call (#7130)
The y-coordinate passed to matplotlib's ax.text() was a numpy signedinteger from
np.arange(), but matplotlib's type stubs expect a Python float. This cast follows
the existing pattern in engine.py where float() is used to convert numpy values.

Co-authored-by: James Lamb <jaylamb20@gmail.com>
2026-01-19 17:30:24 +03:00
Christian Lorentzen bfa2951e32 [python-package] scikit-learn fit() methods: add eval_X, eval_y, deprecate eval_set (#6857)
* ENH add eval_X, eval_y, deprecate eval_set

* CLN eval_X, eval_y in all fit signatures

* ENH eval_X and eval_y in _DaskLGBMModel

* CLN appease ruff/linting

* FIX _validate_eval_set_Xy

* FIX dask

* MNT make eval_X and eval_y keyword only

* TST add test_eval_set_raises

* MNT apply review suggestion for test_eval_X_eval_y_eval_set_equivalence

* MNT make eval_X and eval_y keyword only also for Dask backend

* CLN remove whitespace

* MNT remove docstring modification of eval_sample_weight

* update examples, handle eval_group validation in LGBMRanker, make tests stricter

* Apply suggestions from code review

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

* Update tests/python_package_test/test_sklearn.py

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

* Update python-package/lightgbm/sklearn.py

* use version-deprecated, fix formatting

* use .. deprecated

* keyword-only arguments

* fix docs indentation

---------

Co-authored-by: Nikita Titov <nekit94-08@mail.ru>
Co-authored-by: James Lamb <jaylamb20@gmail.com>
2026-01-19 17:24:07 +03:00
James Lamb 8b5ebccba7 [python-package] enforce keyword-only args in more internal functions (#7111)
* [python-package] enforce keyword-only args in more internal functions

* keyword-only args for more early-stopping arguments
2026-01-19 17:12:09 +03:00
James Lamb c70d8aab81 [python-package] support all-0 sample weights in scikit-learn 1.9 (#7128) 2026-01-17 19:43:14 -06:00
Austin Wagner cd7898c3eb [python-package] Add return type annotations to predict methods in sklearn module (#7116)
* [python-package] Add return type annotations to predict methods in sklearn module

Add return type annotations to LGBMModel.predict, LGBMClassifier.predict, and LGBMClassifier.predict_proba methods. The predict_proba method requires an isinstance assertion for type narrowing in the binary classification branch, since predict() returns a union type but only returns np.ndarray when pred_contrib=False. This follows the existing error message pattern used in _get_label_from_constructed_dataset and similar helper functions.

Fixes: https://github.com/microsoft/LightGBM/issues/3867

* [python-package] Add shared _LGBM_PredictReturnType type alias for predict methods

Add _LGBM_PredictReturnType type alias in basic.py and use it in _InnerPredictor.predict(),
Booster.predict(), LGBMModel.predict(), LGBMClassifier.predict(), and LGBMClassifier.predict_proba().

Also add assert isinstance() with error message in predict_proba() for type narrowing when
returning binary classification results.

This keeps the return type DRY and ensures consistency across the codebase.

* Update python-package/lightgbm/basic.py

---------

Co-authored-by: James Lamb <jaylamb20@gmail.com>
2026-01-17 17:03:37 -06:00
Austin Wagner 33e93d602d [python-package] add Literal type annotation for order variable in _np2d_to_np1d (#7118)
* [python-package] add Literal type annotation for order variable in _np2d_to_np1d

The order variable was inferred as str but numpy.asarray expects Literal['K', 'A', 'C', 'F']. Added explicit Literal["C", "F"] type annotation before the conditional assignment. This resolves the mypy call-overload error for np.asarray at line 201.
2026-01-06 07:55:31 -06:00
Austin Wagner 1456356dc7 [python-package] Add DTypeLike annotation to fix dtype assignment in _np2d_to_np1d (#7117)
[python-package] Add DTypeLike annotation to fix dtype assignment type in _np2d_to_np1d

Add type annotation for dtype variable to resolve mypy assignment error.
This follows the existing pattern used elsewhere in basic.py (lines 337, 364, 463, 800, 2795).

Co-authored-by: James Lamb <jaylamb20@gmail.com>
2026-01-06 07:49:02 -06:00
Austin Wagner c99526f548 [python-package] use positional args for np.arange in _InnerPredictor (#7119)
The numpy stubs define arange with positional-only parameters so keyword
arguments start=, stop=, step= do not match any overload. Changed to
positional arguments np.arange(_MAX_INT32, nrow, _MAX_INT32) which matches
the numpy stubs correctly and resolves the mypy call-overload errors.

Co-authored-by: James Lamb <jaylamb20@gmail.com>
2026-01-06 07:45:16 -06:00
Austin Wagner 96cc6723f7 [python-package] Add TypeGuard return type to _is_pyarrow_table() for mypy type narrowing (#7115)
Change _is_pyarrow_table() return type from bool to TypeGuard[pa_Table] to enable mypy type narrowing at all call sites. This follows the existing pattern used by _is_pyarrow_array() and allows mypy to recognize data.column_names as valid when extracting feature names from PyArrow tables.

Fixes: https://github.com/microsoft/LightGBM/issues/3867

Co-authored-by: James Lamb <jaylamb20@gmail.com>
2026-01-05 13:45:30 -06:00
James Lamb 52659d47a2 [ci] move GPU and NuGet jobs to GitHub Actions, remove Azure DevOps (#7106)
* [ci] move GPU and NuGet jobs to GitHub Actions, remove Azure DevOps

* try moving NuGet package over

* delete .vsts-ci

* fix aliases

* install mono

* sudo

* make upload-artifact stricter

* restore all CI

* Apply suggestions from code review

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

* more updates

---------

Co-authored-by: Nikita Titov <nekit94-08@mail.ru>
2025-12-21 16:24:21 -06:00
James Lamb 2e7e35e4f0 [python-package] fix mypy errors about __sklearn_tags__() (#7107) 2025-12-18 16:54:07 +03:00
Nikita Titov 32781bae00 [ci] move mypy to pre-commit (#7062) 2025-10-15 22:21:45 -05:00
Nikita Titov 6368375b62 [ci][docs] fix link checking action by switching from linkchecker to lychee and update some links (#7027) 2025-10-11 00:21:09 -05:00
Yusuke Horibe f981fba730 [python-package] add PyArrow Table to get_data (#6911)
Co-authored-by: Nikita Titov <nekit94-08@mail.ru>
Co-authored-by: James Lamb <jaylamb20@gmail.com>
2025-09-12 18:42:31 -05:00
Oliver Borchert 0ffd2a3af4 [python-package] Fix mypy checks in engine.py (#6900)
* [python-package] Fix mypy checks in `engine.py`

* Update python-package/lightgbm/engine.py

---------

Co-authored-by: James Lamb <jaylamb20@gmail.com>
2025-08-27 03:21:38 +03:00
James Lamb 97ff708708 [ci] use 'pre-commit' to run 'rstcheck' (#6989)
Co-authored-by: Nikita Titov <nekit94-08@mail.ru>
2025-08-12 21:15:23 -05:00
James Lamb ccc06d1902 [docs] [python-package] document how to run Python tests (#6995)
* [docs] [python-package] document how to run Python tests

* refer to installation instructions

---------

Co-authored-by: Nikita Titov <nekit94-08@mail.ru>
2025-08-13 03:47:38 +03:00
James Lamb 16ca335b4a [ci] update pre-commit versions, add some pixi things to config files (#6986) 2025-08-03 22:01:25 -05:00
Oliver Borchert 915c2706aa [ci] Drop support for Python 3.7 and Python 3.8 (#6896)
* [ci] Drop support for Python 3.7 and Python 3.8

* Fix

* Bump numpy

* Fix

* fix comment, revert unrelated quoting changes

* add docs

---------

Co-authored-by: Nikita Titov <nekit94-08@mail.ru>
Co-authored-by: James Lamb <jaylamb20@gmail.com>
2025-07-30 01:43:57 +03:00
Oliver Borchert 2a5e33b79d [python-package] Fix mypy checks in compat.py (#6898)
Co-authored-by: James Lamb <jaylamb20@gmail.com>
2025-07-28 22:22:01 -05:00