Skip to content

[RFC] [R-package] Remove support for passing parameters through '...' #4226

@jameslamb

Description

@jameslamb

Question

I'm opening this request for comment (RFC) to get feedback on the following proposal, originally mentioned in #4202 (comment).

In its next major release, should {lightgbm} remove support for passing parameters through ... in function calls?

This would apply to:

  • lgb.cv()
  • lgb.Dataset()
  • lgb.Dataset.create.valid()
  • lgb.train()
  • lightgbm()

Description

LightGBM's core library supports many parameters, documented at https://lightgbm.readthedocs.io/en/latest/Parameters.html. The exported functions in {lightgbm} (the R package), support at least 3 different ways to pass values for these parameters.

  • in a named list called params
  • (for some parameters) via explicit keyword arguments
  • via implicit keyword arguments with ...

For example, the following calls to lightgbm::lightgbm() are all equally valid ways to say "perform 14 boosting rounds".

library(lightgbm)

data(agaricus.train, package = "lightgbm")
train <- agaricus.train

# option 1 - params
bst <- lightgbm(
    data = train$data
    , label = train$label
    , objective = "binary"
    , params = list(
        num_iterations = 14L
    )
)

# option 2 - explicit keyword argument ("nrounds")
bst <- lightgbm(
    data = train$data
    , label = train$label
    , objective = "binary"
    , nrounds = 14L
)

# option 3 - passing params through ...
bst <- lightgbm(
    data = train$data
    , label = train$label
    , objective = "binary"
    , num_iterations = 14L
)

Motivation

pros

cons

  • breaks existing code that relies on the ... behavior
    • NOTE: maintainers have agreed that the next LightGBM release will be a 4.0.0 release, so this breaking change by itself wouldn't force a new major version of LightGBM

References

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions