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:
LGBMModelBaseLightGBM 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.
- 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:
PickleableModelBaseBase class for LightGBM models.
- build()[source]
Prepare the 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(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
- train(X: ndarray, y: ndarray)[source]
Train the model.
- Parameters:
X (np.ndarray) – Training data features
y (np.ndarray) – Training data values
- 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:
LGBMModelBaseLightGBM regression model.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].