summaryrefslogtreecommitdiff
path: root/bjoern/videoanalyse/eval.py
diff options
context:
space:
mode:
authorNiclas Dobbertin <niclas.dobbertin@stud.tu-darmstadt.de>2023-08-02 14:13:45 +0200
committerNiclas Dobbertin <niclas.dobbertin@stud.tu-darmstadt.de>2023-08-02 14:13:45 +0200
commit4d9c0dce1f5bc0bd3cde1b89875387f1a13c18c4 (patch)
tree661fe5eb571ae7dc89ea52c546f6aa5df0cc3595 /bjoern/videoanalyse/eval.py
parent3fdab9495310e8d29cab65d1ee0c1bfa0b26a76e (diff)
add additional scripts
Diffstat (limited to 'bjoern/videoanalyse/eval.py')
-rw-r--r--bjoern/videoanalyse/eval.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/bjoern/videoanalyse/eval.py b/bjoern/videoanalyse/eval.py
new file mode 100644
index 0000000..a917b7a
--- /dev/null
+++ b/bjoern/videoanalyse/eval.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python3
+
+import argparse
+from pathlib import Path
+import pandas as pd
+import csv
+from Levenshtein import distance as levendist
+
+
+argparser = argparse.ArgumentParser(
+ description="Distance evaluation"
+)
+argparser.add_argument(
+ "vp_dir", help="Directory containing merged.csv"
+)
+
+args = argparser.parse_args()
+
+vp_path = Path(args.vp_dir)
+
+df = pd.read_csv(vp_path / "merged.csv")
+
+df["levenshtein-distance"] = df.apply(
+ lambda row: levendist(str(row.url), str(row.log_url)), axis=1
+)
+
+
+
+df.to_csv(vp_path / "metrics.csv", quoting=csv.QUOTE_NONNUMERIC)