From 751887e6d8c916b8b3d8abcbb6318626fc2736aa Mon Sep 17 00:00:00 2001 From: dario Date: Thu, 14 Dec 2023 19:19:40 +0100 Subject: [PATCH] Added dummy metric --- demo.ipynb | 11 ++++++++++- spatz/metrics/__init__.py | 1 + spatz/metrics/metric.py | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 spatz/metrics/__init__.py create mode 100644 spatz/metrics/metric.py diff --git a/demo.ipynb b/demo.ipynb index 9deed05..890c67c 100644 --- a/demo.ipynb +++ b/demo.ipynb @@ -171,6 +171,10 @@ } ], "source": [ + "from spatz.metrics import Metric\n", + "\n", + "metric = Metric()\n", + "\n", "logger = simulation.get_logger()\n", "\n", "# Set verbose to False to disable the progress bar\n", @@ -183,7 +187,12 @@ " # Get the correct altitude data.\n", " alt = altitude()\n", "\n", - " # TODO: Add your computation here." + " pred_alt = ...\n", + " metric(alt, pred_alt)\n", + "\n", + " # TODO: Add your computation here.\n", + "\n", + "print('Score was:', metric.get_score())" ] }, { diff --git a/spatz/metrics/__init__.py b/spatz/metrics/__init__.py new file mode 100644 index 0000000..6448e7b --- /dev/null +++ b/spatz/metrics/__init__.py @@ -0,0 +1 @@ +from spatz.metrics.metric import Metric \ No newline at end of file diff --git a/spatz/metrics/metric.py b/spatz/metrics/metric.py new file mode 100644 index 0000000..6ebf913 --- /dev/null +++ b/spatz/metrics/metric.py @@ -0,0 +1,14 @@ + + +from typing import Any + + +class Metric: + def __init__(self) -> None: + self.__sum = 0 + + def get_score(): + pass + + def __call__(self, *args) -> Any: + self.__sum += abs(x - y) \ No newline at end of file