energy_methods.lightgbm#

Deterministic monotone LightGBM alternative; concavity is not guaranteed.

Irradiance is constrained increasing and temperature decreasing. Tree-based monotonicity is weaker than the analytic concavity of the physics model. Fit only the accepted training partition and evaluate later chronological data.

Cite Ke et al. (2017) for LightGBM and Ascencio-Vásquez et al. (2020) for the PV application. The thesis provides related project context; see REFERENCE_IDS and energy_methods.references.

class energy_methods.lightgbm.LightGBMConfig(n_estimators: 'int' = 200, learning_rate: 'float' = 0.04, num_leaves: 'int' = 15, min_child_samples: 'int' = 20, min_samples: 'int' = 48, n_jobs: 'int' = 1, random_state: 'int' = 42)[source]#

Bases: object

Parameters:
  • n_estimators (int)

  • learning_rate (float)

  • num_leaves (int)

  • min_child_samples (int)

  • min_samples (int)

  • n_jobs (int)

  • random_state (int)

n_estimators: int#
learning_rate: float#
num_leaves: int#
min_child_samples: int#
min_samples: int#
n_jobs: int#
random_state: int#
class energy_methods.lightgbm.LightGBMModel(estimator: 'LGBMRegressor', config: 'LightGBMConfig', training_scale_mwh: 'float', training_rows: 'int', poa_support_wm2: 'tuple[float, float]', temperature_support_c: 'tuple[float, float]')[source]#

Bases: object

Parameters:
  • estimator (LGBMRegressor)

  • config (LightGBMConfig)

  • training_scale_mwh (float)

  • training_rows (int)

  • poa_support_wm2 (tuple[float, float])

  • temperature_support_c (tuple[float, float])

estimator: LGBMRegressor#
config: LightGBMConfig#
training_scale_mwh: float#
training_rows: int#
poa_support_wm2: tuple[float, float]#
temperature_support_c: tuple[float, float]#
to_dict()[source]#

Export LightGBM’s text model rather than unsafe pickle objects.

Return type:

dict[str, object]

predict(poa_wm2, temperature_c)[source]#

Mask invalid/out-of-domain weather and enforce the declared startup zero.

Parameters:
  • poa_wm2 (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])

  • temperature_c (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])

Return type:

FloatArray

weather_support(poa_wm2, temperature_c)[source]#
Parameters:
  • poa_wm2 (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])

  • temperature_c (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])

Return type:

BoolArray

class energy_methods.lightgbm.LightGBMFeatureModel(estimator, config, feature_names, training_rows)[source]#

Bases: object

General forecast-feature regression; distinct from the monotone PV interface.

Parameters:
  • estimator (LGBMRegressor)

  • config (LightGBMConfig)

  • feature_names (tuple[str, ...])

  • training_rows (int)

estimator: LGBMRegressor#
config: LightGBMConfig#
feature_names: tuple[str, ...]#
training_rows: int#
predict(features)[source]#
Parameters:

features (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])

Return type:

FloatArray

to_dict()[source]#

Export native model text; no unit transformation or implicit clipping.

Return type:

dict[str, object]

energy_methods.lightgbm.fit_lightgbm_features(features, target, *, feature_names=None, config=LightGBMConfig(n_estimators=200, learning_rate=0.04, num_leaves=15, min_child_samples=20, min_samples=48, n_jobs=1, random_state=42))[source]#

Fit arbitrary finite forecast features without PV-only monotonic assumptions.

The existing fit_lightgbm(poa, temperature, actual) API is unchanged. This interface also supports wind, lags and calendar variables. Feature creation and chronological splitting remain the caller’s responsibility.

Parameters:
  • features (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])

  • target (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])

  • feature_names (tuple[str, ...] | None)

  • config (LightGBMConfig)

Return type:

LightGBMFeatureModel

energy_methods.lightgbm.fit_lightgbm(poa_wm2, temperature_c, actual_mwh, *, config=LightGBMConfig(n_estimators=200, learning_rate=0.04, num_leaves=15, min_child_samples=20, min_samples=48, n_jobs=1, random_state=42))[source]#

Fit without random train/test splitting, early stopping or test-label access.

Parameters:
  • poa_wm2 (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])

  • temperature_c (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])

  • actual_mwh (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])

  • config (LightGBMConfig)

Return type:

LightGBMModel