Skip to content

[CUDA] [python-package] Regarding the time consumption of training LightGBM with CUDA #6982

@Jessee-Jiao

Description

@Jessee-Jiao

Hi, here's the context regarding the three potential issues you mentioned earlier:

First, my dataset size is in the millions (referring to the number of rows, sometimes close to ten million), and the number of features is about 250. Is this number of columns considered small, as you mentioned? I'm not sure.

Second, I did use a custom metric function: R-squared. The specific code is as follows:

def r2_metric(pred, dtrain):
    label = dtrain.get_label()
    
    loss = (pred - label) ** 2
    var = (label - np.mean(label)) ** 2
    
    r2 = 1 - sum(loss) / sum(var)
    return 'r2', r2, True

Lastly, the training time I measured, which showed almost no improvement, refers solely to the time taken by lgb.train(), excluding other times such as data loading, plotting, etc.

I will provide some details about the parameter settings below, excluding classic parameters like learning rate, number of leaves, depth, etc. (I don’t think these are relevant to this issue).


'device': 'cuda' if use_cuda else 'cpu',
'gpu_platform_id': 0,
'gpu_device_id': 1,
'tree_type': 'data_parallel',
'gpu_use_dp': True,


'verbosity': -10,
'n_jobs': 32,

evals_result = {}

callbacks = [log_evaluation(period=40), early_stopping(stopping_rounds), record_evaluation(evals_result)]

gbm = lgb.train(
    params,
    lgb_train,
    num_boost_round=400,
    feval=r2_metric,
    valid_sets=[lgb_train, lgb_valid],
    valid_names=['train', 'validation'],
    callbacks=callbacks,
)

Additionally, I’d like to mention that I used Optuna for hyperparameter tuning. Could this have any impact? (However, the training time I mentioned above still refers to the time taken for a single training run with one set of parameters.) I’m sorry, but I also want to point out that when I switched to GPU with CatBoost and used Optuna, the training speed improved significantly. However, with LightGBM, there was no such improvement. Moreover, CatBoost doesn’t support GPU computation for R-squared, but that doesn’t affect its speed. I really need to use LightGBM, so I’m quite confused. Sorry again.
Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    gpu (CUDA)Issue is related to the CUDA GPU variant.question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions