Example #1
0
        "train": File.open_with_label("Beef_TRAIN"),
        "test": File.open_with_label("Beef_TEST"),
        "fn": two_sym_fn,
    },
    {
        "title": "Beef.P=2.asym",
        "train": File.open_with_label("Beef_TRAIN"),
        "test": File.open_with_label("Beef_TEST"),
        "fn": two_asym_fn,
    },
]

for i, job in enumerate(jobs):
    print("job:", i, "of", len(jobs))
    print("job:", job["title"])

    result = {"title": job["title"]}

    start_time = time.process_time()

    accuracy, correctness = DTW.predict_list(job["train"], job["test"], job["fn"])

    end_time = time.process_time()

    result["accuracy"] = accuracy
    result["correctness"] = correctness
    result["total"] = len(job["test"])
    result["time_elapsed"] = end_time - start_time

    File.write_json(job["title"] + ".json", result)
Example #2
0
                abc = [a, b, c]
                zeros = abc.count(0)

                if zeros == 3:
                    continue

                if zeros == 2:
                    if b == 0:
                        continue

                print('c:', c)

                start_time = time.process_time()

                accuracy, correctness = DTW.predict_list(job['train'], job['test'], [a, b, c], [ [-1, 0], [0, -1], [-1, -1] ])

                print('[', a, b, c, ']', 'accuracy:', accuracy, 'correctness:', correctness)

                end_time = time.process_time()
                time_elasped = end_time - start_time
                print('time_elapsed:', time_elasped)

                result = {
                    'a': a,
                    'b': b,
                    'c': c,
                    'accuracy': accuracy,
                    'correctness': correctness,
                    'total': len(job['test']),
                    'time_elapsed': time_elasped