File: get_msqe.py

package info (click to toggle)
cryptominisat 5.11.4%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,432 kB
  • sloc: cpp: 55,148; ansic: 9,642; python: 8,899; sh: 1,336; php: 477; sql: 403; javascript: 173; xml: 34; makefile: 15
file content (61 lines) | stat: -rwxr-xr-x 1,793 bytes parent folder | download | duplicates (3)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/python3

import sys
import os

assert len(sys.argv) >= 2


tiers = {"short":[], "long":[], "forever":[]}

for mydir in sys.argv[1:]:
    if not os.path.isdir(mydir):
        print("WARN: %s is not a directory, skipping" % mydir)
        continue
    print(mydir)
    print("========")
    for tier in ["short", "long", "forever"]:
        for table in ["used_later", "used_later_anc"]:
            fname = "%s/out-%s-%s" %(mydir, table, tier)
            if not os.path.isfile(fname):
                print("ERROR: the file '%s' does not exist!" % fname)
                exit(-1)

            test = False
            all_dump_no = False
            with open(fname, "r")  as f:
                out = "Tier %-9s " % tier
                for line in f:
                    line = line.strip()
                    if " test data" in line:
                        test = True

                    if not test:
                        continue

                    if "ALL dump_no" in line:
                        all_dump_no = True

                    if not all_dump_no:
                        continue

                    if "train+test" in line:
                        break

                    if "train data" in line:
                        break

                    assert test
                    if "Mean squared error is" in line:
                        mydat = line.split(" ")
                        val = float(mydat[5])
                        tiers[tier].append(["%s-%s" % (mydir, table), val])
                        out += line
                        print(out)
                        break

for tier in ["short", "long", "forever"]:
    print("TIER: ", tier)
    top =  sorted(tiers[tier], key=lambda x: x[1], reverse=False)
    for t in top:
        print(t)