Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this user
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
delriot
/
AugmentingMathematicalDataset
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
0
Pull requests
0
Projects
0
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Projects
Security
Insights
Files
b1a0475
DatasetsBeforeProcessing
Heuristics
config
datasets
packages
README.md
basic_ml.py
choose_hyperparams.py
create_clean_dataset.py
find_filename.py
from_poly_set_to_features.py
main.py
main_heuristics.py
main_regression.py
make_plots.py
output.txt
preprocessing_Dorians_features.py
replicating_Dorians_features.py
test_models.py
test_train_datasets.py
train_models.py
yaml_tools.py
Breadcrumbs
AugmentingMathematicalDataset
/
make_plots.py
Blame
Blame
Latest commit
History
History
99 lines (85 loc) · 3.6 KB
Breadcrumbs
AugmentingMathematicalDataset
/
make_plots.py
Top
File metadata and controls
Code
Blame
99 lines (85 loc) · 3.6 KB
Raw
"""Make some plots""" import os import pickle import numpy as np from numpy import sort import matplotlib import matplotlib.pyplot as plt from matplotlib.pyplot import cm from find_filename import find_timings_lists matplotlib.rcParams['mathtext.rm'] = 'Bitstream Vera Sans' matplotlib.rcParams['mathtext.it'] = 'Bitstream Vera Sans:italic' matplotlib.rcParams['mathtext.bf'] = 'Bitstream Vera Sans:bold' matplotlib.rcParams['mathtext.fontset'] = 'cm' matplotlib.rcParams['font.family'] = 'STIXGeneral' fontsize = 15 desired_font = {'fontname': 'monospace'} matplotlib.rcParams.update({'font.size': fontsize}) def survival_plot(timings: dict, plot_name="survival_plot"): """Receive a dictionary where the keys are the name of the methos and the timings that took for each of the problems""" color = cm.rainbow(np.linspace(0, 1, len(timings)+1)) # color[4]=[0.8,0.8,0.2,1] # color[3]=[0.65,0.42,0.42,1] # color[2]=[0.00,1,0.5,1] # color = ['0','0.5','0','0.5','0','0.5'] style = ['--'] * len(timings) dashes = [(1, 0), (5, 1), (5, 1, 1, 1), (2, 1, 2, 1), (1, 1), (5, 5)]\ + [(1, 0)] * len(timings) for method, c, s, d in zip(timings, color, style, dashes): not_timeout_timings = [timing for timing in timings[method] if timing != 30 and timing != 60] sorted_timings = sort(not_timeout_timings) accumulative_timings = [sum(sorted_timings[:i]) for i in range(len(sorted_timings))] # plotting plt.plot(accumulative_timings, list(range(len(accumulative_timings))), s, color=c, label=method, dashes=d) plt.xlabel('Time', fontsize=fontsize) plt.ylabel('No. problems finished', fontsize=fontsize) plt.legend(prop={'family': 'monospace', 'size': fontsize-2}, loc='lower right') figure_location = os.path.join(os.path.dirname(__file__), 'Art', f'{plot_name}.png') plt.savefig(figure_location) plt.cla() def create_adversarial_plot( model1='RF', model2='RFR' ): ''' This function creates an adversarial plot comparing the desired models. ''' timings_lists_filename = find_timings_lists(model1) with open(timings_lists_filename, 'rb') as timings_lists_file: rawtimings1 = pickle.load(timings_lists_file) timings1 = [80 if timing == 60 else timing for timing in rawtimings1] timings_lists_filename = find_timings_lists(model2) with open(timings_lists_filename, 'rb') as timings_lists_file: rawtimings2 = pickle.load(timings_lists_file) timings2 = [80 if timing == 60 else timing for timing in rawtimings2] plot, ax = plt.subplots(1, 1) # Set number of ticks for x-axis ticks = list(np.arange(0, 90, 10)) ticks.pop(-2) ax.set_xticks(ticks) ax.set_yticks(ticks) # Set ticks labels for x-axis ticks_labels = ticks ticks_labels[-1] = 'Timeout' ax.set_xticklabels(ticks_labels, fontsize=fontsize) ax.set_yticklabels(ticks_labels, rotation='vertical', fontsize=fontsize) # plotting ax.plot(timings1, timings2, '.') ax.plot([0, 90], [0, 90], '-') # creating labels plt.xlabel(model1, **desired_font, fontsize=fontsize-2) plt.ylabel(model2, **desired_font, fontsize=fontsize-2) plt.title('Adversarial plot comparing ' + model1 + ' and ' + model2) figure_location = os.path.join(os.path.dirname(__file__), 'Art', 'adversarial_plot_' + model1 + '_vs_' + model2 + '.png') plt.savefig(figure_location) plt.cla() create_adversarial_plot()
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
You can’t perform that action at this time.