Skip to content

Commit

Permalink
update eval and hf logging in
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Dec 12, 2023
1 parent 38daaad commit 4c8c286
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
1 change: 0 additions & 1 deletion quartz_solar_forecast/eval/pv.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

fs = HfFileSystem()


def get_pv_metadata(testset: pd.DataFrame):

# download from hugginface or load from cache
Expand Down
25 changes: 21 additions & 4 deletions quartz_solar_forecast/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,32 @@
This contains 50 sites each with 50 timestamps to make 2500 samples in total.
"""

import os

import pandas as pd
from huggingface_hub.hf_api import HfFolder

from quartz_solar_forecast.eval.forecast import run_forecast
from quartz_solar_forecast.eval.metrics import metrics
from quartz_solar_forecast.eval.nwp import get_nwp
from quartz_solar_forecast.eval.forecast import run_forecast
from quartz_solar_forecast.eval.utils import combine_forecast_ground_truth
from quartz_solar_forecast.eval.pv import get_pv_metadata, get_pv_truth
from quartz_solar_forecast.eval.utils import combine_forecast_ground_truth

try:

hf_token = os.environ["HF_TOKEN"]
HfFolder.save_token(hf_token)
except:

print(
"Warning, you wont be able to run evaluation if you dont set your "
"Hugging Face Access Token to HF_TOKEN, or be logged in with Hugging Face"
)

import pandas as pd


def run_eval(testset_path: str = 'quartz_solar_forecast/dataset/testset.csv'):
def run_eval(testset_path: str = "quartz_solar_forecast/dataset/testset2.csv"):
# load testset from csv
testset = pd.read_csv(testset_path)

Expand Down Expand Up @@ -42,3 +58,4 @@ def run_eval(testset_path: str = 'quartz_solar_forecast/dataset/testset.csv'):
# Visulisations


# run_eval()
6 changes: 3 additions & 3 deletions tests/eval/test_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def test_run_eval():
data=[[8215, "2021-01-26 01:15:00"], [8215, "2021-01-30 16:30:00"]],
)

testset_path = tmpdirname + "/test_dataset.csv"
test_dataset.to_csv(testset_path, index=False)
testset_filename = tmpdirname + "/test_dataset.csv"
test_dataset.to_csv(testset_filename, index=False)

# call the metrics function
run_eval(testset_path)
run_eval(testset_filename)

0 comments on commit 4c8c286

Please sign in to comment.