Conditions | 4 |
Total Lines | 34 |
Code Lines | 30 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | #!/usr/bin/env python |
||
16 | def main(): |
||
17 | COLUMNS = [ |
||
18 | 'nb-topics', |
||
19 | 'collection-passes', |
||
20 | 'document-passes', |
||
21 | # 'total-phi-updates', |
||
22 | 'perplexity', |
||
23 | 'kernel-size', |
||
24 | 'kernel-coherence', |
||
25 | 'kernel-contrast', |
||
26 | 'kernel-purity', |
||
27 | 'top-tokens-coherence', |
||
28 | 'sparsity-phi', |
||
29 | 'sparsity-theta', |
||
30 | 'background-tokens-ratio', |
||
31 | 'regularizers' |
||
32 | ] |
||
33 | |||
34 | cli_args = get_cli_arguments() |
||
35 | sort_metric = cli_args.sort |
||
36 | |||
37 | collections_dir = os.getenv('COLLECTIONS_DIR') |
||
|
|||
38 | if not collections_dir: |
||
39 | raise RuntimeError( |
||
40 | "Please set the COLLECTIONS_DIR environment variable with the path to a directory containing collections/datasets") |
||
41 | model_reporter = ModelReporter(collections_dir) |
||
42 | while 1: |
||
43 | try: |
||
44 | s = model_reporter.get_formatted_string(cli_args.dataset, columns=COLUMNS, metric=sort_metric, verbose=True) |
||
45 | print('\n{}'.format(s)) |
||
46 | break |
||
47 | except InvalidMetricException as e: |
||
48 | print(e) |
||
49 | sort_metric = input("Please input another metric to sort (blank for 'perplexity'): ") |
||
50 | |||
54 |