Spaces:
Running
Running
Update src/train_model.py
Browse files- src/train_model.py +5 -1
src/train_model.py
CHANGED
|
@@ -19,6 +19,10 @@ Synthetic Data Strategy:
|
|
| 19 |
Replace the generate_*_data() functions with your own data loaders.
|
| 20 |
The rest of the training pipeline stays identical.
|
| 21 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
import torch
|
| 24 |
import numpy as np
|
|
@@ -49,7 +53,7 @@ torch.manual_seed(SEED)
|
|
| 49 |
# y shape: (n_samples,) — continuous risk score in [0, 1]
|
| 50 |
|
| 51 |
def generate_flood_data(n: int = 5000):
|
| 52 |
-
|
| 53 |
|
| 54 |
rainfall = pd.read_csv(os.path.join(DATA_DIR, "rainfall_clean.csv"))
|
| 55 |
flood_hist = pd.read_csv(os.path.join(DATA_DIR, "flood_history_clean.csv"))
|
|
|
|
| 19 |
Replace the generate_*_data() functions with your own data loaders.
|
| 20 |
The rest of the training pipeline stays identical.
|
| 21 |
"""
|
| 22 |
+
import os
|
| 23 |
+
|
| 24 |
+
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
| 25 |
+
DATA_DIR = os.path.join(BASE_DIR, "data")
|
| 26 |
|
| 27 |
import torch
|
| 28 |
import numpy as np
|
|
|
|
| 53 |
# y shape: (n_samples,) — continuous risk score in [0, 1]
|
| 54 |
|
| 55 |
def generate_flood_data(n: int = 5000):
|
| 56 |
+
|
| 57 |
|
| 58 |
rainfall = pd.read_csv(os.path.join(DATA_DIR, "rainfall_clean.csv"))
|
| 59 |
flood_hist = pd.read_csv(os.path.join(DATA_DIR, "flood_history_clean.csv"))
|