File size: 1,315 Bytes
8f3e4ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import json
import logging
from argparse import ArgumentParser

import evaluate
import numpy as np

logger = logging.getLogger(__name__)
parser = ArgumentParser(
    description="Compute the matching series score between two time series freezed in a numpy array"
)
parser.add_argument("predictions", type=str, help="Path to the numpy array containing the predictions")
parser.add_argument("references", type=str, help="Path to the numpy array containing the references")
parser.add_argument("--output", type=str, help="Path to the output file")
parser.add_argument("--batch_size", type=int, help="Batch size to use for the computation")
args = parser.parse_args()

if not args.predictions or not args.references:
    raise ValueError("You must provide the path to the predictions and references numpy arrays")

predictions = np.load(args.predictions)
references = np.load(args.references)


logger.info(f"predictions shape: {predictions.shape}")
logger.info(f"references shape: {references.shape}")

import matching_series

metric = matching_series.matching_series()
# metric = evaluate.load("matching_series.py")
results = metric.compute(predictions=predictions, references=references, batch_size=args.batch_size)

print(results)
if args.output:
    with open(args.output, "w") as f:
        json.dump(results, f)