Skip to content

LgbDataset

LgbDataset

Wrapper for LightGBM Dataset providing factrainer-compatible interface.

This class wraps a native lgb.Dataset to provide a consistent interface for cross-validation and data manipulation within the factrainer framework. This dataset is passed to the train and predict methods of SingleModelContainer and CvModelContainer when using LightGBM models.

Attributes:

Name Type Description
dataset Dataset

The underlying LightGBM Dataset instance containing features, labels, and optional metadata like weights, groups, and init scores.

Examples:

>>> import numpy as np
>>> import lightgbm as lgb
>>> from factrainer.lightgbm import LgbDataset
>>> # Create from numpy arrays
>>> X = np.random.randn(100, 10)
>>> y = np.random.randn(100)
>>> lgb_data = lgb.Dataset(X, label=y)
>>> dataset = LgbDataset(dataset=lgb_data)
>>> # Create with additional metadata
>>> weights = np.random.rand(100)
>>> lgb_data = lgb.Dataset(X, label=y, weight=weights)
>>> dataset = LgbDataset(dataset=lgb_data)

Attributes

dataset instance-attribute

dataset: Dataset