-
Notifications
You must be signed in to change notification settings - Fork 1
/
viewresults.py
60 lines (46 loc) · 2.31 KB
/
viewresults.py
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
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 30 03:56:22 2015
@author: schurterb
Script to analyze the results of net_opt_2, which generates a list of
folders containing the results of training different networks.
"""
import os
import ConfigParser
from analysis import Analyzer
from load_data import LoadData
def ViewResults( **kwargs):
directory = kwargs.get('directory', '')
network = kwargs.get('network', None)
prediction_file = kwargs.get('predictions_file', None)
if network:
#Assume that all networks are tested on the same set of data
config = ConfigParser.ConfigParser()
config.read("networks/"+network+"/network.cfg")
data = LoadData(directory = config.get('Testing Data', 'folders').split(',')[0],
data_file_name = config.get('Testing Data', 'data_file'),
label_file_name = config.get('Testing Data', 'label_file'))
if not prediction_file: prediction_file = "test_prediction_0"
results = Analyzer(target = data.get_labels()[0], raw = data.get_data()[0])
results.add_results(results_folder = "networks/"+network+'/',
name = network,
prediction_file = prediction_file)
else:
folders = os.listdir(directory)
networks = []
for folder in folders:
if os.path.isfile(directory + folder+"/network.cfg"):
networks.append(folder)
#Assume that all networks are tested on the same set of data
config = ConfigParser.ConfigParser()
config.read(directory+networks[0]+"/network.cfg")
data = LoadData(directory = config.get('Testing Data', 'folders').split(',')[0],
data_file_name = config.get('Testing Data', 'data_file'),
label_file_name = config.get('Testing Data', 'label_file'))
if not prediction_file: prediction_file = "test_prediction_0"
results = Analyzer(target = data.get_labels()[0], raw = data.get_data()[0])
for net in networks:
results.add_results(results_folder = directory+net+'/',
name = net,
prediction_file = prediction_file)
return results