subsampling.py 1.37 KB
Newer Older
1 2
import matplotlib.pyplot as plt
import time
3

4
from evaluation import TotalResults, SampleResult
5
from input_output import get_pkls_from_directory, get_attributes_from_foldername, save_results, load_results
6

Josef Brandt's avatar
Josef Brandt committed
7 8 9 10
"""
IMPORTANT!!!
SET GEPARD TO EVALUATION BRANCH (WITHOUT THE TILING STUFF), OTHERWISE SOME OF THE LEGACY CONVERTS MIGHT FAIL..
"""
11 12


13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
# results: TotalResults = TotalResults()
# pklsInFolders = get_pkls_from_directory(r'C:\Users\xbrjos\Desktop\temp MP\NewDatasets')
#
# for folder in pklsInFolders.keys():
#     for samplePath in pklsInFolders[folder]:
#         newSampleResult: SampleResult = results.add_sample(samplePath)
#         for attr in get_attributes_from_foldername(folder):
#             newSampleResult.set_attribute(attr)
#
# t0 = time.time()
# results.update_all()
# print('updating all took', time.time()-t0, 'seconds')
#
# save_results('results1.res', results)
results: TotalResults = load_results('results1.res')

errorPerFraction: dict = results.get_error_vs_fraction_data(methods=['spiral', 'cross'])
30 31 32 33 34 35
plt.clf()
for methodLabel in errorPerFraction.keys():
    fractions: list = list(errorPerFraction[methodLabel].keys())
    errors: list = list(errorPerFraction[methodLabel].values())
    plt.plot(fractions, errors, label=methodLabel)

36
plt.title('Spiral or Box Layouts')
37 38 39 40 41
plt.xscale('log')
plt.xlabel('measured fraction')
plt.ylabel('mpCountError')
plt.legend()
plt.show()
42