LGBMs

LightGBM model implementations.

class openadmet.models.architecture.lgbm.LGBMClassifierModel(*, boosting_type: str = 'gbdt', num_leaves: int = 31, max_depth: int = -1, learning_rate: float = 0.1, n_estimators: int = 100, subsample_for_bin: int = 200000, objective: str | None = None, class_weight: str | None = None, min_split_gain: float = 0.0, min_child_weight: float = 0.001, min_child_samples: int = 20, subsample: float = 1.0, subsample_freq: int = 0, colsample_bytree: float = 1.0, reg_alpha: float = 0.0, reg_lambda: float = 0.0, random_state: int | None = None, n_jobs: int | None = None, importance_type: str = 'split', verbose: int = -1)[source]

Bases: LGBMModelBase

LightGBM classification model.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

predict_proba(X: ndarray) ndarray[source]

Predict using the model.

type: ClassVar[str] = 'LGBMClassifierModel'
class openadmet.models.architecture.lgbm.LGBMModelBase(*, boosting_type: str = 'gbdt', num_leaves: int = 31, max_depth: int = -1, learning_rate: float = 0.1, n_estimators: int = 100, subsample_for_bin: int = 200000, objective: str | None = None, class_weight: str | None = None, min_split_gain: float = 0.0, min_child_weight: float = 0.001, min_child_samples: int = 20, subsample: float = 1.0, subsample_freq: int = 0, colsample_bytree: float = 1.0, reg_alpha: float = 0.0, reg_lambda: float = 0.0, random_state: int | None = None, n_jobs: int | None = None, importance_type: str = 'split', verbose: int = -1)[source]

Bases: PickleableModelBase

Base class for LightGBM models.

boosting_type: str
build()[source]

Prepare the model.

class_weight: str | None
colsample_bytree: float
importance_type: str
learning_rate: float
max_depth: int
min_child_samples: int
min_child_weight: float
min_split_gain: float
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

n_estimators: int
n_jobs: int | None
num_leaves: int
objective: str | None
predict(X: ndarray, **kwargs) ndarray[source]

Predict using the model.

Parameters:
  • X (np.ndarray) – Featurized data to predict on

  • kwargs (dict) – Additional keyword arguments to pass to the predict method of the LightGBM model

Returns:

Predictions from the model

Return type:

np.ndarray

random_state: int | None
reg_alpha: float
reg_lambda: float
subsample: float
subsample_for_bin: int
subsample_freq: int
train(X: ndarray, y: ndarray)[source]

Train the model.

Parameters:
  • X (np.ndarray) – Training data features

  • y (np.ndarray) – Training data values

type: ClassVar[str]
verbose: int
class openadmet.models.architecture.lgbm.LGBMRegressorModel(*, boosting_type: str = 'gbdt', num_leaves: int = 31, max_depth: int = -1, learning_rate: float = 0.1, n_estimators: int = 100, subsample_for_bin: int = 200000, objective: str | None = None, class_weight: str | None = None, min_split_gain: float = 0.0, min_child_weight: float = 0.001, min_child_samples: int = 20, subsample: float = 1.0, subsample_freq: int = 0, colsample_bytree: float = 1.0, reg_alpha: float = 0.0, reg_lambda: float = 0.0, random_state: int | None = None, n_jobs: int | None = None, importance_type: str = 'split', verbose: int = -1)[source]

Bases: LGBMModelBase

LightGBM regression model.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

type: ClassVar[str] = 'LGBMRegressorModel'