Skip to content

feat: Add LightGBM model with enhanced feature engineering (Issue #30) - #336

Closed
Raakshass wants to merge 3 commits into
openclimatefix:mainfrom
Raakshass:feat/new-model-challenge-issue30
Closed

feat: Add LightGBM model with enhanced feature engineering (Issue #30)#336
Raakshass wants to merge 3 commits into
openclimatefix:mainfrom
Raakshass:feat/new-model-challenge-issue30

Conversation

@Raakshass

Copy link
Copy Markdown
Contributor

Pull Request

Description

This PR introduces a new LightGBM-based solar power predictor with enhanced feature engineering to improve forecast accuracy for Issue #30 (New Model Challenge).

Key additions:

  • feature_engineering.py - Solar position calculations, cyclical time encoding, derived weather features, and panel orientation factors
  • v3_lightgbm.py - LightGBM predictor class with physics-based fallback
  • Added model="lgbm" option to run_forecast()
  • Comprehensive tests for all feature engineering functions

Feature Engineering includes:

  • Solar position (azimuth, elevation) from lat/lon/time
  • Cyclical time encoding (sin/cos for hour, day of year, month)
  • Weighted cloud cover (low=0.6, mid=0.3, high=0.1)
  • Panel incidence factor based on tilt/orientation
  • Temperature efficiency factor

Fixes #30

How Has This Been Tested?

Added comprehensive unit tests in tests/test_v3_lightgbm.py covering:

  • Solar position calculations (elevation/azimuth ranges, daylight detection)

  • Cyclical time encoding (value ranges, continuity)

  • Derived weather features (cloud cover weighting, clear sky factor)

  • Panel orientation factors (incidence calculations)

  • FeatureEngineer class integration

  • Yes

If your changes affect data processing, have you plotted any changes?

  • Yes (Will run full evaluation on testset after model training)

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked my code and corrected any misspellings

- Update requires-python to >=3.11,<3.13 to explicitly support Python 3.12
- Update huggingface_hub from 0.17.3 to 0.21.4 for Py3.12 compatibility
- Disable HuggingfaceHubIntegration in sentry_sdk to fix version conflicts

Fixes openclimatefix#333
@Raakshass
Raakshass force-pushed the feat/new-model-challenge-issue30 branch from 02ffb16 to 9165569 Compare February 3, 2026 15:34
@Raakshass

Copy link
Copy Markdown
Contributor Author

Hi @peterdudfield, the CI is failing due to pre-existing issues in the main branch:

  1. W293 error: open_meteo.py:102 has trailing whitespace - this is in the main branch, not my changes
  2. Dependency conflict: huggingface-hub and pv-site-prediction have incompatible fsspec requirements - also a main branch issue

My new files all pass ruff check locally. Happy to help fix the main branch issues in a separate PR if that helps!

@Raakshass

Copy link
Copy Markdown
Contributor Author

Closing in favor of #341 which has a cleaner implementation. Sorry for the duplicate.

@Raakshass Raakshass closed this Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Challenge: new model

1 participant