pylastmlextension.models package

Submodules

pylastmlextension.models.classifier_model module

Binary classification model using LightGBM with Optuna hyperparameter optimization.

class pylastmlextension.models.classifier_model.ClassifierModel(name, feature_schema, n_trials, metric='binary_logloss', cv=5, is_unbalance=False, scale_pos_weight=None)[source]

Bases: LightGBMBaseModel

Binary classification model using LightGBM. The hyperparameters are optimized by Optuna.

Parameters:
  • name (str) – Model name.

  • feature_schema (Dict[str, Dict[str, str]]) – Schema of the features.

  • n_trials (int) – Number of Optuna trials for hyperparameter optimization.

  • metric (str, default="binary_logloss") – Evaluation metric for optimization.

  • cv (int, default=5) – Number of cross-validation folds.

  • is_unbalance (bool, default=False) – Set to True if signal/background classes are unbalanced. This tells LightGBM to handle class imbalance automatically.

pylastmlextension.models.lightgbm_base module

LightGBM base model with Optuna hyperparameter optimization.

class pylastmlextension.models.lightgbm_base.LightGBMBaseModel(name, feature_schema, n_trials, metric, cv=5)[source]

Bases: BaseModel

Base class for LightGBM models with Optuna hyperparameter optimization. Subclasses should implement task-specific methods like _get_objective().

pylastmlextension.models.quantile_model module

Quantile regression model using LightGBM with Optuna hyperparameter optimization.

class pylastmlextension.models.quantile_model.QuantileRegressionModel(name, feature_schema, n_trials, alpha=0.5, metric='quantile', cv=5)[source]

Bases: LightGBMBaseModel

Quantile regression model using LightGBM. The hyperparameters are optimized by Optuna.

This model predicts a specific quantile of the conditional distribution of the target variable, rather than the conditional mean.

Parameters:
  • name (str) – Model name.

  • feature_schema (Dict[str, Dict[str, str]]) – Schema of the features.

  • n_trials (int) – Number of Optuna trials for hyperparameter optimization.

  • alpha (float, default=0.5) – The quantile to predict. Must be in (0, 1). For example, alpha=0.5 predicts the median, alpha=0.1 predicts the 10th percentile, alpha=0.9 predicts the 90th percentile.

  • metric (str, default="quantile") – Evaluation metric for optimization.

  • cv (int, default=5) – Number of cross-validation folds.

pylastmlextension.models.regression_model module

Regression model using LightGBM with Optuna hyperparameter optimization.

class pylastmlextension.models.regression_model.RegressionModel(name, feature_schema, n_trials, metric='rmse', cv=5)[source]

Bases: LightGBMBaseModel

Regression model using LightGBM. The hyperparameters are optimized by Optuna.

Module contents

LightGBM-based models with Optuna hyperparameter optimization.

class pylastmlextension.models.ClassifierModel(name, feature_schema, n_trials, metric='binary_logloss', cv=5, is_unbalance=False, scale_pos_weight=None)[source]

Bases: LightGBMBaseModel

Binary classification model using LightGBM. The hyperparameters are optimized by Optuna.

Parameters:
  • name (str) – Model name.

  • feature_schema (Dict[str, Dict[str, str]]) – Schema of the features.

  • n_trials (int) – Number of Optuna trials for hyperparameter optimization.

  • metric (str, default="binary_logloss") – Evaluation metric for optimization.

  • cv (int, default=5) – Number of cross-validation folds.

  • is_unbalance (bool, default=False) – Set to True if signal/background classes are unbalanced. This tells LightGBM to handle class imbalance automatically.

class pylastmlextension.models.LightGBMBaseModel(name, feature_schema, n_trials, metric, cv=5)[source]

Bases: BaseModel

Base class for LightGBM models with Optuna hyperparameter optimization. Subclasses should implement task-specific methods like _get_objective().

class pylastmlextension.models.QuantileRegressionModel(name, feature_schema, n_trials, alpha=0.5, metric='quantile', cv=5)[source]

Bases: LightGBMBaseModel

Quantile regression model using LightGBM. The hyperparameters are optimized by Optuna.

This model predicts a specific quantile of the conditional distribution of the target variable, rather than the conditional mean.

Parameters:
  • name (str) – Model name.

  • feature_schema (Dict[str, Dict[str, str]]) – Schema of the features.

  • n_trials (int) – Number of Optuna trials for hyperparameter optimization.

  • alpha (float, default=0.5) – The quantile to predict. Must be in (0, 1). For example, alpha=0.5 predicts the median, alpha=0.1 predicts the 10th percentile, alpha=0.9 predicts the 90th percentile.

  • metric (str, default="quantile") – Evaluation metric for optimization.

  • cv (int, default=5) – Number of cross-validation folds.

class pylastmlextension.models.RegressionModel(name, feature_schema, n_trials, metric='rmse', cv=5)[source]

Bases: LightGBMBaseModel

Regression model using LightGBM. The hyperparameters are optimized by Optuna.