Instructions to use Subhajit42/SDL-Prediction-Model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use Subhajit42/SDL-Prediction-Model with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://Subhajit42/SDL-Prediction-Model") - Notebooks
- Google Colab
- Kaggle
| license: cc-by-nc-sa-4.0 | |
| language: | |
| - en | |
| metrics: | |
| - r_squared | |
| library_name: keras | |
| tags: | |
| - Climate | |
| - SDL-radiation | |
| - CNN | |
| - BiLSTM | |
| - Time-Series | |
| model-index: | |
| - name: SDL Prediction Model | |
| results: | |
| - task: | |
| type: spatio-temporal-forecasting | |
| dataset: | |
| type: weather | |
| name: CLARA-dataset | |
| metrics: | |
| - name: R2 | |
| type: r2 | |
| value: 0.8204 | |
| ## SDL Prediction Model | |
| This repository contains a deep learning model for forecasting **Surface Downward Longwave Radiation (SDL)** using a hybrid **CNN-BiLSTM** architecture. The model is trained on the CLARA dataset and is designed for monthly grid-based predictions over India. | |
| --- | |
| ### Model Overview | |
| - **Model Type:** Convolutional Neural Network + Bidirectional LSTM (CNN-BiLSTM) | |
| - **Version:** 1.0 (`r2-0.8204`) | |
| - **Input Shape:** 12 timesteps Γ 140 Γ 140 grid Γ 4 channels | |
| - **Channels:** | |
| - `sdlr_value` | |
| - `year_channel` | |
| - `month_sin_channel` | |
| - `month_cos_channel` | |
| - **Model File:** `model.keras` | |
| - **Scalers:** | |
| - Input: `scalers/input_scalers.pkl` | |
| - Output: `scalers/y_scaler.pkl` | |
| - **Metadata:** | |
| - Initial sequence: `metadata/initial_X_sequence_for_forecast.npy` | |
| - Model metadata: `metadata/model_metadata.json` | |
| - **Model Metrics** | |
| - `MSE: 0.0099` | |
| - `MAE: 0.0744` | |
| - `RMSE: 0.0995` | |
| - `R2: 0.8204` | |
| - `MAE (Original SDL Units): 27.88 W/mΒ²` | |
| - `RMSE (Original SDL Units): 37.26 W/mΒ²` | |
| --- | |
| ### Dataset | |
| - **Name:** CLARA-dataset | |
| - **Description:** SDL - Surface downward longwave radiation | |
| - **Temporal Resolution:** Monthly | |
| - **Spatial Resolution:** 0.25Β° Γ 0.25Β° grid (140 Γ 140) | |
| - **Temporal Coverage:** | |
| - Start: 1979-01-01 | |
| - End: 2025-06-01 | |
| - **Geographic Coverage:** | |
| - Latitude: 5.0Β°N to 40.0Β°N | |
| - Longitude: 65.0Β°E to 100.0Β°E | |
| --- | |
| ### Repository Structure | |
| ``` | |
| βββ config.json # Model and dataset configuration | |
| βββ LICENSE # License (CC BY-NC-SA 4.0) | |
| βββ model.keras # Trained model | |
| βββ metadata/ | |
| β βββ initial_X_sequence_for_forecast.npy | |
| β βββ model_metadata.json | |
| βββ scalers/ | |
| β βββ input_scalers.pkl | |
| β βββ y_scaler.pkl | |
| ``` | |
| --- | |
| ### Usage | |
| This repository provides the trained model and all necessary artifacts (scalers, metadata, initial input sequence) for SDL prediction, but does **not** include the inference code. | |
| To use the model for inference: | |
| 1. **Load the Model and Artifacts:** | |
| - Load `model.keras` using Keras: `tf.keras.models.load_model('model.keras')`. | |
| - Load the scalers (`scalers/input_scalers.pkl`, `scalers/y_scaler.pkl`) and metadata (`metadata/model_metadata.json`) using Python's `pickle` and `json` modules. | |
| - Load the initial input sequence (`metadata/initial_X_sequence_for_forecast.npy`) using NumPy. | |
| 2. **Prepare Input Data:** | |
| - Prepare a 12-month sequence of input data as a 4D array: `(TIMESTEPS, height, width, n_channels)`. | |
| - Use the provided scalers to normalize input features. | |
| 3. **Perform Prediction:** | |
| - Pass the input sequence to the model to obtain predictions for future SDL values. | |
| - For rolling forecasts, update the input sequence with each new prediction and repeat as needed. | |
| - Use the output scaler to inverse-transform predictions to original units (W/mΒ²). | |
| 4. **Postprocess Results:** | |
| - Map predictions to the desired grid points using the latitude and longitude grids from the metadata. | |
| **Note:** | |
| - An implementation of this model is used in the project [Solarwise](https://github.com/RakshitRabugotra/solarwise) repository. | |
| --- | |
| ### License | |
| This project is licensed under the **Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)**. See the `LICENSE` file for details or visit this [website](https://creativecommons.org/licenses/by-nc-sa/4.0/). | |
| --- | |
| ### Citation | |
| If you use this model or code, please cite appropriately and respect the license terms. | |
| --- | |
| ### Contact | |
| For questions or collaboration, please open an issue or contact the repository maintainer. |