-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplotLinegraph.py
2438 lines (2307 loc) · 403 KB
/
plotLinegraph.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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 04 18:17:43 2015
plot linegraph
@author: zimu
"""
import matplotlib.pyplot as plt
import numpy as np
import mpl_toolkits.axisartist as AA
from mpl_toolkits.axes_grid1 import host_subplot
from matplotlib import ticker
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
def AutoLocatorInit(self):
ticker.MaxNLocator.__init__(self, nbins=5, steps=[1, 2, 5, 10])
ticker.AutoLocator.__init__ = AutoLocatorInit
graph = 35.1
#,markeredgewidth=mewidth
xfontsize = 60
yfontsize = 60
xlabelsize = 70
ylabelsize = 70
legendsize = 60
xfontsize = 40
yfontsize = 40
xlabelsize = 50
ylabelsize = 50
legendsize = 50
lwidth = 3
osize = 45
starsize = 55
psize = 55
trisize = 45
mewidth = 3
gridwidth = 2
if graph == 1:
a = 1
elif graph == 7:#Scatter Diagram Similar days have similar offsets
dista = [549.1383861124782, 470.30221907260636, 556.82811518580593, 578.9291477985746, 539.01012386628975, 595.97662293494932, 647.8255002053786, 636.32567958262268, 600.31789256245236, 579.97152905465293, 520.91936586275608, 532.36741830472499, 509.61731809221141, 543.13228598599835, 482.38628848698198, 418.39625345689558, 490.97428133581451, 508.03760843794726, 496.45152090973647, 550.67117148527382, 490.969608703772, 408.46366001647885, 419.83870628634878, 426.34936776364424, 396.19065970712137, 451.33479183242116, 223.02728670562266, 385.85006070116981, 397.06754957751281, 448.55421483461578, 462.29698740458781, 461.65964804620609, 481.42304136190569, 368.49902460809562, 437.69274668346816, 375.92875160187901, 41.613473658290985, 58.289382506822832, 182.94264075860571, 118.31341201586983, 120.62238400952666, 84.659285866683987, 161.86180739445524, 130.12447448405342, 115.70972031913641, 60.724906993632644, 105.34206431527599, 101.55938882187908, 68.716822512797776, 69.24719200048699, 80.058830378061486, 4.5640942735051766, 106.92630296640513, 109.54430308665764, 78.55269170562525, 38.750174579457173, 30.001672680671845, 46.230920268760855, 81.064589835957861, 85.165089884293437, 0.0, 631.27496297344453, 1609.1142572584074, 11.036498816615996, 51.586450886360765, 57.712467645085653, 151.04781757850694, 443.09350985736074, 1435.8168508147692, 170.54933410067417, 191.70364262228648, 248.71606102662884, 203.85790664008442, 209.73495291015837, 471.13230473683706, 1424.0666844036255, 220.91163957979506, 249.70258341548211, 285.31735762697747, 293.80775908119631, 276.90703765524898, 404.32982050090624, 1418.0886927119773, 240.94260113873943, 295.49657280455352, 292.02956456596411, 299.3713560242835, 236.83245816227003, 313.47600182113263]
offset = [0.26666666666666572, 0.13333333333333286, 0.13333333333333286, 0.43333333333333357, 0.19999999999999929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.10000000000000142, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.00027777777777515666, 0.0, 0.19999999999999929, 0.0, 0.30000000000000071, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.81666666666666643, 0.81666666666666643, 1.5166666666666657, 0.0, 0.0, 0.0, 0.30000000000000071, 0.10000000000000142, 0.10000000000000142, 0.5, 0.0, 0.0, 0.30000000000000071, 0.39999999999999858, 0.19999999999999929, 0.39999999999999858, 0.0, 0.30000000000000071, 0.30000000000000071, 1.1999999999999993, 0.39999999999999858, 0.19999999999999929, 0.0, 0.29972222222222555, 0.10000000000000142, 0.5, 0.10000000000000142, 0.10000000000000142, 0.0, 1.6000000000000014, 0.10000000000000142, 0.0, 1.6999999999999993, 0.10000000000000142, 0.0, 1.5, 0.5, 0.19999999999999929, 0.10000000000000142, 0.60000000000000142, 0.0, 0.0, 2.0, 1.0, 0.19999999999999929, 2.0, 0.80000000000000071, 0.0, 0.0, 2.0, 0.10000000000000142, 0.10000000000000142, 0.19999999999999929, 1.8999999999999986, 0.19999999999999929, 0.00027777777777515666]
#plt.xlim(0,43)
dmax = max(dista)
dmin = min(dista)
omax = max(offset)
omin = min(offset)
dista = np.array(dista)
dista = 1 - (dmax - dista) / (dmax - dmin)
offset = np.array(offset)
offset = 1 - (omax - offset) / (omax - omin)
plt.figure()
plt.plot(dista,offset, 'o',markersize=40,markerfacecolor='y',markeredgecolor='k')
plt.xlabel("Similarity of Days",size=xlabelsize)
plt.ylabel("Similarity of Offsets",size=ylabelsize)
plt.grid(True, linewidth = gridwidth)
ax=plt.gca()
for tick in ax.xaxis.get_major_ticks():
tick.label1.set_fontsize(xfontsize)
for tick in ax.yaxis.get_major_ticks():
tick.label1.set_fontsize(yfontsize)
plt.show()
elif graph == 11:#TPO-P vs TP-P 150-240 #train 3 month, predict 1 month
#TPO-P v.s. TP-P: MSE as a function of time, 16:00-24:00.
time1 =[ 15.0 , 15.1 , 15.2 , 15.3 , 15.4 , 15.5 , 15.6 , 15.7 , 15.8 , 15.9 , 16.0 , 16.1 , 16.2 , 16.3 , 16.4 , 16.5 , 16.6 , 16.7 , 16.8 , 16.9 , 17.0 , 17.1 , 17.2 , 17.3 , 17.4 , 17.5 , 17.6 , 17.7 , 17.8 , 17.9 , 18.0 , 18.1, 18.2 , 18.3 , 18.4 , 18.5 , 18.6 , 18.7 , 18.8 , 18.9 , 19.0 , 19.1 , 19.2 , 19.3 , 19.4 , 19.5 , 19.6 , 19.7 , 19.8 , 19.9 , 20.0 , 20.1 , 20.2 , 20.3 , 20.4 , 20.5 , 20.6 , 20.7 , 20.8 , 20.9, 21.0 , 21.1 , 21.2 , 21.3 , 21.4 , 21.5 , 21.6 , 21.7 , 21.8 , 21.9 , 22.0 , 22.1 , 22.2 , 22.3 , 22.4 , 22.5 , 22.6 , 22.7 , 22.8 , 22.9 , 23.0 , 23.1 , 23.2 , 23.3 , 23.4 , 23.5 , 23.6 , 23.7 , 23.8, 23.9 , 24.0]
traf1 = [ 3.96618645819 , 4.04497622846 , 3.39075473611 , 4.7234606614 , 4.164909464 , 3.74929904373 , 3.90519374081 , 4.01099285863 , 4.64369992486 , 4.57965918692 , 2.82826888741 , 5.0604905316 , 3.99257536387 , 7.18455151752 , 2.36224254873 , 4.16547682492 , 3.34751996066 , 3.58983560969 , 2.43789160656 , 2.54892943846 , 2.54892943846 , 4.86102740209 , 4.39002674918 , 3.4733625116 , 1.65661314039 , 4.30196947144 , 1.85158868053 , 3.45453815456 , 8.26514748182 , 3.39325035825 , 3.05344100669 , 4.92566172441 , 3.90778176245 , 2.98940013899 , 7.03302763038 , 4.51793391538 , 5.11233797865 , 3.58112845539 , 5.31103060742 , 5.36028896036 , 4.68315982201 , 4.68057920356 , 10.2563604348 , 7.45090549345 , 3.48067021098 , 4.95830331286 , 6.78096463283 , 5.14312042025 , 2.79491732187 , 3.85133045544 , 4.39286091368 , 4.15029338914 , 2.69199038573 , 2.6877504365 , 6.18964671317 , 3.92690164743 , 1.4216195593 , 2.32972493884 , 2.68810883884 , 3.07620211093 , 8.10307709548 , 6.24938041557 , 4.41333952399 , 5.74221501923 , 4.89501154313 , 7.2711287331 , 9.07431829147 , 4.32086457158 , 8.21095270683 , 2.74730418402 , 3.6636698868 , 4.57328849058 , 5.80687995343 , 6.95878485269 , 7.72893462061 , 7.02814142419 , 5.05219816438 , 5.44598003157 , 6.13105945609 , 4.38539146046 , 6.26051298642 , 7.82124811496 , 6.47002032166 , 10.1974933772 , 3.6415823182 , 8.26392144517 , 4.41229726097 , 3.56887666101 , 6.36807457898 , 6.53689879115 , 6.50894555372 ]
occ1 = [ 3.33126992611 , 2.15235043881 , 4.21215375236 , 2.04146402499 , 2.26508236112 , 1.75842743987 , 3.83752010319 , 1.79356812562 , 2.71647871756 , 2.98920028076 , 3.06963761795 , 3.78037524154 , 2.11330949347 , 3.62306600989 , 2.10132375418 , 2.79890211351 , 2.45220911956 , 2.0962944359 , 1.71888897623 , 2.00237892092 , 2.00237892092 , 1.75017286044 , 1.87819485903 , 2.77200592938 , 0.927552735382 , 2.16110258543 , 0.952612535679 , 1.55876494568 , 2.43936505277 , 2.74032154014 , 2.20187230613 , 2.62732676781, 1.81709347884 , 2.68646819361 , 4.87840695719 , 3.58804992604 , 1.96027598281 , 2.16400733578 , 4.55698744552 , 2.61612107743 , 4.1007299461 , 2.60197595024 , 2.42772928849 , 3.70504358394 , 2.64089183244 , 2.53083484208 , 2.69596558723 , 3.82189848477 , 2.10858933652 , 2.69381421149 , 4.48942308279 , 3.48776778082 , 1.75831208948 , 1.48030854681 , 3.2901866737 , 2.33799936521 , 1.50491990853 , 1.23953538087 , 1.19008302381 , 2.36576100342, 2.57888534853 , 2.052794471 , 2.64644323686 , 1.35534774334 , 5.6573022579 , 4.76819909982 , 1.85043233584 , 3.46190356262 , 5.28356384041 , 1.84882416982 , 3.01211103176 , 4.59728665448 , 8.01181670627 , 6.44190774176 , 7.57429158629 , 5.66900034971 , 4.30244931982 , 6.23339404063 , 6.88638460847 , 4.63713969717 , 5.75838213042 , 3.38303474858 , 4.29114582128 , 2.74825804228 , 2.33363923855 , 2.26640425042 , 4.06245325649 , 3.02492973852 , 4.13263598916, 4.06968874886 , 3.87911988994]
time = []
traf= []
occ = []
for time10 in range(160,240,10):
time01 = time10 / 10.0
for i in range(len(time1)):
if time1[i] == time01:
if time1[i] == 21:
print traf1[i], occ1[i], traf1[i]/occ1[i]
time.append(time1[i])
traf.append(traf1[i])
occ.append(occ1[i])
break
time.append(time1[-1])
traf.append(traf1[-1])
occ.append(occ1[-1])
print 'MEAN -occ: ',np.mean(occ)
print 'MEAN - traf:', np.mean(traf)
xlim(16,24)
ylim(0,10)
fig = plt.figure(1)
errorDis1 = plt.subplot(1,1,1)
ax=plt.gca()
for tick in ax.xaxis.get_major_ticks():
tick.label1.set_fontsize(xfontsize)
for tick in ax.yaxis.get_major_ticks():
tick.label1.set_fontsize(yfontsize)
errorDis1.set_xlabel('Time',size=xlabelsize)
errorDis1.set_ylabel('MSE',size=ylabelsize)
errorDis1.plot(time,occ,'ob-',label='TPO-P', linewidth=lwidth, markersize=osize,markerfacecolor='none',markeredgecolor='b',markeredgewidth=mewidth)
errorDis1.plot(time,traf,'*r--',label='TP-P', linewidth = lwidth, markersize=starsize,markerfacecolor='none',markeredgecolor='r',markeredgewidth=mewidth)
#errorDis1.legend(bbox_to_anchor=(0.30, 1), prop={'size':legendsize})
errorDis1.legend(bbox_to_anchor=(0.4, 1), prop={'size':legendsize})
plt.grid(True, linewidth = gridwidth)
plt.show()
elif graph == 12:#TPO-P vs TP-P 200-220
time1 =[ 15.0 , 15.1 , 15.2 , 15.3 , 15.4 , 15.5 , 15.6 , 15.7 , 15.8 , 15.9 , 16.0 , 16.1 , 16.2 , 16.3 , 16.4 , 16.5 , 16.6 , 16.7 , 16.8 , 16.9 , 17.0 , 17.1 , 17.2 , 17.3 , 17.4 , 17.5 , 17.6 , 17.7 , 17.8 , 17.9 , 18.0 , 18.1, 18.2 , 18.3 , 18.4 , 18.5 , 18.6 , 18.7 , 18.8 , 18.9 , 19.0 , 19.1 , 19.2 , 19.3 , 19.4 , 19.5 , 19.6 , 19.7 , 19.8 , 19.9 , 20.0 , 20.1 , 20.2 , 20.3 , 20.4 , 20.5 , 20.6 , 20.7 , 20.8 , 20.9, 21.0 , 21.1 , 21.2 , 21.3 , 21.4 , 21.5 , 21.6 , 21.7 , 21.8 , 21.9 , 22.0 , 22.1 , 22.2 , 22.3 , 22.4 , 22.5 , 22.6 , 22.7 , 22.8 , 22.9 , 23.0 , 23.1 , 23.2 , 23.3 , 23.4 , 23.5 , 23.6 , 23.7 , 23.8, 23.9 , 24.0]
#traf2 = [5.648282572 , 5.15543392949 , 5.23828111858 , 3.99522995564 , 6.40135656351 , 3.33011698012 , 3.42595792088 , 0.887920546277 , 4.9063025046 , 6.3892931963 , 4.77314847668 , 3.43746839542 , 5.67484375709 , 5.3297812159 , 4.30606192381 , 4.88982691265 , 2.7806659404 , 2.42147134238 , 1.56921401765 , 2.26569041117 , 2.05704237866 , 3.68825624997 , 2.62980613877 , 2.08601428096 , 2.15463120912 , 2.12097583292 , 4.0181020104 , 4.76136547779 , 1.51607823457 , 1.75588636357 , 3.67988553676 , 4.16254546425 , 3.89581340977 , 3.16968429168 , 4.3081855229 , 2.12780904865 , 1.02279538146 , 2.07169198145 , 3.7928610568 , 5.00395450386 , 4.65880327762 , 5.13929330473 , 3.66703817684 , 5.6542576756 , 6.3448215367 , 1.10267510654 , 1.75606711166 , 1.90362678901 , 2.37726986022 , 4.40801447609 , 10.7108819679 , 19.1123797487 , 21.9144168831 , 11.4729174715 , 26.1441100047 , 14.1112663432 , 12.2157467347 , 9.47224430272 , 7.76382406644 , 3.72067391465 , 6.27401352228 , 11.9575959907 , 27.0941596366 , 1.4149245575 , 1.08184704264 , 0.775724340466 , 0.763910275063 , 0.419415884139 , 0.428053058844 , 0.740069330471 , 2.44294731878, 4.57328849058 , 5.80687995343 , 6.95878485269 , 7.72893462061 , 7.02814142419 , 5.05219816438 , 5.44598003157 , 6.13105945609 , 4.38539146046 , 6.26051298642 , 7.82124811496 , 6.47002032166 , 10.1974933772 , 3.6415823182 , 8.26392144517 , 4.41229726097 , 3.56887666101 , 6.36807457898 , 6.53689879115 , 6.50894555372]
traf1 = [ 3.96618645819 , 4.04497622846 , 3.39075473611 , 4.7234606614 , 4.164909464 , 3.74929904373 , 3.90519374081 , 4.01099285863 , 4.64369992486 , 4.57965918692 , 2.82826888741 , 5.0604905316 , 3.99257536387 , 7.18455151752 , 2.36224254873 , 4.16547682492 , 3.34751996066 , 3.58983560969 , 2.43789160656 , 2.54892943846 , 2.54892943846 , 4.86102740209 , 4.39002674918 , 3.4733625116 , 1.65661314039 , 4.30196947144 , 1.85158868053 , 3.45453815456 , 8.26514748182 , 3.39325035825 , 3.05344100669 , 4.92566172441 , 3.90778176245 , 2.98940013899 , 7.03302763038 , 4.51793391538 , 5.11233797865 , 3.58112845539 , 5.31103060742 , 5.36028896036 , 4.68315982201 , 4.68057920356 , 10.2563604348 , 7.45090549345 , 3.48067021098 , 4.95830331286 , 6.78096463283 , 5.14312042025 , 2.79491732187 , 3.85133045544 , 4.39286091368 , 4.15029338914 , 2.69199038573 , 2.6877504365 , 6.18964671317 , 3.92690164743 , 1.4216195593 , 2.32972493884 , 2.68810883884 , 3.07620211093 , 8.10307709548 , 6.24938041557 , 4.41333952399 , 5.74221501923 , 4.89501154313 , 7.2711287331 , 9.07431829147 , 4.32086457158 , 8.21095270683 , 2.74730418402 , 3.6636698868 , 4.57328849058 , 5.80687995343 , 6.95878485269 , 7.72893462061 , 7.02814142419 , 5.05219816438 , 5.44598003157 , 6.13105945609 , 4.38539146046 , 6.26051298642 , 7.82124811496 , 6.47002032166 , 10.1974933772 , 3.6415823182 , 8.26392144517 , 4.41229726097 , 3.56887666101 , 6.36807457898 , 6.53689879115 , 6.50894555372 ]
#occ2 = [ 3.43376451284 , 2.13581708141 , 4.13807611836 , 2.0743030885 , 2.27616236115 , 1.8607885637 , 3.83699568065 , 1.79999159126 , 2.78347123675 , 2.97150955692 , 3.22515920191 , 3.77469326189 , 2.10891340907 , 3.56228204836 , 2.11759849524 , 2.86155397168 , 2.44420294786 , 2.08136370027 , 1.78131533164 , 1.75831115087 , 1.3581481954 , 1.750114629 , 1.85558526873 , 2.72589476056 , 0.978178657459 , 2.20088259943 , 1.01649730622 , 1.55876494568 , 2.46512850977 , 2.73349348778 , 2.20530283716 , 2.60485116759 , 1.81709347884 , 2.67734032855 , 4.88695604165 , 3.61947500178 , 2.06317604437 , 2.24747339295 , 4.66517200172 , 2.72909921161 , 4.07424859228 , 2.52072001884 , 2.45789059095 , 3.45650152966 , 3.28383640492 , 2.54359671034 , 2.56622425956 , 3.67248937226 , 2.2656097676 , 2.9166235183 , 4.2959598894 , 3.41415392555 , 3.10378068753 , 1.59076738622 , 3.32978753887 , 2.10842312598 , 1.97281508282 , 1.53253131361 , 1.0859348115 , 2.29921994879 , 2.84173764276 , 2.95858511647 , 2.55703502614 , 1.55138408102 , 11.8911415216 , 8.31134465283 , 5.12287932888 , 3.34617552468 , 8.79609117735 , 1.71426537655 , 2.92456086528 , 5.30314993131 , 8.23194976761 , 7.19222936391 , 7.20510601604 , 5.99792971854 , 4.32794739852 , 6.46748675904 , 6.80954443842 , 4.91883488077 , 6.31881648107 , 3.31512496675 , 4.79112079617 , 3.16999156393 , 3.54661149475 , 2.75919922857 , 3.98297779129 , 3.89795549457 , 4.02183350182 , 5.68572844005 , 8.03894474887 ]
occ1 = [ 3.33126992611 , 2.15235043881 , 4.21215375236 , 2.04146402499 , 2.26508236112 , 1.75842743987 , 3.83752010319 , 1.79356812562 , 2.71647871756 , 2.98920028076 , 3.06963761795 , 3.78037524154 , 2.11330949347 , 3.62306600989 , 2.10132375418 , 2.79890211351 , 2.45220911956 , 2.0962944359 , 1.71888897623 , 2.00237892092 , 2.00237892092 , 1.75017286044 , 1.87819485903 , 2.77200592938 , 0.927552735382 , 2.16110258543 , 0.952612535679 , 1.55876494568 , 2.43936505277 , 2.74032154014 , 2.20187230613 , 2.62732676781, 1.81709347884 , 2.68646819361 , 4.87840695719 , 3.58804992604 , 1.96027598281 , 2.16400733578 , 4.55698744552 , 2.61612107743 , 4.1007299461 , 2.60197595024 , 2.42772928849 , 3.70504358394 , 2.64089183244 , 2.53083484208 , 2.69596558723 , 3.82189848477 , 2.10858933652 , 2.69381421149 , 4.48942308279 , 3.48776778082 , 1.75831208948 , 1.48030854681 , 3.2901866737 , 2.33799936521 , 1.50491990853 , 1.23953538087 , 1.19008302381 , 2.36576100342, 2.57888534853 , 2.052794471 , 2.64644323686 , 1.35534774334 , 5.6573022579 , 4.76819909982 , 1.85043233584 , 3.46190356262 , 5.28356384041 , 1.84882416982 , 3.01211103176 , 4.59728665448 , 8.01181670627 , 6.44190774176 , 7.57429158629 , 5.66900034971 , 4.30244931982 , 6.23339404063 , 6.88638460847 , 4.63713969717 , 5.75838213042 , 3.38303474858 , 4.29114582128 , 2.74825804228 , 2.33363923855 , 2.26640425042 , 4.06245325649 , 3.02492973852 , 4.13263598916, 4.06968874886 , 3.87911988994]
time = []
traf= []
occ = []
for time10 in range(160,240,1):
time01 = time10 / 10.0
for i in range(len(time1)):
if time1[i] == time01:
if time1[i] == 21:
print (traf1[i]-occ1[i])/traf1[i]
time.append(time1[i])
traf.append(traf1[i])
occ.append(occ1[i])
break
time.append(time1[-1])
traf.append(traf1[-1])
occ.append(occ1[-1])
print 'MEAN -occ: ',np.mean(occ)
print 'MEAN - traf:', np.mean(traf)
xlim(20,22)
#xlim(16,24)
ylim(0,10)
fig = plt.figure(1)
errorDis1 = plt.subplot(1,1,1)
ax=plt.gca()
for tick in ax.xaxis.get_major_ticks():
tick.label1.set_fontsize(xfontsize)
for tick in ax.yaxis.get_major_ticks():
tick.label1.set_fontsize(yfontsize)
errorDis1.set_xlabel('Time',size=xlabelsize)
errorDis1.set_ylabel('MSE',size=ylabelsize)
errorDis1.plot(time,occ,'ob-',label='TPO-P', linewidth=lwidth, markersize=osize,markerfacecolor='none',markeredgecolor='b',markeredgewidth=mewidth)
errorDis1.plot(time,traf,'*r--',label='TP-P', linewidth = lwidth, markersize=starsize,markerfacecolor='none',markeredgecolor='r',markeredgewidth=mewidth)
errorDis1.legend(bbox_to_anchor=(0.4, 1.02), prop={'size':legendsize})
plt.grid(True, linewidth = gridwidth)
plt.show()
elif graph == 13:#weight of O vs T: 150-240
#Weight of Occupancy v.s. Traffic, 20:00-22:00.
time1 =[ 15.0 , 15.1 , 15.2 , 15.3 , 15.4 , 15.5 , 15.6 , 15.7 , 15.8 , 15.9 , 16.0 , 16.1 , 16.2 , 16.3 , 16.4 , 16.5 , 16.6 , 16.7 , 16.8 , 16.9 , 17.0 , 17.1 , 17.2 , 17.3 , 17.4 , 17.5 , 17.6 , 17.7 , 17.8 , 17.9 , 18.0 , 18.1, 18.2 , 18.3 , 18.4 , 18.5 , 18.6 , 18.7 , 18.8 , 18.9 , 19.0 , 19.1 , 19.2 , 19.3 , 19.4 , 19.5 , 19.6 , 19.7 , 19.8 , 19.9 , 20.0 , 20.1 , 20.2 , 20.3 , 20.4 , 20.5 , 20.6 , 20.7 , 20.8 , 20.9, 21.0 , 21.1 , 21.2 , 21.3 , 21.4 , 21.5 , 21.6 , 21.7 , 21.8 , 21.9 , 22.0 , 22.1 , 22.2 , 22.3 , 22.4 , 22.5 , 22.6 , 22.7 , 22.8 , 22.9 , 23.0 , 23.1 , 23.2 , 23.3 , 23.4 , 23.5 , 23.6 , 23.7 , 23.8, 23.9 , 24.0]
#traf2 = [5.648282572 , 5.15543392949 , 5.23828111858 , 3.99522995564 , 6.40135656351 , 3.33011698012 , 3.42595792088 , 0.887920546277 , 4.9063025046 , 6.3892931963 , 4.77314847668 , 3.43746839542 , 5.67484375709 , 5.3297812159 , 4.30606192381 , 4.88982691265 , 2.7806659404 , 2.42147134238 , 1.56921401765 , 2.26569041117 , 2.05704237866 , 3.68825624997 , 2.62980613877 , 2.08601428096 , 2.15463120912 , 2.12097583292 , 4.0181020104 , 4.76136547779 , 1.51607823457 , 1.75588636357 , 3.67988553676 , 4.16254546425 , 3.89581340977 , 3.16968429168 , 4.3081855229 , 2.12780904865 , 1.02279538146 , 2.07169198145 , 3.7928610568 , 5.00395450386 , 4.65880327762 , 5.13929330473 , 3.66703817684 , 5.6542576756 , 6.3448215367 , 1.10267510654 , 1.75606711166 , 1.90362678901 , 2.37726986022 , 4.40801447609 , 10.7108819679 , 19.1123797487 , 21.9144168831 , 11.4729174715 , 26.1441100047 , 14.1112663432 , 12.2157467347 , 9.47224430272 , 7.76382406644 , 3.72067391465 , 6.27401352228 , 11.9575959907 , 27.0941596366 , 1.4149245575 , 1.08184704264 , 0.775724340466 , 0.763910275063 , 0.419415884139 , 0.428053058844 , 0.740069330471 , 2.44294731878, 4.57328849058 , 5.80687995343 , 6.95878485269 , 7.72893462061 , 7.02814142419 , 5.05219816438 , 5.44598003157 , 6.13105945609 , 4.38539146046 , 6.26051298642 , 7.82124811496 , 6.47002032166 , 10.1974933772 , 3.6415823182 , 8.26392144517 , 4.41229726097 , 3.56887666101 , 6.36807457898 , 6.53689879115 , 6.50894555372]
#traf1 = [ 3.96618645819 , 4.04497622846 , 3.39075473611 , 4.7234606614 , 4.164909464 , 3.74929904373 , 3.90519374081 , 4.01099285863 , 4.64369992486 , 4.57965918692 , 2.82826888741 , 5.0604905316 , 3.99257536387 , 7.18455151752 , 2.36224254873 , 4.16547682492 , 3.34751996066 , 3.58983560969 , 2.43789160656 , 2.54892943846 , 2.54892943846 , 4.86102740209 , 4.39002674918 , 3.4733625116 , 1.65661314039 , 4.30196947144 , 1.85158868053 , 3.45453815456 , 8.26514748182 , 3.39325035825 , 3.05344100669 , 4.92566172441 , 3.90778176245 , 2.98940013899 , 7.03302763038 , 4.51793391538 , 5.11233797865 , 3.58112845539 , 5.31103060742 , 5.36028896036 , 4.68315982201 , 4.68057920356 , 10.2563604348 , 7.45090549345 , 3.48067021098 , 4.95830331286 , 6.78096463283 , 5.14312042025 , 2.79491732187 , 3.85133045544 , 4.39286091368 , 4.15029338914 , 2.69199038573 , 2.6877504365 , 6.18964671317 , 3.92690164743 , 1.4216195593 , 2.32972493884 , 2.68810883884 , 3.07620211093 , 8.10307709548 , 6.24938041557 , 4.41333952399 , 5.74221501923 , 4.89501154313 , 7.2711287331 , 9.07431829147 , 4.32086457158 , 8.21095270683 , 2.74730418402 , 3.6636698868 , 4.57328849058 , 5.80687995343 , 6.95878485269 , 7.72893462061 , 7.02814142419 , 5.05219816438 , 5.44598003157 , 6.13105945609 , 4.38539146046 , 6.26051298642 , 7.82124811496 , 6.47002032166 , 10.1974933772 , 3.6415823182 , 8.26392144517 , 4.41229726097 , 3.56887666101 , 6.36807457898 , 6.53689879115 , 6.50894555372 ]
#occ2 = [ 3.43376451284 , 2.13581708141 , 4.13807611836 , 2.0743030885 , 2.27616236115 , 1.8607885637 , 3.83699568065 , 1.79999159126 , 2.78347123675 , 2.97150955692 , 3.22515920191 , 3.77469326189 , 2.10891340907 , 3.56228204836 , 2.11759849524 , 2.86155397168 , 2.44420294786 , 2.08136370027 , 1.78131533164 , 1.75831115087 , 1.3581481954 , 1.750114629 , 1.85558526873 , 2.72589476056 , 0.978178657459 , 2.20088259943 , 1.01649730622 , 1.55876494568 , 2.46512850977 , 2.73349348778 , 2.20530283716 , 2.60485116759 , 1.81709347884 , 2.67734032855 , 4.88695604165 , 3.61947500178 , 2.06317604437 , 2.24747339295 , 4.66517200172 , 2.72909921161 , 4.07424859228 , 2.52072001884 , 2.45789059095 , 3.45650152966 , 3.28383640492 , 2.54359671034 , 2.56622425956 , 3.67248937226 , 2.2656097676 , 2.9166235183 , 4.2959598894 , 3.41415392555 , 3.10378068753 , 1.59076738622 , 3.32978753887 , 2.10842312598 , 1.97281508282 , 1.53253131361 , 1.0859348115 , 2.29921994879 , 2.84173764276 , 2.95858511647 , 2.55703502614 , 1.55138408102 , 11.8911415216 , 8.31134465283 , 5.12287932888 , 3.34617552468 , 8.79609117735 , 1.71426537655 , 2.92456086528 , 5.30314993131 , 8.23194976761 , 7.19222936391 , 7.20510601604 , 5.99792971854 , 4.32794739852 , 6.46748675904 , 6.80954443842 , 4.91883488077 , 6.31881648107 , 3.31512496675 , 4.79112079617 , 3.16999156393 , 3.54661149475 , 2.75919922857 , 3.98297779129 , 3.89795549457 , 4.02183350182 , 5.68572844005 , 8.03894474887 ]
#occ1 = [ 3.33126992611 , 2.15235043881 , 4.21215375236 , 2.04146402499 , 2.26508236112 , 1.75842743987 , 3.83752010319 , 1.79356812562 , 2.71647871756 , 2.98920028076 , 3.06963761795 , 3.78037524154 , 2.11330949347 , 3.62306600989 , 2.10132375418 , 2.79890211351 , 2.45220911956 , 2.0962944359 , 1.71888897623 , 2.00237892092 , 2.00237892092 , 1.75017286044 , 1.87819485903 , 2.77200592938 , 0.927552735382 , 2.16110258543 , 0.952612535679 , 1.55876494568 , 2.43936505277 , 2.74032154014 , 2.20187230613 , 2.62732676781, 1.81709347884 , 2.68646819361 , 4.87840695719 , 3.58804992604 , 1.96027598281 , 2.16400733578 , 4.55698744552 , 2.61612107743 , 4.1007299461 , 2.60197595024 , 2.42772928849 , 3.70504358394 , 2.64089183244 , 2.53083484208 , 2.69596558723 , 3.82189848477 , 2.10858933652 , 2.69381421149 , 4.48942308279 , 3.48776778082 , 1.75831208948 , 1.48030854681 , 3.2901866737 , 2.33799936521 , 1.50491990853 , 1.23953538087 , 1.19008302381 , 2.36576100342, 2.57888534853 , 2.052794471 , 2.64644323686 , 1.35534774334 , 5.6573022579 , 4.76819909982 , 1.85043233584 , 3.46190356262 , 5.28356384041 , 1.84882416982 , 3.01211103176 , 4.59728665448 , 8.01181670627 , 6.44190774176 , 7.57429158629 , 5.66900034971 , 4.30244931982 , 6.23339404063 , 6.88638460847 , 4.63713969717 , 5.75838213042 , 3.38303474858 , 4.29114582128 , 2.74825804228 , 2.33363923855 , 2.26640425042 , 4.06245325649 , 3.02492973852 , 4.13263598916, 4.06968874886 , 3.87911988994]
#occ1 = [0.16692424373911482, 0.13704164759839338, 0.31898650830802555, 0.10452958991730418, 0.31734247022119816, 0.32618177540207616, 0.14666069277131949, 0.63816499626480339, 0.20222212595730965, 0.30745867901382179, 0.1081776386963046, 0.1081776386963046, 0.1081776386963046, 0.22744769349924376, 0.064402001317135624, 0.65630934850930966, 0.088356015730331042, 0.11858121691667395, 0.22123896282522026, 0.4172431700232126, 0.1801102608185714, 0.5357994474913671, 0.013358934515704666, 0.013358934515704666, 0.013358934515704666, 0.02928890142675656, 0.19509925496976271, 0.09149841111237525, 0.30475557707556417, 0.020628876229133036, 0.44587333627549025, 0.5169740694897037, 0.086486530428686897, 0.056413050345662519, 0.15005593904338121, 0.15005593904338121, 0.15005593904338121, 0.2178692432394603, 0.34006246238669746, 0.023801051120011213, 0.065710586334031817, 0.26957231375524304, 0.51680640464147753, 0.2108334053111165, 0.025596163398236449, 0.18088277051619972, 0.53369889128197556, 0.53369889128197556, 0.53369889128197556, 0.068350804189212966, 0.20490601178358731, 0.28010519103879217, 0.24792351261265427, 0.19471886019123119, 0.18949320889315055, 0.12231104220748805, 0.59769990043317622, 0.14143533979061235, 0.70597906595178994, 0.70597906595178994, 0.70597906595178994, 0.0612429135423945, 0.43968700066416316, 0.34686503544811798, 0.26026340253064684, 0.13582487867324738, 0.31666970783637693, 0.010776626269295798, 0.22061290038128353, 0.24352653254795392, 0.17772199265846572, 0.17772199265846572, 0.17772199265846572, 0.22171643473378519, 0.15618620512686038, 0.082508952923065398, 1.0318379800925894, 0.41999289642668192, 0.35616611242362006, 0.24795150494878584, 0.71525112321611062, 0.0191633164844968, 0.32286549211754012, 0.32286549211754012, 0.32286549211754012, 0.50552668483042484, 0.44355578395545192, 0.39068423391163876, 0.70745718260287205, 0.24367378831387293, 0.091675917698250925, 0.38021746558744762, 0.82149929593091731, 0.89141246269256569, 0.91078594774446331, 0.91078594774446331, 0.91078594774446331, 0.0045378837697872126, 0.4146017221626761]
#traf1 = [0.091365426892161275, 0.18318562132858984, 0.087518622333160337, 0.12991353273424527, 0.12333303264213957, 0.21871026881445504, 0.18199995502555133, 0.035563566181508924, 0.084652500660990601, 0.19527293859223749, 0.16598578432890765, 0.16598578432890765, 0.16598578432890765, 0.054325340968703444, 0.02209769135073289, 0.11873587140492134, 0.27913688833310613, 0.037738010724058982, 0.17872998077893681, 0.072373732452806039, 0.079229610954410765, 0.14300735540188467, 0.021276381330308951, 0.021276381330308951, 0.021276381330308951, 0.045459755357921211, 0.11834935891563431, 0.024950591197589179, 0.088386111085227814, 0.0035392195651209879, 0.11244785448112346, 0.063855721060757847, 0.074380369122522161, 0.038726148066208006, 0.11042747448848253, 0.11042747448848253, 0.11042747448848253, 0.20369622974738993, 0.15899705454493882, 0.12135197520044982, 0.10682149026144266, 0.25017538992979488, 0.3523298206509583, 0.071337499141292171, 0.015037482916069933, 0.01200362486455929, 0.13674523496742264, 0.13674523496742264, 0.13674523496742264, 0.07515299942694656, 0.26589990386792484, 0.06325581429869033, 0.015009364748792085, 0.14290339384241965, 0.065396055410470194, 0.033389564766905355, 0.014160720212584844, 0.048822701406542518, 0.17155508178326612, 0.17155508178326612, 0.17155508178326612, 0.30015628849540937, 0.016503136256720105, 0.072324402174702651, 0.028525210671920959, 0.1073225638875088, 0.17031121831163859, 0.069389657898292628, 0.029996028462573557, 0.14335754128280118, 0.13293325470109379, 0.13293325470109379, 0.13293325470109379, 0.16423584418805334, 0.060898271438304674, 0.15509548982413313, 0.012893958095829211, 0.24755290976025504, 0.19847282166752547, 0.61390048550958332, 0.23848569783394064, 0.059582229860323244, 0.0942077523412648, 0.0942077523412648, 0.0942077523412648, 0.25805369400602562, 0.16222661710713093, 0.13927239694986465, 0.12208355067051971, 0.38488546753105046, 0.0053375344925239744, 0.040468597148380747, 0.12469703225097389, 0.12481702485875984, 0.22712979159540161, 0.22712979159540161, 0.22712979159540161, 0.23363850137362199, 0.11620911544794008]
occ1 = [0.64626759301346248, 0.42795121120569218, 0.7847047534305015, 0.4458633238419431, 0.72012732307385008, 0.59861724696508289, 0.44623746029358324, 0.94721380662209509, 0.70491464630775935, 0.61157617354145921, 0.39457356310566827, 0.39457356310566827, 0.39457356310566827, 0.80720177475008459, 0.7445344524450388, 0.84680136287007735, 0.2404291749673591, 0.75858369252698776, 0.55314035342748247, 0.85218293713552729, 0.69449506389913751, 0.78932539451232664, 0.38570269071884972, 0.38570269071884972, 0.38570269071884972, 0.39183180924744454, 0.62242819501219693, 0.78573804238205847, 0.77518000825931599, 0.8535581952649145, 0.79859647754236451, 0.89006121569583962, 0.53762788162120001, 0.59295276066383029, 0.57606715532782105, 0.57606715532782105, 0.57606715532782105, 0.5168099789952586, 0.68140662756518666, 0.16397213150392423, 0.38086011384479801, 0.51865994182169817, 0.59462071606506695, 0.74718336293484133, 0.62992533823440056, 0.93776842145417216, 0.79603783579639442, 0.79603783579639442, 0.79603783579639442, 0.47629959950076328, 0.43522395316557061, 0.81577461238932047, 0.94291560302609412, 0.57673585750015022, 0.74343346476699279, 0.78555276427151866, 0.97685629743970193, 0.74338692283733754, 0.80450324101226689, 0.80450324101226689, 0.80450324101226689, 0.16946056658970773, 0.96382399591514567, 0.82746606740654827, 0.90122460038993224, 0.55861117535426397, 0.65027127518363359, 0.13442841190901594, 0.88030742319934374, 0.62945608005173703, 0.57208752843877186, 0.57208752843877186, 0.57208752843877186, 0.57446592970807742, 0.7194720119933401, 0.34725340978094243, 0.98765811819806382, 0.62915966594967832, 0.6421585116581271, 0.28769615629351253, 0.74994600966399605, 0.24335746431401045, 0.77412180332135916, 0.77412180332135916, 0.77412180332135916, 0.662047767126691, 0.73220315277800319, 0.73720038803276822, 0.85282995062970024, 0.38767035255303212, 0.94498150130738756, 0.90380333285775338, 0.86821230590634579, 0.87717634019898882, 0.80039840935220252, 0.80039840935220252, 0.80039840935220252, 0.019052618365397105, 0.78107245140087556]
traf1 = [0.35373240698653746, 0.57204878879430787, 0.21529524656949856, 0.55413667615805684, 0.27987267692614992, 0.40138275303491699, 0.55376253970641676, 0.052786193377904911, 0.29508535369224065, 0.3884238264585409, 0.60542643689433184, 0.60542643689433184, 0.60542643689433184, 0.19279822524991533, 0.25546554755496115, 0.1531986371299226, 0.75957082503264095, 0.24141630747301232, 0.44685964657251748, 0.14781706286447269, 0.30550493610086238, 0.21067460548767336, 0.61429730928115023, 0.61429730928115023, 0.61429730928115023, 0.60816819075255557, 0.37757180498780307, 0.21426195761794159, 0.22481999174068398, 0.14644180473508545, 0.20140352245763554, 0.10993878430416038, 0.46237211837879999, 0.40704723933616982, 0.42393284467217884, 0.42393284467217884, 0.42393284467217884, 0.48319002100474151, 0.31859337243481328, 0.8360278684960758, 0.61913988615520199, 0.48134005817830167, 0.40537928393493305, 0.25281663706515867, 0.3700746617655995, 0.06223157854582774, 0.20396216420360561, 0.20396216420360561, 0.20396216420360561, 0.52370040049923672, 0.56477604683442939, 0.18422538761067958, 0.057084396973905764, 0.42326414249984967, 0.25656653523300721, 0.21444723572848123, 0.023143702560298032, 0.25661307716266246, 0.19549675898773322, 0.19549675898773322, 0.19549675898773322, 0.83053943341029235, 0.036176004084854274, 0.17253393259345168, 0.098775399610067885, 0.44138882464573609, 0.34972872481636647, 0.86557158809098411, 0.11969257680065622, 0.37054391994826297, 0.42791247156122808, 0.42791247156122808, 0.42791247156122808, 0.42553407029192258, 0.28052798800665996, 0.65274659021905757, 0.012341881801936232, 0.37084033405032174, 0.3578414883418729, 0.71230384370648747, 0.25005399033600395, 0.75664253568598949, 0.22587819667864087, 0.22587819667864087, 0.22587819667864087, 0.337952232873309, 0.26779684722199687, 0.26279961196723195, 0.14717004937029973, 0.61232964744696794, 0.055018498692612508, 0.096196667142246589, 0.13178769409365418, 0.12282365980101108, 0.19960159064779756, 0.19960159064779756, 0.19960159064779756, 0.98094738163460282, 0.21892754859912433]
#occ1 = [0.16692424373911482, 0.13704164759839338, 0.31898650830802555, 0.10452958991730418, 0.31734247022119816, 0.32618177540207616, 0.14666069277131949, 0.63816499626480339, 0.20222212595730965, 0.30745867901382179, 0.1081776386963046, 0.1081776386963046, 0.1081776386963046, 0.22744769349924376, 0.064402001317135624, 0.65630934850930966, 0.088356015730331042, 0.11858121691667395, 0.22123896282522026, 0.4172431700232126, 0.1801102608185714, 0.5357994474913671, 0.013358934515704666, 0.013358934515704666, 0.013358934515704666, 0.02928890142675656, 0.19509925496976271, 0.09149841111237525, 0.30475557707556417, 0.020628876229133036, 0.44587333627549025, 0.5169740694897037, 0.086486530428686897, 0.056413050345662519, 0.15005593904338121, 0.15005593904338121, 0.15005593904338121, 0.2178692432394603, 0.34006246238669746, 0.023801051120011213, 0.065710586334031817, 0.26957231375524304, 0.51680640464147753, 0.2108334053111165, 0.025596163398236449, 0.18088277051619972, 0.53369889128197556, 0.53369889128197556, 0.53369889128197556, 0.068350804189212966, 0.20490601178358731, 0.28010519103879217, 0.24792351261265427, 0.19471886019123119, 0.18949320889315055, 0.12231104220748805, 0.59769990043317622, 0.14143533979061235, 0.70597906595178994, 0.70597906595178994, 0.70597906595178994, 0.0612429135423945, 0.43968700066416316, 0.34686503544811798, 0.26026340253064684, 0.13582487867324738, 0.31666970783637693, 0.010776626269295798, 0.22061290038128353, 0.24352653254795392, 0.17772199265846572, 0.17772199265846572, 0.17772199265846572, 0.22171643473378519, 0.15618620512686038, 0.082508952923065398, 1.0318379800925894, 0.41999289642668192, 0.35616611242362006, 0.24795150494878584, 0.71525112321611062, 0.0191633164844968, 0.32286549211754012, 0.32286549211754012, 0.32286549211754012, 0.50552668483042484, 0.44355578395545192, 0.39068423391163876, 0.70745718260287205, 0.24367378831387293, 0.091675917698250925, 0.38021746558744762, 0.82149929593091731, 0.89141246269256569, 0.91078594774446331, 0.91078594774446331, 0.91078594774446331, 0.0045378837697872126, 0.4146017221626761]
#traf1 = [0.83307575626088515, 0.86295835240160668, 0.68101349169197445, 0.89547041008269579, 0.68265752977880179, 0.67381822459792384, 0.85333930722868057, 0.36183500373519661, 0.7977778740426904, 0.69254132098617815, 0.89182236130369541, 0.89182236130369541, 0.89182236130369541, 0.77255230650075624, 0.93559799868286442, 0.34369065149069034, 0.91164398426966897, 0.881418783083326, 0.77876103717477974, 0.58275682997678735, 0.8198897391814286, 0.4642005525086329, 0.98664106548429531, 0.98664106548429531, 0.98664106548429531, 0.97071109857324345, 0.80490074503023723, 0.90850158888762478, 0.69524442292443589, 0.97937112377086699, 0.55412666372450969, 0.4830259305102963, 0.91351346957131307, 0.94358694965433743, 0.84994406095661879, 0.84994406095661879, 0.84994406095661879, 0.78213075676053967, 0.65993753761330254, 0.97619894887998881, 0.93428941366596818, 0.73042768624475696, 0.48319359535852247, 0.7891665946888835, 0.97440383660176355, 0.81911722948380028, 0.46630110871802444, 0.46630110871802444, 0.46630110871802444, 0.93164919581078709, 0.79509398821641275, 0.71989480896120783, 0.75207648738734578, 0.80528113980876881, 0.81050679110684942, 0.87768895779251199, 0.40230009956682378, 0.85856466020938771, 0.29402093404821006, 0.29402093404821006, 0.29402093404821006, 0.93875708645760547, 0.56031299933583689, 0.65313496455188202, 0.73973659746935316, 0.86417512132675256, 0.68333029216362307, 0.98922337373070424, 0.77938709961871644, 0.75647346745204613, 0.82227800734153433, 0.82227800734153433, 0.82227800734153433, 0.77828356526621478, 0.84381379487313968, 0.91749104707693463, -0.031837980092589424, 0.58000710357331808, 0.64383388757637994, 0.75204849505121418, 0.28474887678388938, 0.98083668351550324, 0.67713450788245988, 0.67713450788245988, 0.67713450788245988, 0.49447331516957516, 0.55644421604454808, 0.60931576608836124, 0.29254281739712795, 0.75632621168612713, 0.9083240823017491, 0.61978253441255238, 0.17850070406908269, 0.10858753730743431, 0.089214052255536691, 0.089214052255536691, 0.089214052255536691, 0.99546211623021275, 0.5853982778373239]
time = []
traf= []
occ = []
for time10 in range(160,240,1):
time01 = time10 / 10.0
for i in range(len(time1)):
if time1[i] == time01:
time.append(time1[i])
traf.append(traf1[i])
occ.append(occ1[i])
break
time.append(time1[-1])
traf.append(traf1[-1])
occ.append(occ1[-1])
print 'MEAN -occ: ',np.mean(occ)
print 'MEAN - traf:', np.mean(traf)
#fig = plt.figure(figsize=(8,6),dpi=80)
errorDis1 = plt.subplot(1,1,1)
ax=plt.gca()
for tick in ax.xaxis.get_major_ticks():
tick.label1.set_fontsize(xfontsize)
for tick in ax.yaxis.get_major_ticks():
tick.label1.set_fontsize(yfontsize)
errorDis1.set_xlabel('Time',size=xlabelsize)
errorDis1.set_ylabel('Weight',size=ylabelsize)
errorDis1.plot(time,occ,'ob-',label='Occupancy', linewidth=lwidth, markersize=osize,markerfacecolor='none',markeredgecolor='b',markeredgewidth=mewidth)
errorDis1.plot(time,traf,'*r--',label='Traffic', linewidth = lwidth, markersize=starsize,markerfacecolor='none',markeredgecolor='r',markeredgewidth=mewidth)
errorDis1.legend(bbox_to_anchor=(0.5, 0.6), prop={'size':legendsize})
plt.grid(True, linewidth = gridwidth)
xlim(20, 22)
ylim(0,1)
plt.show()
elif graph == 16:#different prediction time - TPO-P vs TP-P
#TPO-P V.S. TP-P: Mean MSE on 20:00 - 22:00, as a function of prediction length.
time = [0.2, 0.4, 0.6, 0.8, 1, 2]
occ = [2.81367649395, 2.72324523499, 2.89804996496, 2.90757317685, 2.85996496, 3.11718528831]
traf = [4.72950579968, 4.76761682691, 5.080508459, 5.08152992209, 5.24693381719, 5.32249324451]
print 'MEAN - occ: ',np.mean(occ)
print 'MEAN - traf:', np.mean(traf)
ylim(0,10)
xlim(0.2,1)
fig = plt.figure(1)
errorDis1 = plt.subplot(1,1,1)
ax=plt.gca()
for tick in ax.xaxis.get_major_ticks():
tick.label1.set_fontsize(xfontsize)
for tick in ax.yaxis.get_major_ticks():
tick.label1.set_fontsize(yfontsize)
errorDis1.set_xlabel('Prediction Length (hour)',size=xlabelsize)
errorDis1.set_ylabel('Mean MSE',size=yfontsize)
errorDis1.plot(time,occ,'ob-',label='TPO-P', linewidth=lwidth, markersize=osize,markerfacecolor='none',markeredgecolor='b',markeredgewidth=mewidth)
errorDis1.plot(time,traf,'*r--',label='TP-P', linewidth = lwidth, markersize=starsize,markerfacecolor='none',markeredgecolor='r',markeredgewidth=mewidth)
errorDis1.legend(bbox_to_anchor=(0.4, 1), prop={'size':legendsize})
plt.grid(True, linewidth = gridwidth)
plt.show()
elif graph == 17:#O versus T - TPO-T TP-T - 1 month training 3 month test
#TPO-T v.s. TP-T: MSE as a function of time, 16:00-24:00.
# time1 = [ 6.0 , 6.1 , 6.2 , 6.3 , 6.4 , 6.5 , 6.6 , 6.7 , 6.8 , 6.9 , 7.0 , 7.1 , 7.2 , 7.3 , 7.4 , 7.5 , 7.6 , 7.7 , 7.8 , 7.9 , 8.0 , 8.1 , 8.2 , 8.3 , 8.4 , 8.5 , 8.6 , 8.7 , 8.8 , 8.9 , 9.0 , 9.1 , 9.2 , 9.3 , 9.4 , 9.5 , 9.6 , 9.7 , 9.8 , 9.9 , 10.0 , 10.1 , 10.2 , 10.3 , 10.4 , 10.5 , 10.6 , 10.7 , 10.8 , 10.9 , 11.0 , 11.1 , 11.2 , 11.3 , 11.4 , 11.5 , 11.6 , 11.7 , 11.8 , 11.9 , 12.0 , 12.1 , 12.2 , 12.3 , 12.4 , 12.5 , 12.6 , 12.7 , 12.8 , 12.9 , 13.0 , 13.1 , 13.2 , 13.3 , 13.4 , 13.5 , 13.6 , 13.7 , 13.8 , 13.9 , 14.0 , 14.1 , 14.2 , 14.3 , 14.4 , 14.5 , 14.6 , 14.7 , 14.8 , 14.9 , 15.0 , 15.1 , 15.2 , 15.3 , 15.4 , 15.5 , 15.6 , 15.7 , 15.8 , 15.9 , 16.0 , 16.1 , 16.2 , 16.3 , 16.4 , 16.5 , 16.6 , 16.7 , 16.8 , 16.9 , 17.0 , 17.1 , 17.2 , 17.3 , 17.4 , 17.5 , 17.6 , 17.7 , 17.8 , 17.9 , 18.0 , 18.1 , 18.2 , 18.3 , 18.4 , 18.5 , 18.6 , 18.7 , 18.8 , 18.9 , 19.0 , 19.1 , 19.2 , 19.3 , 19.4 , 19.5 , 19.6 , 19.7 , 19.8 , 19.9 , 20.0 , 20.1 , 20.2 , 20.3 , 20.4 , 20.5 , 20.6 , 20.7 , 20.8 , 20.9 , 21.0 , 21.1 , 21.2 , 21.3 , 21.4 , 21.5 , 21.6 , 21.7 , 21.8 , 21.9 , 22.0 ]
# oftt1 = [ 2.24145459457 , 1.73143800808 , 0.799179426583 , 2.01173649785 , 1.81718487406 , 1.15549025585 , 2.81841446511 , 1.31058908497 , 1.10303421876 , 0.645413892646 , 2.58626674665 , 3.61801909886 , 0.952661481413 , 1.33722863725 , 2.33427913521 , 3.25891430085 , 1.58177500317 , 3.16742183238 , 3.40244886268 , 2.74782217877 , 2.02421508291 , 3.43543221065 , 2.75801727099 , 3.47512377666 , 3.21835103328 , 3.55187074828 , 2.58031331124 , 2.29762085226 , 4.06586361021 , 1.99885747247 , 3.50018608759 , 2.89382577221 , 2.87643825366 , 3.82574308484 , 2.88754786537 , 3.4611622107 , 2.38718055664 , 3.64932069411 , 3.87850569272 , 4.4113182732 , 2.60367705107 , 4.38603456884 , 3.76237502142 , 4.70449294799 , 4.48489780315 , 4.00217675235 , 3.69113872225 , 2.84381752466 , 2.64490642981 , 3.26550030106 , 3.11284322531 , 3.5278606601 , 2.73389921687 , 3.22909639958 , 9.68749273327 , 3.33794329991 , 1.82267761822 , 3.84960343354 , 3.34947114286 , 1.97525234047 , 4.80490149444 , 8.14703674908 , 2.85123026634 , 4.55860899603 , 3.8336676661 , 6.30110432527 , 5.03219707113 , 16.0849484556 , 2.45380197659 , 1.51388666902 , 1.93585020619 , 1.3686990979 , 1.79589742566 , 1.87033918163 , 2.1347025076 , 2.2107307156 , 2.00306285687 , 1.42081441613 , 2.25800807735 , 2.64485987569 , 1.57499868863 , 1.46970759794 , 2.14947144609 , 1.71494163207 , 1.42890994211 , 1.42921051412 , 2.56822992844 , 2.57491186436 , 2.24887120575 , 2.45006028512 , 2.29030145929 , 2.20357005345 , 2.37107043373 , 1.79574736231 , 2.16022404774 , 1.98744860352 , 2.76517152188 , 4.46927922498 , 2.28449240154 , 3.50934876462 , 3.43002757824 , 3.57237690717 , 3.74711858238 , 5.269319282 , 1.91724186837 , 2.37274846701 , 2.74429162252 , 4.33152677022 , 5.19693037903 , 4.14178144568 , 1.3717559139 , 5.10188377373 , 15.3319173641 , 2.72503824835 , 4.43168328127 , 2.77228298597 , 4.00000047582 , 2.78321470794 , 4.4266595246 , 12.3738675504 , 2.2362768749 , 3.53624063741 , 2.17194051215 , 1.80232955064 , 3.11447942993 , 5.58415288653 , 14.1053921526 , 8.57341416642 , 3.15187293847 , 2.76141329912 , 4.07248264248 , 1.99320484803 , 2.91473616599 , 2.20586857277 , 2.94563619851 , 5.42395269199 , 29.078302079 , 14.0218517407 , 20.5513224061 , 8.07341836515 , 6.53713071169 , 3.6100915748 , 2.98813230058 , 2.04783764553 , 2.60001717019 , 1.67795651189 , 2.92481559366 , 1.78590828584 , 0.883847519117 , 2.09792479628 , 2.77275673653 , 6.82743125648 , 2.05469069428 , 4.18963363872 , 5.88560779047 , 3.49943148138 , 2.40634975286 , 3.75794501409 , 3.99229239053 , 1.58456767841 , 3.45776889589 ]
# ftt1 = [ 3.31262327416 , 1.84214332676 , 1.11111111111 , 2.03014464168 , 1.93767258383 , 1.65447074293 , 9.03852728468 , 1.27301117686 , 1.26666666667 , 9.82712031558 , 10.434122288 , 10.373339908 , 9.46630506246 , 4.1728139382 , 5.41262327416 , 4.27879684418 , 6.29760026298 , 9.66288625904 , 11.6660420776 , 11.8333333333 , 10.6944444444 , 10.0307034845 , 3.57557527942 , 11.5675871137 , 10.4951347798 , 12.6495069034 , 8.61134122288 , 7.35282708744 , 15.2697238659 , 11.763477975 , 11.9313938199 , 5.16702827087 , 9.16988823143 , 13.1682117028 , 6.59408284024 , 11.0944444444 , 10.6555555556 , 9.95519395135 , 9.09247205786 , 6.50575279421 , 8.11604207758 , 7.55410913872 , 11.0204470743 , 9.8771860618 , 11.4343523997 , 12.8762656147 , 7.9865877712 , 9.08829717291 , 8.25016436555 , 5.91666666667 , 3.31130834977 , 9.45788954635 , 9.45358316897 , 11.9777120316 , 10.9437869822 , 12.5656147272 , 10.2722222222 , 12.8760026298 , 8.95239973702 , 10.3648915187 , 5.87370151216 , 4.64280078895 , 11.4609138725 , 12.0109467456 , 3.86985535832 , 2.52258382643 , 12.7899408284 , 12.5566732413 , 10.8793228139 , 8.65 , 3.78099934254 , 10.8026298488 , 7.08011176857 , 13.9724194609 , 8.85548980934 , 10.6792899408 , 1.92024983563 , 8.36048652202 , 10.8907626561 , 12.25539119 , 10.9333333333 , 8.59119000657 , 3.31245890861 , 6.69470742932 , 5.44224194609 , 8.9033530572 , 12.6318211703 , 8.3892504931 , 12.5443786982 , 11.1166666667 , 12.7669296515 , 5.2476660092 , 10.1997698882 , 7.16147271532 , 14.1570348455 , 12.6276134122 , 6.18612754767 , 8.52889546351 , 6.97771203156 , 5.6845496384 , 9.83563445102 , 4.45420775805 , 7.94322813938 , 11.9659763314 , 5.65262984878 , 11.1993754109 , 5.48007889546 , 3.85 , 7.94165023011 , 5.82501643655 , 13.3653188692 , 12.3447074293 , 8.30325443787 , 9.31564760026 , 1.98583168968 , 5.0335634451 , 3.27419460881 , 5.45749506903 , 9.69375410914 , 10.5053583169 , 5.52222222222 , 8.88484549638 , 4.34707429323 , 7.59566074951 , 11.1198224852 , 3.9771860618 , 14.2973701512 , 5.28652202498 , 9.70667324129 , 9.508382643 , 12.7611111111 , 8.00660749507 , 11.3608809993 , 15.2407955293 , 4.07712031558 , 11.8497370151 , 13.1331032216 , 11.6076265615 , 9.47376725838 , 5.78333333333 , 5.68783694938 , 5.93011176857 , 6.64806048652 , 5.23185404339 , 16.66617357 , 9.43609467456 , 2.10019723866 , 2.68957922419 , 4.42330703485 , 9.30023011177 , 10.2113412229 , 7.99375410914 , 8.58267587114 , 10.5413872452 , 5.42728468113 , 6.30785667324 , 8.36650230112 , 7.07001972387 , 8.60621301775 , 4.16111111111 , 5.93625904011 ]
#
time1 = [ 15.0 , 15.1 , 15.2 , 15.3 , 15.4 , 15.5 , 15.6 , 15.7 , 15.8 , 15.9 , 16.0 , 16.1 , 16.2 , 16.3 , 16.4 , 16.5 , 16.6 , 16.7 , 16.8 , 16.9 , 17.0 , 17.1 , 17.2 , 17.3 , 17.4 , 17.5 , 17.6 , 17.7 , 17.8 , 17.9 , 18.0 , 18.1 , 18.2 , 18.3 , 18.4 , 18.5 , 18.6 , 18.7 , 18.8 , 18.9 , 19.0 , 19.1 , 19.2 , 19.3 , 19.4 , 19.5 , 19.6 , 19.7 , 19.8 , 19.9 , 20.0 , 20.1 , 20.2 , 20.3 , 20.4 , 20.5 , 20.6 , 20.7 , 20.8 , 20.9 , 21.0 , 21.1 , 21.2 , 21.3 , 21.4 , 21.5 , 21.6 , 21.7 , 21.8 , 21.9 , 22.0 , 22.1 , 22.2 , 22.3 , 22.4 , 22.5 , 22.6 , 22.7 , 22.8 , 22.9 , 23.0 , 23.1 , 23.2 , 23.3 , 23.4 , 23.5 , 23.6 , 23.7 , 23.8 , 23.9 , 24.0 ]
oftt1 = [ 3.34016987043 , 2.11315860427 , 3.18601772454 , 2.27078098197 , 1.9420457237 , 1.78898985201 , 3.73454058499 , 1.68480930255 , 3.0386681039 , 2.85571865734 , 3.67601949705 , 3.79573983327 , 2.14938619725 , 3.30385990796 , 2.52350280827 , 2.78920221392 , 2.33322730245 , 1.98399477751 , 1.60538259827 , 1.6598521442 , 1.32650828772 , 1.77548607706 , 1.99973719458 , 2.6260890102 , 0.836643695985 , 3.07519345155 , 1.07249957761 , 2.00305118752 , 2.5596876696 , 3.60327651365 , 1.7923848476 , 2.93387600578 , 2.10630249637 , 2.62657712208 , 4.46121606175 , 3.67395466752 , 6.08488199517 , 2.82596124205 , 3.91241243228 , 2.41879102395 , 5.58772604829 , 5.46544361042 , 2.28721049498 , 2.77276299549 , 3.76564829102 , 2.98083742388 , 2.27925861381 , 4.62218104164 , 2.28501948578 , 3.05490472895 , 3.46676593792 , 3.92566641941 , 2.17956934145 , 1.37175933222 , 6.96433390259 , 2.01892635736 , 1.26722331867 , 2.8570576534 , 1.13259061279 , 1.95600833705 , 3.03595447335 , 2.68137884379 , 2.422802909 , 1.68415431027 , 6.4498319049 , 3.96220874586 , 4.69988034974 , 4.07102932834 , 10.7651747519 , 1.81898918617 , 4.65267675925 , 6.19047595255 , 9.03167793854 , 6.76516119096 , 9.09661653142 , 5.77479201038 , 5.02901085492 , 7.21128650775 , 9.02549607313 , 4.47327569073 , 6.31552038723 , 3.84705878877 , 4.93029548398 , 7.19598955666 , 2.89317645075 , 2.24624292048 , 19.8300025219 , 16.3631961495 , 5.65725732509 , 7.03276276214 , 7.74351929772 ]
ftt1 = [ 11.9777777778 , 5.30444444444 , 6.60555555556 , 5.95777777778 , 12.5111111111 , 9.20444444444 , 7.46666666667 , 5.53777777778 , 8.21333333333 , 6.09333333333 , 7.58333333333 , 5.55333333333 , 8.17 , 12.5644444444 , 5.17 , 12.4677777778 , 6.09444444444 , 4.99666666667 , 6.82777777778 , 5.94777777778 , 11.0944444444 , 10.26 , 5.23666666667 , 7.97 , 1.59666666667 , 7.39333333333 , 2.73333333333 , 4.52222222222 , 13.65 , 9.81888888889 , 5.72222222222 , 4.58444444444 , 4.84666666667 , 6.91111111111 , 9.93 , 4.4 , 13.1433333333 , 5.34333333333 , 9.29 , 8.00111111111 , 11.3344444444 , 8.30888888889 , 13.0066666667 , 9.40888888889 , 3.65 , 9.62 , 15.25 , 9.95666666667 , 6.53333333333 , 4.36111111111 , 6.1 , 5.91666666667 , 4.94666666667 , 3.92 , 13.6955555556 , 9.13777777778 , 1.22333333333 , 2.35555555556 , 4.62 , 7.94333333333 , 9.09333333333 , 6.67333333333 , 7.17555555556 , 8.79777777778 , 5.32111111111 , 8.37 , 9.10444444444 , 4.39333333333 , 7.40111111111 , 3.44 , 3.62333333333 , 5.64111111111 , 6.80555555556 , 8.66333333333 , 9.05111111111 , 10.2 , 5.94333333333 , 6.72888888889 , 6.26888888889 , 4.31666666667 , 9.28888888889 , 9.24 , 6.27111111111 , 12.4866666667 , 3.67666666667 , 7.58777777778 , 3.85 , 4.34666666667 , 6.28 , 6.28 , 6.28 ]
ofpt1 = [ 3.33126992611 , 2.15235043881 , 4.21215375236 , 2.04146402499 , 2.26508236112 , 1.75842743987 , 3.83752010319 , 1.79356812562 , 2.71647871756 , 2.98920028076 , 3.06963761795 , 3.78037524154 , 2.11330949347 , 3.62306600989 , 2.10132375418 , 2.79890211351 , 2.45220911956 , 2.0962944359 , 1.71888897623 , 2.00237892092 , 2.00237892092 , 1.75017286044 , 1.87819485903 , 2.77200592938 , 0.927552735382 , 2.16110258543 , 0.952612535679 , 1.55876494568 , 2.43936505277 , 2.74032154014 , 2.20187230613 , 2.62732676781, 1.81709347884 , 2.68646819361 , 4.87840695719 , 3.58804992604 , 1.96027598281 , 2.16400733578 , 4.55698744552 , 2.61612107743 , 4.1007299461 , 2.60197595024 , 2.42772928849 , 3.70504358394 , 2.64089183244 , 2.53083484208 , 2.69596558723 , 3.82189848477 , 2.10858933652 , 2.69381421149 , 4.48942308279 , 3.48776778082 , 1.75831208948 , 1.48030854681 , 3.2901866737 , 2.33799936521 , 1.50491990853 , 1.23953538087 , 1.19008302381 , 2.36576100342, 2.57888534853 , 2.052794471 , 2.64644323686 , 1.35534774334 , 5.6573022579 , 4.76819909982 , 1.85043233584 , 3.46190356262 , 5.28356384041 , 1.84882416982 , 3.01211103176 , 4.59728665448 , 8.01181670627 , 6.44190774176 , 7.57429158629 , 5.66900034971 , 4.30244931982 , 6.23339404063 , 6.88638460847 , 4.63713969717 , 5.75838213042 , 3.38303474858 , 4.29114582128 , 2.74825804228 , 2.33363923855 , 2.26640425042 , 4.06245325649 , 3.02492973852 , 4.13263598916, 4.06968874886 , 3.87911988994]
time = []
oftt= []
ftt = []
ofpt = []
for time10 in range(160,241,10):
time01 = time10 / 10.0
for i in range(len(time1)):
if time1[i] == time01:
print time1[i], oftt1[i], ftt1[i], ftt1[i]-oftt1[i]
time.append(time1[i])
oftt.append(oftt1[i])
ftt.append(ftt1[i])
ofpt.append(ofpt1[i])
break
oftt = [3.43002757824 , 1.3717559139 , 2.2362768749, 4.07248264248 , 6.53713071169 , 2.77275673653, 3.45776889589 , 3.33960558247 , 2.20642583678]
ftt = [ 9.83563445102 , 13.3653188692 , 5.52222222222 , 12.7611111111 , 5.68783694938 , 10.2113412229 , 5.93625904011 , 7.56084812623 , 4.42580539119 ]
print 'MEAN - oftt: ',np.mean(oftt)
print 'MEAN - ftt:', np.mean(ftt)
#print 'MEAN - ofpt: ', np.mean(ofpt)
fig = plt.figure(1)
errorDis1 = plt.subplot(1,1,1)
ax=plt.gca()
for tick in ax.xaxis.get_major_ticks():
tick.label1.set_fontsize(xfontsize)
for tick in ax.yaxis.get_major_ticks():
tick.label1.set_fontsize(yfontsize)
#xlim(17,19)
xlim(16,24)
ylim(0,15)
errorDis1.set_xlabel('Time',size=xlabelsize)
errorDis1.set_ylabel('MSE',size=ylabelsize)
errorDis1.plot(time,oftt,'pb-',label='TPO-T', linewidth=lwidth, markersize=psize,markerfacecolor='none',markeredgecolor='b',markeredgewidth=mewidth)
errorDis1.plot(time,ftt,'^r--',label='TP-T', linewidth = lwidth, markersize=trisize,markerfacecolor='none',markeredgecolor='r',markeredgewidth=mewidth)
errorDis1.legend(bbox_to_anchor=(1, 1.05), prop={'size':legendsize})
plt.grid(True, linewidth = gridwidth)
plt.show()
elif graph == 18:#TP-T div TPO-T
#Top 20\% volatile cases: the Mean Ratio as a function of time.
time = []
time = [16, 17, 18, 19, 20, 21, 22, 23, 24]
zero = [0,0,0,0,0,0,0,0,0]
#25%
ratio = [29.449440786210829, 1.966945665150265, -0.90679204545960623, 0.31649577180399935, -0.58513609309913805, 9.6470266986344786, 72.850068868677127, 2.0137292360314354, 0.40817146087171535]
#ratio = [0.9226968260940509, 2.3299636296757691, 6.1308679657051401, 3.3373095525097929, 1.8801378014210286, 5.0544597175498813, 28.451763144349881, 1.3896783132826964, 1.1369982372732155]
#print len(ha)
print 'Ratio', np.mean(ratio)
#print 'Real', np.mean(ha)
fig = plt.figure(1)
errorDis1 = plt.subplot(1,1,1)
ax=plt.gca()
for tick in ax.xaxis.get_major_ticks():
tick.label1.set_fontsize(xfontsize)
for tick in ax.yaxis.get_major_ticks():
tick.label1.set_fontsize(yfontsize)
errorDis1.set_xlabel('Time',size=xlabelsize)
errorDis1.set_ylabel('Mean Ratio',size=ylabelsize)
errorDis1.plot(time,zero,'r--', linewidth=lwidth, markersize=6,markerfacecolor='r',markeredgecolor='r')
errorDis1.plot(time,ratio,'pb-',label='TP-T / TPO-T', linewidth = lwidth, markersize=psize,markerfacecolor='none',markeredgecolor='b',markeredgewidth=mewidth)
ylim(-2,80)
errorDis1.legend(bbox_to_anchor=(0.5, 1), loc=0, borderaxespad=0.,prop={'size':legendsize})
plt.grid(True, linewidth = gridwidth)
plt.show()
elif graph == 19:#TPO-T vs TP-P 150-240 #train 1 predict 1 vs train 3 predict 1
#TPO-T v.s. TP-P: MSE as a function of time, 16:00-24:00.
time1 =[16.0 , 16.1 , 16.2 , 16.3 , 16.4 , 16.5 , 16.6 , 16.7 , 16.8 , 16.9 , 17.0 , 17.1 , 17.2 , 17.3 , 17.4 , 17.5 , 17.6 , 17.7 , 17.8 , 17.9 , 18.0, 18.1 , 18.2 , 18.3 , 18.4 , 18.5 , 18.6 , 18.7 , 18.8 , 18.9 , 19.0 , 19.1 , 19.2 , 19.3 , 19.4 , 19.5 , 19.6 , 19.7 , 19.8 , 19.9 , 20.0, 20.1 , 20.2 , 20.3 , 20.4 , 20.5 , 20.6 , 20.7 , 20.8 , 20.9 , 21.0 , 21.1 , 21.2 , 21.3 , 21.4 , 21.5 , 21.6 , 21.7 , 21.8 , 21.9 , 22.0, 22.1 , 22.2 , 22.3 , 22.4 , 22.5 , 22.6 , 22.7 , 22.8 , 22.9 , 23.0 , 23.1 , 23.2 , 23.3 , 23.4 , 23.5 , 23.6 , 23.7 , 23.8 , 23.9 , 24.0]
#traf1 = [ 3.96618645819 , 4.04497622846 , 3.39075473611 , 4.7234606614 , 4.164909464 , 3.74929904373 , 3.90519374081 , 4.01099285863 , 4.64369992486 , 4.57965918692 , 2.82826888741 , 5.0604905316 , 3.99257536387 , 7.18455151752 , 2.36224254873 , 4.16547682492 , 3.34751996066 , 3.58983560969 , 2.43789160656 , 2.54892943846 , 2.54892943846 , 4.86102740209 , 4.39002674918 , 3.4733625116 , 1.65661314039 , 4.30196947144 , 1.85158868053 , 3.45453815456 , 8.26514748182 , 3.39325035825 , 3.05344100669 , 4.92566172441 , 3.90778176245 , 2.98940013899 , 7.03302763038 , 4.51793391538 , 5.11233797865 , 3.58112845539 , 5.31103060742 , 5.36028896036 , 4.68315982201 , 4.68057920356 , 10.2563604348 , 7.45090549345 , 3.48067021098 , 4.95830331286 , 6.78096463283 , 5.14312042025 , 2.79491732187 , 3.85133045544 , 4.39286091368 , 4.15029338914 , 2.69199038573 , 2.6877504365 , 6.18964671317 , 3.92690164743 , 1.4216195593 , 2.32972493884 , 2.68810883884 , 3.07620211093 , 8.10307709548 , 6.24938041557 , 4.41333952399 , 5.74221501923 , 4.89501154313 , 7.2711287331 , 9.07431829147 , 4.32086457158 , 8.21095270683 , 2.74730418402 , 3.6636698868 , 4.57328849058 , 5.80687995343 , 6.95878485269 , 7.72893462061 , 7.02814142419 , 5.05219816438 , 5.44598003157 , 6.13105945609 , 4.38539146046 , 6.26051298642 , 7.82124811496 , 6.47002032166 , 10.1974933772 , 3.6415823182 , 8.26392144517 , 4.41229726097 , 3.56887666101 , 6.36807457898 , 6.53689879115 , 6.50894555372 ]
occ1 = [4.69668769016 , 5.22815511796 , 4.75651864455 , 7.27951179414 , 1.83936252642 , 2.92045248929 , 3.27799965301 , 5.89231086353 , 7.41883633633 , 5.29257760195 , 1.29865347968 , 7.08251471428 , 16.9714386887 , 3.68136567864 , 4.6412439188 , 3.88903306758 , 3.54682791884 , 3.73403607414 , 6.9666255785 , 20.3582630944 , 3.19957891476, 3.80543310502 , 1.93401424702 , 3.17057766458 , 3.96305911318 , 6.51887629373 , 20.4186073407 , 11.4147131854 , 3.85847773442 , 3.11570712986 , 3.50262623757 , 2.22010631502 , 2.31444421917 , 2.59850885854 , 2.68293911389 , 6.75030937958 , 43.7200549223 , 21.8209065471 , 29.7734428877 , 10.3799544067 , 7.0800434828, 4.84267494922 , 2.87969582577 , 1.73273692692 , 3.36322225073 , 1.95472294708 , 2.32214555282 , 1.50623440831 , 1.09532940564 , 1.76316748388 , 2.68600217437 , 8.51850047806 , 3.06249792008 , 3.8621030668 , 10.2604727585 , 5.18644468396 , 1.89713897743 , 3.90466259625 , 5.35529750254 , 1.55552123283 , 2.9387445849, 3.87210768706 , 6.7209386312 , 7.24779869356 , 6.87608364896 , 5.11448242313 , 4.95290896891 , 6.55150709768 , 5.4000674614 , 4.36536378271 , 4.45552987643 , 3.45963586477 , 4.39443102979 , 3.25922301023 , 1.95031262487 , 2.22012292429 , 4.23730662071 , 8.2025886652 , 10.6547490425 , 3.34325981498 , 3.56071448287 ]
#[ 3.34016987043 , 2.11315860427 , 3.18601772454 , 2.27078098197 , 1.9420457237 , 1.78898985201 , 3.73454058499 , 1.68480930255 , 3.0386681039 , 2.85571865734 , 3.67601949705 , 3.79573983327 , 2.14938619725 , 3.30385990796 , 2.52350280827 , 2.78920221392 , 2.33322730245 , 1.98399477751 , 1.60538259827 , 1.6598521442 , 1.32650828772 , 1.77548607706 , 1.99973719458 , 2.6260890102 , 0.836643695985 , 3.07519345155 , 1.07249957761 , 2.00305118752 , 2.5596876696 , 3.60327651365 , 1.7923848476 , 2.93387600578 , 2.10630249637 , 2.62657712208 , 4.46121606175 , 3.67395466752 , 6.08488199517 , 2.82596124205 , 3.91241243228 , 2.41879102395 , 5.58772604829 , 5.46544361042 , 2.28721049498 , 2.77276299549 , 3.76564829102 , 2.98083742388 , 2.27925861381 , 4.62218104164 , 2.28501948578 , 3.05490472895 , 3.46676593792 , 3.92566641941 , 2.17956934145 , 1.37175933222 , 6.96433390259 , 2.01892635736 , 1.26722331867 , 2.8570576534 , 1.13259061279 , 1.95600833705 , 3.03595447335 , 2.68137884379 , 2.422802909 , 1.68415431027 , 6.4498319049 , 3.96220874586 , 4.69988034974 , 4.07102932834 , 10.7651747519 , 1.81898918617 , 4.65267675925 , 6.19047595255 , 9.03167793854 , 6.76516119096 , 9.09661653142 , 5.77479201038 , 5.02901085492 , 7.21128650775 , 9.02549607313 , 4.47327569073 , 6.31552038723 , 3.84705878877 , 4.93029548398 , 7.19598955666 , 2.89317645075 , 2.24624292048 , 19.8300025219 , 16.3631961495 , 5.65725732509 , 7.03276276214 , 7.74351929772 ]
time2 = [ 15.0 , 15.1 , 15.2 , 15.3 , 15.4 , 15.5 , 15.6 , 15.7 , 15.8 , 15.9 , 16.0 , 16.1 , 16.2 , 16.3 , 16.4 , 16.5 , 16.6 , 16.7 , 16.8 , 16.9 , 17.0 , 17.1 , 17.2 , 17.3 , 17.4 , 17.5 , 17.6 , 17.7 , 17.8 , 17.9 , 18.0 , 18.1, 18.2 , 18.3 , 18.4 , 18.5 , 18.6 , 18.7 , 18.8 , 18.9 , 19.0 , 19.1 , 19.2 , 19.3 , 19.4 , 19.5 , 19.6 , 19.7 , 19.8 , 19.9 , 20.0 , 20.1 , 20.2 , 20.3 , 20.4 , 20.5 , 20.6 , 20.7 , 20.8 , 20.9, 21.0 , 21.1 , 21.2 , 21.3 , 21.4 , 21.5 , 21.6 , 21.7 , 21.8 , 21.9 , 22.0 , 22.1 , 22.2 , 22.3 , 22.4 , 22.5 , 22.6 , 22.7 , 22.8 , 22.9 , 23.0 , 23.1 , 23.2 , 23.3 , 23.4 , 23.5 , 23.6 , 23.7 , 23.8, 23.9 , 24.0]
traf1 = [ 3.96618645819 , 4.04497622846 , 3.39075473611 , 4.7234606614 , 4.164909464 , 3.74929904373 , 3.90519374081 , 4.01099285863 , 4.64369992486 , 4.57965918692 , 2.82826888741 , 5.0604905316 , 3.99257536387 , 7.18455151752 , 2.36224254873 , 4.16547682492 , 3.34751996066 , 3.58983560969 , 2.43789160656 , 2.54892943846 , 2.54892943846 , 4.86102740209 , 4.39002674918 , 3.4733625116 , 1.65661314039 , 4.30196947144 , 1.85158868053 , 3.45453815456 , 8.26514748182 , 3.39325035825 , 3.05344100669 , 4.92566172441 , 3.90778176245 , 2.98940013899 , 7.03302763038 , 4.51793391538 , 5.11233797865 , 3.58112845539 , 5.31103060742 , 5.36028896036 , 4.68315982201 , 4.68057920356 , 10.2563604348 , 7.45090549345 , 3.48067021098 , 4.95830331286 , 6.78096463283 , 5.14312042025 , 2.79491732187 , 3.85133045544 , 4.39286091368 , 4.15029338914 , 2.69199038573 , 2.6877504365 , 6.18964671317 , 3.92690164743 , 1.4216195593 , 2.32972493884 , 2.68810883884 , 3.07620211093 , 8.10307709548 , 6.24938041557 , 4.41333952399 , 5.74221501923 , 4.89501154313 , 7.2711287331 , 9.07431829147 , 4.32086457158 , 8.21095270683 , 2.74730418402 , 3.6636698868 , 4.57328849058 , 5.80687995343 , 6.95878485269 , 7.72893462061 , 7.02814142419 , 5.05219816438 , 5.44598003157 , 6.13105945609 , 4.38539146046 , 6.26051298642 , 7.82124811496 , 6.47002032166 , 10.1974933772 , 3.6415823182 , 8.26392144517 , 4.41229726097 , 3.56887666101 , 6.36807457898 , 6.53689879115 , 6.50894555372 ]
time = []
occ= []
traf = []
for time10 in range(160,241,10):
time01 = time10 / 10.0
for i in range(len(time1)):
if time1[i] == time01:
time.append(time1[i])
occ.append(occ1[i])
break
for j in range(len(time2)):
if time2[j] == time01:
traf.append(traf1[j])
print traf1[j]
break
time.append(time1[-1])
traf.append(traf1[-1])
occ.append(occ1[-1])
print 'MEAN -occ: ',np.mean(occ)
print 'MEAN - traf:', np.mean(traf)
fig = plt.figure(figsize=(8,6),dpi=80)
errorDis1 = plt.subplot(1,1,1)
ax=plt.gca()
for tick in ax.xaxis.get_major_ticks():
tick.label1.set_fontsize(xfontsize)
for tick in ax.yaxis.get_major_ticks():
tick.label1.set_fontsize(yfontsize)
errorDis1.set_xlabel('Time',size=xlabelsize)
errorDis1.set_ylabel('MSE',size=ylabelsize)
errorDis1.plot(time,occ,'pb-',label='TPO-T', linewidth=lwidth, markersize=psize,markerfacecolor='none',markeredgecolor='b',markeredgewidth=mewidth)
errorDis1.plot(time,traf,'*r--',label='TP-P', linewidth = lwidth, markersize=starsize,markerfacecolor='none',markeredgecolor='r',markeredgewidth=mewidth)
errorDis1.legend(bbox_to_anchor=(0.4, 1), prop={'size':legendsize})
plt.grid(True, linewidth = gridwidth)
#xlim(20,22)
xlim(16,24)
ylim(0,10)
plt.show()
elif graph == 20:#O versus T - TPO-T VS TPO-P
# time1 = [ 6.0 , 6.1 , 6.2 , 6.3 , 6.4 , 6.5 , 6.6 , 6.7 , 6.8 , 6.9 , 7.0 , 7.1 , 7.2 , 7.3 , 7.4 , 7.5 , 7.6 , 7.7 , 7.8 , 7.9 , 8.0 , 8.1 , 8.2 , 8.3 , 8.4 , 8.5 , 8.6 , 8.7 , 8.8 , 8.9 , 9.0 , 9.1 , 9.2 , 9.3 , 9.4 , 9.5 , 9.6 , 9.7 , 9.8 , 9.9 , 10.0 , 10.1 , 10.2 , 10.3 , 10.4 , 10.5 , 10.6 , 10.7 , 10.8 , 10.9 , 11.0 , 11.1 , 11.2 , 11.3 , 11.4 , 11.5 , 11.6 , 11.7 , 11.8 , 11.9 , 12.0 , 12.1 , 12.2 , 12.3 , 12.4 , 12.5 , 12.6 , 12.7 , 12.8 , 12.9 , 13.0 , 13.1 , 13.2 , 13.3 , 13.4 , 13.5 , 13.6 , 13.7 , 13.8 , 13.9 , 14.0 , 14.1 , 14.2 , 14.3 , 14.4 , 14.5 , 14.6 , 14.7 , 14.8 , 14.9 , 15.0 , 15.1 , 15.2 , 15.3 , 15.4 , 15.5 , 15.6 , 15.7 , 15.8 , 15.9 , 16.0 , 16.1 , 16.2 , 16.3 , 16.4 , 16.5 , 16.6 , 16.7 , 16.8 , 16.9 , 17.0 , 17.1 , 17.2 , 17.3 , 17.4 , 17.5 , 17.6 , 17.7 , 17.8 , 17.9 , 18.0 , 18.1 , 18.2 , 18.3 , 18.4 , 18.5 , 18.6 , 18.7 , 18.8 , 18.9 , 19.0 , 19.1 , 19.2 , 19.3 , 19.4 , 19.5 , 19.6 , 19.7 , 19.8 , 19.9 , 20.0 , 20.1 , 20.2 , 20.3 , 20.4 , 20.5 , 20.6 , 20.7 , 20.8 , 20.9 , 21.0 , 21.1 , 21.2 , 21.3 , 21.4 , 21.5 , 21.6 , 21.7 , 21.8 , 21.9 , 22.0 ]
# oftt1 = [ 2.24145459457 , 1.73143800808 , 0.799179426583 , 2.01173649785 , 1.81718487406 , 1.15549025585 , 2.81841446511 , 1.31058908497 , 1.10303421876 , 0.645413892646 , 2.58626674665 , 3.61801909886 , 0.952661481413 , 1.33722863725 , 2.33427913521 , 3.25891430085 , 1.58177500317 , 3.16742183238 , 3.40244886268 , 2.74782217877 , 2.02421508291 , 3.43543221065 , 2.75801727099 , 3.47512377666 , 3.21835103328 , 3.55187074828 , 2.58031331124 , 2.29762085226 , 4.06586361021 , 1.99885747247 , 3.50018608759 , 2.89382577221 , 2.87643825366 , 3.82574308484 , 2.88754786537 , 3.4611622107 , 2.38718055664 , 3.64932069411 , 3.87850569272 , 4.4113182732 , 2.60367705107 , 4.38603456884 , 3.76237502142 , 4.70449294799 , 4.48489780315 , 4.00217675235 , 3.69113872225 , 2.84381752466 , 2.64490642981 , 3.26550030106 , 3.11284322531 , 3.5278606601 , 2.73389921687 , 3.22909639958 , 9.68749273327 , 3.33794329991 , 1.82267761822 , 3.84960343354 , 3.34947114286 , 1.97525234047 , 4.80490149444 , 8.14703674908 , 2.85123026634 , 4.55860899603 , 3.8336676661 , 6.30110432527 , 5.03219707113 , 16.0849484556 , 2.45380197659 , 1.51388666902 , 1.93585020619 , 1.3686990979 , 1.79589742566 , 1.87033918163 , 2.1347025076 , 2.2107307156 , 2.00306285687 , 1.42081441613 , 2.25800807735 , 2.64485987569 , 1.57499868863 , 1.46970759794 , 2.14947144609 , 1.71494163207 , 1.42890994211 , 1.42921051412 , 2.56822992844 , 2.57491186436 , 2.24887120575 , 2.45006028512 , 2.29030145929 , 2.20357005345 , 2.37107043373 , 1.79574736231 , 2.16022404774 , 1.98744860352 , 2.76517152188 , 4.46927922498 , 2.28449240154 , 3.50934876462 , 3.43002757824 , 3.57237690717 , 3.74711858238 , 5.269319282 , 1.91724186837 , 2.37274846701 , 2.74429162252 , 4.33152677022 , 5.19693037903 , 4.14178144568 , 1.3717559139 , 5.10188377373 , 15.3319173641 , 2.72503824835 , 4.43168328127 , 2.77228298597 , 4.00000047582 , 2.78321470794 , 4.4266595246 , 12.3738675504 , 2.2362768749 , 3.53624063741 , 2.17194051215 , 1.80232955064 , 3.11447942993 , 5.58415288653 , 14.1053921526 , 8.57341416642 , 3.15187293847 , 2.76141329912 , 4.07248264248 , 1.99320484803 , 2.91473616599 , 2.20586857277 , 2.94563619851 , 5.42395269199 , 29.078302079 , 14.0218517407 , 20.5513224061 , 8.07341836515 , 6.53713071169 , 3.6100915748 , 2.98813230058 , 2.04783764553 , 2.60001717019 , 1.67795651189 , 2.92481559366 , 1.78590828584 , 0.883847519117 , 2.09792479628 , 2.77275673653 , 6.82743125648 , 2.05469069428 , 4.18963363872 , 5.88560779047 , 3.49943148138 , 2.40634975286 , 3.75794501409 , 3.99229239053 , 1.58456767841 , 3.45776889589 ]
# ftt1 = [ 3.31262327416 , 1.84214332676 , 1.11111111111 , 2.03014464168 , 1.93767258383 , 1.65447074293 , 9.03852728468 , 1.27301117686 , 1.26666666667 , 9.82712031558 , 10.434122288 , 10.373339908 , 9.46630506246 , 4.1728139382 , 5.41262327416 , 4.27879684418 , 6.29760026298 , 9.66288625904 , 11.6660420776 , 11.8333333333 , 10.6944444444 , 10.0307034845 , 3.57557527942 , 11.5675871137 , 10.4951347798 , 12.6495069034 , 8.61134122288 , 7.35282708744 , 15.2697238659 , 11.763477975 , 11.9313938199 , 5.16702827087 , 9.16988823143 , 13.1682117028 , 6.59408284024 , 11.0944444444 , 10.6555555556 , 9.95519395135 , 9.09247205786 , 6.50575279421 , 8.11604207758 , 7.55410913872 , 11.0204470743 , 9.8771860618 , 11.4343523997 , 12.8762656147 , 7.9865877712 , 9.08829717291 , 8.25016436555 , 5.91666666667 , 3.31130834977 , 9.45788954635 , 9.45358316897 , 11.9777120316 , 10.9437869822 , 12.5656147272 , 10.2722222222 , 12.8760026298 , 8.95239973702 , 10.3648915187 , 5.87370151216 , 4.64280078895 , 11.4609138725 , 12.0109467456 , 3.86985535832 , 2.52258382643 , 12.7899408284 , 12.5566732413 , 10.8793228139 , 8.65 , 3.78099934254 , 10.8026298488 , 7.08011176857 , 13.9724194609 , 8.85548980934 , 10.6792899408 , 1.92024983563 , 8.36048652202 , 10.8907626561 , 12.25539119 , 10.9333333333 , 8.59119000657 , 3.31245890861 , 6.69470742932 , 5.44224194609 , 8.9033530572 , 12.6318211703 , 8.3892504931 , 12.5443786982 , 11.1166666667 , 12.7669296515 , 5.2476660092 , 10.1997698882 , 7.16147271532 , 14.1570348455 , 12.6276134122 , 6.18612754767 , 8.52889546351 , 6.97771203156 , 5.6845496384 , 9.83563445102 , 4.45420775805 , 7.94322813938 , 11.9659763314 , 5.65262984878 , 11.1993754109 , 5.48007889546 , 3.85 , 7.94165023011 , 5.82501643655 , 13.3653188692 , 12.3447074293 , 8.30325443787 , 9.31564760026 , 1.98583168968 , 5.0335634451 , 3.27419460881 , 5.45749506903 , 9.69375410914 , 10.5053583169 , 5.52222222222 , 8.88484549638 , 4.34707429323 , 7.59566074951 , 11.1198224852 , 3.9771860618 , 14.2973701512 , 5.28652202498 , 9.70667324129 , 9.508382643 , 12.7611111111 , 8.00660749507 , 11.3608809993 , 15.2407955293 , 4.07712031558 , 11.8497370151 , 13.1331032216 , 11.6076265615 , 9.47376725838 , 5.78333333333 , 5.68783694938 , 5.93011176857 , 6.64806048652 , 5.23185404339 , 16.66617357 , 9.43609467456 , 2.10019723866 , 2.68957922419 , 4.42330703485 , 9.30023011177 , 10.2113412229 , 7.99375410914 , 8.58267587114 , 10.5413872452 , 5.42728468113 , 6.30785667324 , 8.36650230112 , 7.07001972387 , 8.60621301775 , 4.16111111111 , 5.93625904011 ]
time1 = [ 15.0 , 15.1 , 15.2 , 15.3 , 15.4 , 15.5 , 15.6 , 15.7 , 15.8 , 15.9 , 16.0 , 16.1 , 16.2 , 16.3 , 16.4 , 16.5 , 16.6 , 16.7 , 16.8 , 16.9 , 17.0 , 17.1 , 17.2 , 17.3 , 17.4 , 17.5 , 17.6 , 17.7 , 17.8 , 17.9 , 18.0 , 18.1 , 18.2 , 18.3 , 18.4 , 18.5 , 18.6 , 18.7 , 18.8 , 18.9 , 19.0 , 19.1 , 19.2 , 19.3 , 19.4 , 19.5 , 19.6 , 19.7 , 19.8 , 19.9 , 20.0 , 20.1 , 20.2 , 20.3 , 20.4 , 20.5 , 20.6 , 20.7 , 20.8 , 20.9 , 21.0 , 21.1 , 21.2 , 21.3 , 21.4 , 21.5 , 21.6 , 21.7 , 21.8 , 21.9 , 22.0 , 22.1 , 22.2 , 22.3 , 22.4 , 22.5 , 22.6 , 22.7 , 22.8 , 22.9 , 23.0 , 23.1 , 23.2 , 23.3 , 23.4 , 23.5 , 23.6 , 23.7 , 23.8 , 23.9 , 24.0 ]
#oftt1 = [ 3.34016987043 , 2.11315860427 , 3.18601772454 , 2.27078098197 , 1.9420457237 , 1.78898985201 , 3.73454058499 , 1.68480930255 , 3.0386681039 , 2.85571865734 , 3.67601949705 , 3.79573983327 , 2.14938619725 , 3.30385990796 , 2.52350280827 , 2.78920221392 , 2.33322730245 , 1.98399477751 , 1.60538259827 , 1.6598521442 , 1.32650828772 , 1.77548607706 , 1.99973719458 , 2.6260890102 , 0.836643695985 , 3.07519345155 , 1.07249957761 , 2.00305118752 , 2.5596876696 , 3.60327651365 , 1.7923848476 , 2.93387600578 , 2.10630249637 , 2.62657712208 , 4.46121606175 , 3.67395466752 , 6.08488199517 , 2.82596124205 , 3.91241243228 , 2.41879102395 , 5.58772604829 , 5.46544361042 , 2.28721049498 , 2.77276299549 , 3.76564829102 , 2.98083742388 , 2.27925861381 , 4.62218104164 , 2.28501948578 , 3.05490472895 , 3.46676593792 , 3.92566641941 , 2.17956934145 , 1.37175933222 , 6.96433390259 , 2.01892635736 , 1.26722331867 , 2.8570576534 , 1.13259061279 , 1.95600833705 , 3.03595447335 , 2.68137884379 , 2.422802909 , 1.68415431027 , 6.4498319049 , 3.96220874586 , 4.69988034974 , 4.07102932834 , 10.7651747519 , 1.81898918617 , 4.65267675925 , 6.19047595255 , 9.03167793854 , 6.76516119096 , 9.09661653142 , 5.77479201038 , 5.02901085492 , 7.21128650775 , 9.02549607313 , 4.47327569073 , 6.31552038723 , 3.84705878877 , 4.93029548398 , 7.19598955666 , 2.89317645075 , 2.24624292048 , 19.8300025219 , 16.3631961495 , 5.65725732509 , 7.03276276214 , 7.74351929772 ]
ofpt1 = [ 3.33126992611 , 2.15235043881 , 4.21215375236 , 2.04146402499 , 2.26508236112 , 1.75842743987 , 3.83752010319 , 1.79356812562 , 2.71647871756 , 2.98920028076 , 3.06963761795 , 3.78037524154 , 2.11330949347 , 3.62306600989 , 2.10132375418 , 2.79890211351 , 2.45220911956 , 2.0962944359 , 1.71888897623 , 2.00237892092 , 2.00237892092 , 1.75017286044 , 1.87819485903 , 2.77200592938 , 0.927552735382 , 2.16110258543 , 0.952612535679 , 1.55876494568 , 2.43936505277 , 2.74032154014 , 2.20187230613 , 2.62732676781, 1.81709347884 , 2.68646819361 , 4.87840695719 , 3.58804992604 , 1.96027598281 , 2.16400733578 , 4.55698744552 , 2.61612107743 , 4.1007299461 , 2.60197595024 , 2.42772928849 , 3.70504358394 , 2.64089183244 , 2.53083484208 , 2.69596558723 , 3.82189848477 , 2.10858933652 , 2.69381421149 , 4.48942308279 , 3.48776778082 , 1.75831208948 , 1.48030854681 , 3.2901866737 , 2.33799936521 , 1.50491990853 , 1.23953538087 , 1.19008302381 , 2.36576100342, 2.57888534853 , 2.052794471 , 2.64644323686 , 1.35534774334 , 5.6573022579 , 4.76819909982 , 1.85043233584 , 3.46190356262 , 5.28356384041 , 1.84882416982 , 3.01211103176 , 4.59728665448 , 8.01181670627 , 6.44190774176 , 7.57429158629 , 5.66900034971 , 4.30244931982 , 6.23339404063 , 6.88638460847 , 4.63713969717 , 5.75838213042 , 3.38303474858 , 4.29114582128 , 2.74825804228 , 2.33363923855 , 2.26640425042 , 4.06245325649 , 3.02492973852 , 4.13263598916, 4.06968874886 , 3.87911988994]
time2 = [16.0 , 16.1 , 16.2 , 16.3 , 16.4 , 16.5 , 16.6 , 16.7 , 16.8 , 16.9 , 17.0 , 17.1 , 17.2 , 17.3 , 17.4 , 17.5 , 17.6 , 17.7 , 17.8 , 17.9 , 18.0, 18.1 , 18.2 , 18.3 , 18.4 , 18.5 , 18.6 , 18.7 , 18.8 , 18.9 , 19.0 , 19.1 , 19.2 , 19.3 , 19.4 , 19.5 , 19.6 , 19.7 , 19.8 , 19.9 , 20.0, 20.1 , 20.2 , 20.3 , 20.4 , 20.5 , 20.6 , 20.7 , 20.8 , 20.9 , 21.0 , 21.1 , 21.2 , 21.3 , 21.4 , 21.5 , 21.6 , 21.7 , 21.8 , 21.9 , 22.0, 22.1 , 22.2 , 22.3 , 22.4 , 22.5 , 22.6 , 22.7 , 22.8 , 22.9 , 23.0 , 23.1 , 23.2 , 23.3 , 23.4 , 23.5 , 23.6 , 23.7 , 23.8 , 23.9 , 24.0]
oftt1 = [4.69668769016 , 5.22815511796 , 4.75651864455 , 7.27951179414 , 1.83936252642 , 2.92045248929 , 3.27799965301 , 5.89231086353 , 7.41883633633 , 5.29257760195 , 1.29865347968 , 7.08251471428 , 16.9714386887 , 3.68136567864 , 4.6412439188 , 3.88903306758 , 3.54682791884 , 3.73403607414 , 6.9666255785 , 20.3582630944 , 3.19957891476, 3.80543310502 , 1.93401424702 , 3.17057766458 , 3.96305911318 , 6.51887629373 , 20.4186073407 , 11.4147131854 , 3.85847773442 , 3.11570712986 , 3.50262623757 , 2.22010631502 , 2.31444421917 , 2.59850885854 , 2.68293911389 , 6.75030937958 , 43.7200549223 , 21.8209065471 , 29.7734428877 , 10.3799544067 , 7.0800434828, 4.84267494922 , 2.87969582577 , 1.73273692692 , 3.36322225073 , 1.95472294708 , 2.32214555282 , 1.50623440831 , 1.09532940564 , 1.76316748388 , 2.68600217437 , 8.51850047806 , 3.06249792008 , 3.8621030668 , 10.2604727585 , 5.18644468396 , 1.89713897743 , 3.90466259625 , 5.35529750254 , 1.55552123283 , 2.9387445849, 3.87210768706 , 6.7209386312 , 7.24779869356 , 6.87608364896 , 5.11448242313 , 4.95290896891 , 6.55150709768 , 5.4000674614 , 4.36536378271 , 4.45552987643 , 3.45963586477 , 4.39443102979 , 3.25922301023 , 1.95031262487 , 2.22012292429 , 4.23730662071 , 8.2025886652 , 10.6547490425 , 3.34325981498 , 3.56071448287 ]
time = []
oftt= []
ftt = []
ofpt = []
for time10 in range(160,241,10):
time01 = time10 / 10.0
for i in range(len(time1)):
if time1[i] == time01:
time.append(time1[i])
ofpt.append(ofpt1[i])
break
for j in range(len(time2)):
if time2[j] == time01:
oftt.append(oftt1[j])
print oftt1[j]
break
print 'MEAN - oftt: ',np.mean(oftt)
print 'MEAN - ofpt: ', np.mean(ofpt)
fig = plt.figure(1)
errorDis1 = plt.subplot(1,1,1)
ax=plt.gca()
for tick in ax.xaxis.get_major_ticks():
tick.label1.set_fontsize(xfontsize)
for tick in ax.yaxis.get_major_ticks():
tick.label1.set_fontsize(yfontsize)
xlim(16,24)
ylim(0, 10)
errorDis1.set_xlabel('Time',size=xlabelsize)
errorDis1.set_ylabel('MSE',size=ylabelsize)
errorDis1.plot(time,oftt,'pb-',label='TPO-T', linewidth=lwidth, markersize=psize,markerfacecolor='none',markeredgecolor='b',markeredgewidth=mewidth)
errorDis1.plot(time,ofpt,'or--',label='TPO-P', linewidth = lwidth, markersize=osize,markerfacecolor='none',markeredgecolor='r',markeredgewidth=mewidth)
errorDis1.legend(bbox_to_anchor=(0.4, 1), prop={'size':legendsize})
plt.grid(True, linewidth = gridwidth)
plt.show()
elif graph == 21:#TPO-T training length
leng = [1, 2, 4, 6, 8, 10, 12]
mse = [11.3630137637, 8.30783926981, 6.1372113718, 5.69388283632, 4.53503860232, 3.56379580345, 3.34194715277]
fig = plt.figure(1)
errorDis1 = plt.subplot(1,1,1)
ax=plt.gca()
for tick in ax.xaxis.get_major_ticks():
tick.label1.set_fontsize(xfontsize)
for tick in ax.yaxis.get_major_ticks():
tick.label1.set_fontsize(yfontsize)
ax.set_xticks(np.linspace(1,12,12))
ax.set_xticklabels( ('1', '2', '3', '4', '5', '6', '7', '8','9','10','11','12'))
errorDis1.set_xlabel('Training Length (week)',size=xlabelsize)
errorDis1.set_ylabel('Mean MSE',size=ylabelsize)
errorDis1.plot(leng,mse,'pb-',label='TPO-T', linewidth = lwidth, markersize=psize,markerfacecolor='none',markeredgecolor='b',markeredgewidth=mewidth)
ylim(1,15)
xlim(1, 12)
errorDis1.legend(bbox_to_anchor=(0.5, 1), loc=0, borderaxespad=0.,prop={'size':legendsize})
plt.grid(True, linewidth = gridwidth)
elif graph == 22:#performance of different zones
per = [1,5,10,20,30,60,120]
mse = [15.3433176586, 10.3045890768, 9.66024002956, 8.93674166049, 6.60237428115, 4.88553217152, 5.03451190563]
fig = plt.figure(1)
errorDis1 = plt.subplot(1,1,1)
ax=plt.gca()
for tick in ax.xaxis.get_major_ticks():
tick.label1.set_fontsize(xfontsize-5)
for tick in ax.yaxis.get_major_ticks():
tick.label1.set_fontsize(yfontsize-5)
majorLocator = MultipleLocator(10)
majorFormatter = FormatStrFormatter('%d')
minorLocator = MultipleLocator(5)
ax.xaxis.set_major_locator(majorLocator)
ax.xaxis.set_major_formatter(majorFormatter)
# for the minor ticks, use no labels; default NullFormatter
ax.xaxis.set_minor_locator(minorLocator)
errorDis1.set_xlabel('Number of Training Zones',size=xlabelsize)
errorDis1.set_ylabel('Mean MSE',size=ylabelsize)
errorDis1.plot(per,mse,'*r-',label='TPO-T', linewidth = lwidth, markersize=starsize,markerfacecolor='none',markeredgecolor='r',markeredgewidth=mewidth)
ylim(0,20)
xlim(0,120)
errorDis1.legend(bbox_to_anchor=(0.5, 1), loc=0, borderaxespad=0.,prop={'size':legendsize})
plt.grid(True, linewidth = gridwidth)
elif graph == 23: #cdf of TPO-P and TP-P
#TPO-P v.s. TP-P: the percentile of all test days as a function of MSE.
import numpy as np
from sklearn.metrics import mean_squared_error
import matplotlib.pyplot as plt
import statsmodels.api as sm # recommended import according to the docs
pic = plt.subplot(1,1,1)
plt.rcParams['xtick.labelsize'] = xfontsize
plt.rcParams['ytick.labelsize'] = yfontsize
#plt.rcParams['axes.labelsize'] = xlabelsize #label is set below
time = 21
if time == 16.0:
Real = [58.0, 59.0, 67.0, 59.0, 58.0, 56.0, 58.0, 60.0, 57.0, 63.0, 60.0, 59.0, 60.0, 56.0, 58.0, 62.0, 66.0, 58.0, 59.0, 61.0, 57.0, 60.0, 56.0, 62.0, 59.0, 62.0, 57.0, 62.0, 57.0, 58.0]
traflwr = [58.6109092467781, 59.050695650762634, 64.00413230201886, 57.902966650678863, 60.19655260893694, 57.463925700868806, 59.050975841849045, 59.050585666425299, 58.667950803699803, 66.040904141199164, 57.350234759976644, 59.050467761293305, 59.872036985561536, 57.463463368263582, 59.432766715940346, 59.992725070311501, 66.70279919414584, 58.285889317765616, 59.756016898223095, 59.107508506517277, 59.050840905634246, 58.668286532485396, 57.788039112440018, 65.38677071898087, 58.610727580298665, 60.196636361088984, 56.968608886515923, 59.98625175354973, 58.112541296752063, 59.988382536151555]
elif time == 17.0:
Real = [59.0, 58.0, 67.0, 59.0, 59.0, 60.0, 56.0, 59.0, 56.0, 68.0, 59.0, 59.0, 59.0, 59.0, 60.0, 56.0, 67.0, 59.0, 60.0, 59.0, 59.0, 62.0, 56.0, 67.0, 58.0, 58.0, 59.0, 57.0, 58.0, 56.0]
traflwr = [57.00448927188409, 60.076068033248177, 65.229508652821991, 59.102093311927568, 58.947406572774099, 57.178362690652982, 58.46157802538665, 61.201192631123362, 59.276218318372436, 64.119741791659052, 59.744172153908039, 58.13139195479534, 59.745312018925716, 57.178476157887765, 59.913966695996557, 60.54031318107571, 65.559249422289071, 57.004584926098687, 59.587479029834157, 60.870959492073013, 56.363721577004178, 60.228777235570213, 56.693233333701286, 64.942504567754142, 59.102254913406298, 60.541925649016733, 57.820258977118364, 62.486284487635629, 57.819813111332948, 57.00483713939569]
elif time == 18.0:
Real = [58.0, 56.0, 64.0, 60.0, 59.0, 59.0, 58.0, 59.0, 60.0, 64.0, 58.0, 62.0, 58.0, 59.0, 59.0, 61.0, 62.0, 60.0, 56.0, 57.0, 59.0, 57.0, 59.0, 66.0, 59.0, 56.0, 59.0, 59.0, 56.0, 58.0]
traflwr = [59.076751782795007, 58.773590296953373, 63.046163642548272, 59.231102588615478, 58.614077114865161, 58.763073759986881, 57.396575065996089, 58.768215134917298, 57.090483996737838, 63.502622917275886, 58.614074873126192, 58.768215134917298, 58.768031159138474, 58.460301825405971, 59.224816324581703, 56.938005068065237, 63.045561138077232, 58.768013735450381, 59.070426206029964, 58.922384132567622, 58.76822484887024, 59.829151591099915, 57.552570126873725, 63.676141410442625, 58.311540246964547, 58.157335692564629, 58.613912197044918, 57.854841751585923, 58.157801781915467, 56.93720228451491]
elif time == 19.0:
Real = [59.0, 61.0, 67.0, 58.0, 59.0, 60.0, 59.0, 60.0, 56.0, 69.0, 56.0, 60.0, 62.0, 59.0, 60.0, 59.0, 66.0, 62.0, 62.0, 58.0, 62.0, 59.0, 58.0, 69.0, 62.0, 59.0, 60.0, 56.0, 58.0, 60.0]
traflwr = [58.344934243257541, 59.272907138228305, 65.811375986303304, 59.742264968267726, 60.668799601948095, 59.275134042727984, 58.808421956763169, 59.739848339396403, 59.278219477321414, 65.345845598353023, 58.808982292853528, 59.284701068115858, 58.345118601322888, 59.275832292071087, 59.739715263681923, 58.818593529508178, 63.475172445202254, 59.741106957417088, 57.875596832948517, 58.342339240373462, 59.275471681633313, 59.736918135601172, 60.204177530078162, 66.73208743619783, 58.811519393848144, 57.875850093314263, 59.275160313625001, 60.669114664659645, 58.340430336616457, 58.345279741433053]
elif time == 20.5:
Real = [58.0, 59.0, 67.0, 60.0, 59.0, 59.0, 59.0, 59.0, 59.0, 66.0, 58.0, 57.0, 59.0, 59.0, 58.0, 61.0, 67.0, 58.0, 57.0, 62.0, 62.0, 62.0, 59.0, 68.0, 59.0, 59.0, 58.0, 59.0, 59.0, 60.0]
traflwr = [56.842804354796073, 59.147202979031952, 66.706229416640568, 58.562111778093112, 60.037402006730886, 59.76263962172532, 59.424076488839177, 60.279953047073491, 60.03892597560413, 63.51338309904984, 59.145313206652155, 58.807291896629508, 58.870944830801157, 59.420912412188365, 59.115392926290696, 58.838329581046551, 63.86243647987861, 60.005764246936735, 60.83461923884375, 59.976534877205218, 57.394739712077772, 58.562626393240308, 58.838167723513074, 64.098629440548237, 59.421606576689925, 58.867966760691026, 60.008236865650737, 61.176108849972366, 57.394806878248723, 60.622772148640898]
elif time == 21.0:
Real = [67.0, 65.0, 67.0, 62.0, 62.0, 63.0, 63.0, 64.0, 67.0, 68.0, 63.0, 63.0, 67.0, 62.0, 63.0, 70.0, 67.0, 63.0, 67.0, 63.0, 63.0, 61.0, 71.0, 67.0, 63.0, 62.0, 63.0, 63.0, 64.0, 73.0]
traflwr = [65.870340134926678, 65.026037581466525, 65.948163465176449, 64.977649955657313, 64.927417951671018, 64.915616170947317, 65.447637754705013, 64.333302903930075, 65.680165521385589, 66.485451570592986, 64.806251643916497, 65.806899354258178, 64.915071443375581, 64.321983138880299, 64.804202801354833, 64.742391697873373, 66.308671988115009, 65.211223200974445, 65.618519021631059, 64.928303283400282, 64.572308099480011, 64.976886250467516, 64.790454859220858, 66.485023164067101, 65.744999704699083, 64.977493285649018, 64.557153815581614, 65.399055603007099, 64.792170194005678, 64.976643269850229]
elif time == 20.0:
Real = [62.0, 56.0, 63.0, 59.0, 62.0, 58.0, 59.0, 60.0, 59.0, 64.0, 60.0, 61.0, 58.0, 56.0, 60.0, 59.0, 65.0, 59.0, 58.0, 62.0, 60.0, 59.0, 56.0, 64.0, 60.0, 59.0, 56.0, 62.0, 56.0, 59.0]
traflwr = [58.898108852462904, 59.715162972333424, 64.191838953617733, 58.997079449805057, 59.236393300599445, 58.798746308931158, 59.576262501351465, 58.799643963917276, 58.180483997660303, 62.97377997733394, 58.518400385545384, 59.137718456352793, 59.614598948078019, 59.575530699780479, 59.815114244294676, 59.236150336764872, 62.93981183835772, 59.953701668968016, 59.277524397341779, 59.338322595623751, 59.954210054355954, 58.559281669060155, 59.336890042238373, 63.989981643877506, 59.953872691945982, 58.219137592367574, 59.814210407941744, 57.839695414114423, 60.015824429702377, 59.476049390977593]
elif time == 22.0:
Real = [66.0, 69.0, 66.0, 65.0, 66.0, 70.0, 66.0, 63.0, 65.0, 68.0, 66.0, 68.0, 64.0, 65.0, 66.0, 66.0, 69.0, 65.0, 66.0, 66.0, 64.0, 70.0, 69.0, 70.0, 65.0, 66.0, 66.0, 65.0, 66.0, 69.0]
traflwr = [67.204897095112045, 66.56733143572616, 68.472780477204154, 65.700441657828122, 65.339746178495204, 65.568336524732445, 66.289034123771202, 65.97771154388505, 67.747436505325538, 69.064077637630476, 65.568693625711731, 65.568336524732445, 67.204689833325261, 64.979207025422227, 65.388083146611649, 67.888920825194404, 67.928947356760602, 65.568251582293087, 67.024367213958712, 65.568642916573623, 65.568149202996793, 64.749488870390891, 69.382944037587379, 68.836204464662373, 65.388026641973511, 64.979070141623311, 65.568234053212009, 65.929157233213999, 65.977640378328886, 70.200033594911105]
elif time == 21.5:
Real = [62.0, 69.0, 73.0, 65.0, 65.0, 64.0, 65.0, 70.0, 70.0, 65.0, 65.0, 62.0, 65.0, 65.0, 66.0, 70.0, 68.0, 69.0, 66.0, 66.0, 62.0, 67.0, 69.0, 73.0, 66.0, 65.0, 66.0, 67.0, 66.0, 70.0]
traflwr = [65.792920708610879, 65.7697668201358, 67.651944259582322, 65.939338809978821, 65.769440585449402, 65.834064110948944, 65.704450888345292, 65.963064688601605, 65.575390162021364, 67.728397312732184, 65.600416372145915, 65.430605604321556, 65.833877647094894, 65.769678722410504, 65.405057622423229, 66.04379282460998, 67.904294173280491, 65.599511844769538, 65.432038784157726, 66.28119078419445, 66.084832331923323, 66.472749689767966, 65.770246110494483, 67.639583504364722, 65.704793856243299, 65.769608309209502, 65.599905513726668, 65.96285088588742, 65.639327163858923, 65.939529345553467]
print mean_squared_error(Real, traflwr)
mse = []
for i in range(100):
mse.append(0)
MSE = []
cnt = 0
for i in range(len(Real)):
temp = int(np.ceil((traflwr[i] - Real[i])*(traflwr[i] - Real[i])))
print temp
mse[temp] += 1
cnt += 1
MSE.append(temp)
print mse
ecdf = sm.distributions.ECDF(MSE)
x = np.linspace(min(MSE), max(MSE))
y = ecdf(x)
#print x
#print y
X = []
Y = []
X.append(0.1)
Y.append(0)
for xx in x:
X.append(xx)
for yy in y:
Y.append(yy)
X.append(x[-1])
Y.append(y[-1])
#print X
#print Y
#ylim(min(Y),max(Y)+0.01)
xlim(min(X)-0.1,30)
plt.step(X, Y,'.r-',label='TP-P', linewidth = 3.5,markersize=20)
#plt.show()
b = 30
#leng = len(Y)
#print leng
pic.legend(bbox_to_anchor=(0.47, 1), loc=0, borderaxespad=0.,prop={'size':legendsize})
if time == 16.0:
Real = [58.0, 59.0, 58.0, 56.0, 58.0, 60.0, 60.0, 59.0, 60.0, 56.0, 58.0, 58.0, 59.0, 61.0, 57.0, 60.0, 59.0, 62.0, 57.0, 62.0, 57.0]
Occtraflwr = [58.920621425008449, 58.291577091475219, 59.32294102666107, 58.518773321619868, 58.87247933148354, 58.836231372682484, 59.179407677396966, 58.899737397766756, 58.920695547726083, 58.597767224241245, 59.04375628032745, 58.75574316360138, 59.622693078707535, 58.652352255611049, 58.909935842210096, 58.828047158709246, 59.094413053126431, 59.38699857527974, 58.998641045169713, 58.198583478889596, 59.538340558365007]
elif time == 17.0:
Real = [59.0, 59.0, 59.0, 60.0, 56.0, 59.0, 59.0, 59.0, 59.0, 59.0, 60.0, 59.0, 60.0, 59.0, 59.0, 62.0, 58.0, 58.0, 59.0, 57.0, 58.0]
Occtraflwr = [58.819110907218089, 58.754440850740252, 58.707566598243211, 58.691671314068877, 58.758768758296462, 58.693374206687253, 58.79395041937714, 58.825970794828692, 58.799346076728348, 58.705427701363377, 58.665535340936685, 58.866990631146201, 58.773317862360578, 58.799104491440758, 58.842071482687309, 58.777559913611604, 58.804107070134286, 58.889079660011667, 58.738712233540099, 58.77692611422853, 58.744114787827947]
elif time == 18.0:
Real = [58.0, 60.0, 59.0, 59.0, 58.0, 59.0, 58.0, 62.0, 58.0, 59.0, 59.0, 60.0, 56.0, 57.0, 59.0, 57.0, 59.0, 56.0, 59.0, 59.0, 56.0]
Occtraflwr = [58.447769637707772, 58.366154904081149, 58.730416828547575, 59.024014142002422, 58.22982464557392, 58.640574644085966, 58.764229639154081, 58.719729935365841, 58.670967537145501, 58.864195872538637, 58.806820474500697, 58.592547678126081, 58.938344633399268, 58.527407224811228, 58.63196901393249, 59.011548917637107, 58.606296098351109, 58.582475829969361, 58.671356274513172, 58.454252929307778, 58.627615925678036]
elif time == 19.0:
Real = [59.0, 58.0, 59.0, 60.0, 59.0, 60.0, 56.0, 60.0, 62.0, 59.0, 60.0, 62.0, 62.0, 58.0, 62.0, 59.0, 62.0, 59.0, 60.0, 56.0, 58.0]
Occtraflwr = [58.555037814836311, 58.936393832203365, 58.589226966559629, 58.155545770382076, 58.205453236714149, 58.448309518584907, 58.25920046722954, 59.497570305311072, 58.440651250943446, 58.762359530958292, 58.99015307298825, 58.438368231684436, 58.512435664946288, 58.419270420991495, 58.496861544770965, 58.177733088116561, 58.476850541288108, 58.228870517925472, 58.424488254722625, 58.387422167887898, 58.409390453609454]
elif time == 20.5:
Real = [58.0, 60.0, 59.0, 59.0, 59.0, 59.0, 58.0, 57.0, 59.0, 59.0, 58.0, 58.0, 57.0, 62.0, 62.0, 62.0, 59.0, 59.0, 58.0, 59.0, 59.0]
Occtraflwr = [58.889618169823564, 58.420855476570232, 58.215523282400596, 58.106694214154224, 58.332925595911426, 58.189297893611069, 58.365262976457707, 58.597107290226035, 58.41166517580907, 58.29045799921834, 58.522614384064603, 58.330896564285659, 58.15962756501817, 58.444565820038505, 58.670679927855645, 58.466677832171946, 58.376497338584954, 58.377036778214858, 58.373019002788361, 58.097996223511366, 58.689049616530397]
elif time == 21.0:
Real = [67.0, 62.0, 62.0, 63.0, 63.0, 64.0, 63.0, 63.0, 67.0, 62.0, 63.0, 63.0, 67.0, 63.0, 63.0, 61.0, 63.0, 62.0, 63.0, 63.0, 64.0]
Occtraflwr = [63.134976389584118, 63.405328773536496, 63.022932289179764, 63.593816507071921, 63.417241302998001, 63.257910052549406, 63.243446343930202, 63.246259625203187, 63.654006493057437, 63.946756160407944, 63.318866368035124, 63.423860203386802, 63.809153147762842, 63.225209091880565, 63.267845375124267, 63.511181376241602, 63.368189494434674, 63.432380588569039, 63.942082646980836, 63.046744689149229, 63.786257085620562]
elif time == 20.0:
Real = [62.0, 59.0, 62.0, 58.0, 59.0, 60.0, 60.0, 61.0, 58.0, 56.0, 60.0, 59.0, 58.0, 62.0, 60.0, 59.0, 60.0, 59.0, 56.0, 62.0, 56.0]
Occtraflwr = [59.294513999253304, 58.931649923731186, 59.530798058866878, 58.648758165487834, 59.570298718257916, 59.063033574754179, 58.900275122566747, 59.602183385946823, 59.46573645982707, 59.658626071221853, 59.793530881061216, 60.245556545510354, 59.492015063326981, 59.044903637092091, 59.796526927502718, 58.613187952693359, 59.627741116562298, 58.473638844341963, 59.954545371782764, 58.117813390860881, 60.082419453326885]
elif time == 22.0:
Real = [66.0, 65.0, 66.0, 70.0, 66.0, 63.0, 66.0, 68.0, 64.0, 65.0, 66.0, 65.0, 66.0, 66.0, 64.0, 70.0, 65.0, 66.0, 66.0, 65.0, 66.0]
Occtraflwr = [66.068646487838649, 65.231697872899204, 65.579095187064297, 65.907918320189907, 64.980206231479869, 65.976068175288148, 65.913910513310185, 65.968362816357427, 66.385849920371854, 66.023987873361406, 66.097527474567997, 65.828888852474435, 66.489018871206639, 66.066683243151715, 65.895392456622233, 65.676364698229733, 66.154104847306158, 66.381244066382976, 65.869619618572713, 65.882249675567593, 66.041606632709986]
elif time == 21.5:
Real = [62.0, 65.0, 65.0, 64.0, 65.0, 70.0, 65.0, 62.0, 65.0, 65.0, 66.0, 69.0, 66.0, 66.0, 62.0, 67.0, 66.0, 65.0, 66.0, 67.0, 66.0]
Occtraflwr = [64.637061879563277, 64.827712685964158, 64.660673757850205, 64.389170908673634, 64.974209990210497, 64.4106996949006, 65.178985804820726, 65.325190866464311, 64.697744387975817, 64.717490058644714, 65.61990544475114, 64.988643707129029, 65.231116605223121, 64.169343671591207, 64.76600264534575, 63.428361153439241, 65.052724273938793, 64.829028984969554, 65.105322650179431, 64.222671695835018, 65.40427324002367]
print mean_squared_error(Real, Occtraflwr)
mse = []
for i in range(20):
mse.append(0)
MSE = []
cnt = 0
for i in range(len(Real)):
temp = int(np.ceil((Occtraflwr[i] - Real[i])*(Occtraflwr[i] - Real[i])))
mse[temp] += 1
cnt += 1
MSE.append(temp)
#print mse
ecdf = sm.distributions.ECDF(MSE)
x = np.linspace(min(MSE), max(MSE))
y = ecdf(x)
#print x
#print y
X = []
Y = []
X.append(0.1)
Y.append(0)
for xx in x:
X.append(xx)
for yy in y:
Y.append(yy)
X.append(x[-1])
Y.append(y[-1])
#print X
#print len(Y)
ylim(min(Y),max(Y)+0.01)
#xlim(min(X)-0.1,max(X))
ax=plt.gca()
ax.set_xticks(np.linspace(0,30,11))
ax.set_xticklabels( ('0', '3', '6', '9', '12', '15', '18', '21','24','27','30'))
ax.set_yticks(np.linspace(0,1,9))
ax.set_yticklabels( ('0.00', '0.125', '0.25', '0.375', '0.50','0.625','0.75','0.875','1.0'))
pic.set_xlabel('Squared Error',size=xlabelsize)
pic.set_ylabel('Percentile',size=ylabelsize)
plt.step(X, Y, 'k-',label='TPO-P', linewidth=3.5)
pic.legend(bbox_to_anchor=(0.95, 0.5), loc=0, borderaxespad=0.,prop={'size':legendsize})
a = np.linspace(max(X),b)
c=[]
for aa in range(len(a)):
c.append(1)
a = np.linspace(max(X),b)
c=[]
for aa in range(len(a)):
c.append(1)
pic.plot(a,c,'k-',linewidth=3.5)
plt.grid(True, linewidth = gridwidth)
plt.show()
elif graph == 31:#weight of occupancy/traffic - different prediction time
#Weight of Occupancy v.s. Traffic, 20:00-22:00.
time = [0.2, 0.4, 0.6, 0.8, 1, 1.2]
occ = [1.33620255151, 4.95949772586, 1.26187717795, 0.990177728744, 1.2777695719, 0.0484706064585]
traf = [1,1,1,1,1,1]
#traf = [0.0108831159948, 0.0108958069672, 0.0629231822061, 0.0615828235894, 0.0629231822061, 0.0143713279428]
#0.0145420473606 0.0540377298752 0.0794013275901 0.0609779403914 0.0804013275901 0.00206971826242 0.0389080100848 0.0191253722211
#0.0108831159948 0.0108958069672 0.0629231822061 0.0615828235894 0.0629231822061 0.0427004820786 0.0287928551123 0.0143713279428
print 'MEAN - occ/traf: ',np.mean(occ)
#print 'MEAN - traf:', np.mean(traf)
fig = plt.figure(1)
errorDis1 = plt.subplot(1,1,1)
ax=plt.gca()
for tick in ax.xaxis.get_major_ticks():
tick.label1.set_fontsize(xfontsize)
for tick in ax.yaxis.get_major_ticks():
tick.label1.set_fontsize(yfontsize)
ax.set_yticks(np.linspace(0,5,6))
ax.set_yticklabels( ('0', '1', '2', '3', '4', '5'))
ax.set_xticks(np.linspace(0,1.2,7))
ax.set_xticklabels( ('0', '0.2', '0.4', '0.6', '0.8', '1', '1.2'))
errorDis1.set_xlabel('Prediction Length (hour)',size=xlabelsize)
errorDis1.set_ylabel('The Ratio of Weight',size=ylabelsize)
errorDis1.plot(time,occ,'pb-',label='Occupancy/Traffic', linewidth=lwidth, markersize=psize,markerfacecolor='none',markeredgecolor='b',markeredgewidth=mewidth)
errorDis1.plot(time,traf,'r--', linewidth=lwidth, markersize=40,markerfacecolor='r',markeredgecolor='r')
errorDis1.legend(bbox_to_anchor=(1, 1), prop={'size':legendsize})
plt.show()
ylim(-0.5,5.2)
xlim(0.179,1.22)
elif graph == 32:#TPO-T vs TP-P 200-220
#TPO-T v.s. TP-P: MSE as a function of time, 20:00-22:00.
time1 =[ 15.0 , 15.1 , 15.2 , 15.3 , 15.4 , 15.5 , 15.6 , 15.7 , 15.8 , 15.9 , 16.0 , 16.1 , 16.2 , 16.3 , 16.4 , 16.5 , 16.6 , 16.7 , 16.8 , 16.9 , 17.0 , 17.1 , 17.2 , 17.3 , 17.4 , 17.5 , 17.6 , 17.7 , 17.8 , 17.9 , 18.0 , 18.1, 18.2 , 18.3 , 18.4 , 18.5 , 18.6 , 18.7 , 18.8 , 18.9 , 19.0 , 19.1 , 19.2 , 19.3 , 19.4 , 19.5 , 19.6 , 19.7 , 19.8 , 19.9 , 20.0 , 20.1 , 20.2 , 20.3 , 20.4 , 20.5 , 20.6 , 20.7 , 20.8 , 20.9, 21.0 , 21.1 , 21.2 , 21.3 , 21.4 , 21.5 , 21.6 , 21.7 , 21.8 , 21.9 , 22.0 , 22.1 , 22.2 , 22.3 , 22.4 , 22.5 , 22.6 , 22.7 , 22.8 , 22.9 , 23.0 , 23.1 , 23.2 , 23.3 , 23.4 , 23.5 , 23.6 , 23.7 , 23.8, 23.9 , 24.0]
traf1 = [ 3.96618645819 , 4.04497622846 , 3.39075473611 , 4.7234606614 , 4.164909464 , 3.74929904373 , 3.90519374081 , 4.01099285863 , 4.64369992486 , 4.57965918692 , 2.82826888741 , 5.0604905316 , 3.99257536387 , 7.18455151752 , 2.36224254873 , 4.16547682492 , 3.34751996066 , 3.58983560969 , 2.43789160656 , 2.54892943846 , 2.54892943846 , 4.86102740209 , 4.39002674918 , 3.4733625116 , 1.65661314039 , 4.30196947144 , 1.85158868053 , 3.45453815456 , 8.26514748182 , 3.39325035825 , 3.05344100669 , 4.92566172441 , 3.90778176245 , 2.98940013899 , 7.03302763038 , 4.51793391538 , 5.11233797865 , 3.58112845539 , 5.31103060742 , 5.36028896036 , 4.68315982201 , 4.68057920356 , 10.2563604348 , 7.45090549345 , 3.48067021098 , 4.95830331286 , 6.78096463283 , 5.14312042025 , 2.79491732187 , 3.85133045544 , 4.39286091368 , 4.15029338914 , 2.69199038573 , 2.6877504365 , 6.18964671317 , 3.92690164743 , 1.4216195593 , 2.32972493884 , 2.68810883884 , 3.07620211093 , 8.10307709548 , 6.24938041557 , 4.41333952399 , 5.74221501923 , 4.89501154313 , 7.2711287331 , 9.07431829147 , 4.32086457158 , 8.21095270683 , 2.74730418402 , 3.6636698868 , 4.57328849058 , 5.80687995343 , 6.95878485269 , 7.72893462061 , 7.02814142419 , 5.05219816438 , 5.44598003157 , 6.13105945609 , 4.38539146046 , 6.26051298642 , 7.82124811496 , 6.47002032166 , 10.1974933772 , 3.6415823182 , 8.26392144517 , 4.41229726097 , 3.56887666101 , 6.36807457898 , 6.53689879115 , 6.50894555372 ]
occ1 = [ 3.34016987043 , 2.11315860427 , 3.18601772454 , 2.27078098197 , 1.9420457237 , 1.78898985201 , 3.73454058499 , 1.68480930255 , 3.0386681039 , 2.85571865734 , 3.67601949705 , 3.79573983327 , 2.14938619725 , 3.30385990796 , 2.52350280827 , 2.78920221392 , 2.33322730245 , 1.98399477751 , 1.60538259827 , 1.6598521442 , 1.32650828772 , 1.77548607706 , 1.99973719458 , 2.6260890102 , 0.836643695985 , 3.07519345155 , 1.07249957761 , 2.00305118752 , 2.5596876696 , 3.60327651365 , 1.7923848476 , 2.93387600578 , 2.10630249637 , 2.62657712208 , 4.46121606175 , 3.67395466752 , 6.08488199517 , 2.82596124205 , 3.91241243228 , 2.41879102395 , 5.58772604829 , 5.46544361042 , 2.28721049498 , 2.77276299549 , 3.76564829102 , 2.98083742388 , 2.27925861381 , 4.62218104164 , 2.28501948578 , 3.05490472895 , 3.46676593792 , 3.92566641941 , 2.17956934145 , 1.37175933222 , 6.96433390259 , 2.01892635736 , 1.26722331867 , 2.8570576534 , 1.13259061279 , 1.95600833705 , 3.03595447335 , 2.68137884379 , 2.422802909 , 1.68415431027 , 6.4498319049 , 3.96220874586 , 4.69988034974 , 4.07102932834 , 8.7651747519 , 1.81898918617 , 4.65267675925 , 6.19047595255 , 9.03167793854 , 6.76516119096 , 9.09661653142 , 5.77479201038 , 5.02901085492 , 7.21128650775 , 9.02549607313 , 4.47327569073 , 6.31552038723 , 3.84705878877 , 4.93029548398 , 7.19598955666 , 2.89317645075 , 2.24624292048 , 19.8300025219 , 16.3631961495 , 5.65725732509 , 7.03276276214 , 7.74351929772 ]
time = []
traf= []
occ = []
for time10 in range(160,240,1):
time01 = time10 / 10.0
for i in range(len(time1)):
if time1[i] == time01:
if occ1[i] > 10:
print occ1[i]
time.append(time1[i])
traf.append(traf1[i])
occ.append(occ1[i])
break
time.append(time1[-1])
traf.append(traf1[-1])
occ.append(occ1[-1])
print 'MEAN -occ: ',np.mean(occ)
print 'MEAN - traf:', np.mean(traf)
# cntT = 0
# cntO = 0
# for i in range(len(traf)):
# if traf[i] < occ[i]:
# cntT += 1
# else:
# cntO += 1
# print "T win: ", cntT
# print "O win: ", cntO
xlim(20,22)
#xlim(16,24)
ylim(0,10)
fig = plt.figure(1)
errorDis1 = plt.subplot(1,1,1)
ax=plt.gca()
for tick in ax.xaxis.get_major_ticks():
tick.label1.set_fontsize(xfontsize)
for tick in ax.yaxis.get_major_ticks():
tick.label1.set_fontsize(yfontsize)
errorDis1.set_xlabel('Time',size=xlabelsize)
errorDis1.set_ylabel('MSE',size=ylabelsize)
errorDis1.plot(time,occ,'pb-',label='TPO-T', linewidth=lwidth, markersize=psize,markerfacecolor='none',markeredgecolor='b',markeredgewidth=mewidth)
errorDis1.plot(time,traf,'*r--',label='TP-P', linewidth = lwidth, markersize=starsize,markerfacecolor='none',markeredgecolor='r',markeredgewidth=mewidth)
errorDis1.legend(bbox_to_anchor=(0.30, 1.03), prop={'size':legendsize})
plt.grid(True, linewidth = gridwidth)
plt.show()
elif graph == 33.1:#Lin Cheung - TPO-T VS TP-T
#TPO-T v.s. TP-T: MSE as a function of time (a) 16:00-24:00
time1 = [ 16.0 , 16.1 , 16.2 , 16.3 , 16.4 , 16.5 , 16.6 , 16.7 , 16.8 , 16.9 , 17.0 , 17.1 , 17.2 , 17.3 , 17.4 , 17.5 , 17.6 , 17.7 , 17.8 , 17.9 , 18.0 , 18.1 , 18.2 , 18.3 , 18.4 , 18.5 , 18.6 , 18.7 , 18.8 , 18.9 , 19.0 , 19.1 , 19.2 , 19.3 , 19.4 , 19.5 , 19.6 , 19.7 , 19.8 , 19.9 , 20.0 , 20.1 , 20.2 , 20.3 , 20.4 , 20.5 , 20.6 , 20.7 , 20.8 , 20.9 , 21.0 , 21.1 , 21.2 , 21.3 , 21.4 , 21.5 , 21.6 , 21.7 , 21.8 , 21.9 , 22.0 , 22.1 , 22.2 , 22.3 , 22.4 , 22.5 , 22.6 , 22.7 , 22.8 , 22.9 , 23.0 , 23.1 , 23.2 , 23.3 , 23.4 , 23.5 , 23.6 , 23.7 , 23.8 , 23.9 , 24.0 ]
occ1 = [ 5.49903483304 , 4.08265701586 , 10.025271142 , 17.6552033394 , 13.2237366115 , 5.47613895792 , 0.999758928022 , 1.58711989743 , 2.0055282384 , 2.1762483477 , 1.73805082226 , 0.925511037505 , 0.282112288671 , 0.995161099272 , 2.40809123039 , 0.705628833421 , 17.0599761833 , 10.1265743368 , 1.23352766927 , 1.66678462689 , 4.12599619707 , 4.20207804778 , 5.08359786969 , 3.37620211195 , 5.44981027191 , 2.60980002033 , 0.605548177339 , 1.62003962564 , 3.65787863662 , 5.44122935535 , 1.24536231033 , 4.97688619599 , 2.29404395639 , 16.5215749878 , 16.477812214 , 1.19479874357 , 1.94751724097 , 1.51747847861 , 1.51337594337 , 1.44757955587 , 9.07519900694 , 19.3205133236 , 20.694716424 , 0.449683376685 , 1.26411640809 , 2.10787602288 , 0.669587301723 , 0.634732322848 , 0.723407961919 , 1.89994612636 , 1.8721431028 , 0.825934537096 , 1.87151292795 , 3.19554801719 , 1.21571822811 , 0.635516491212 , 0.871681752366 , 0.347386594626 , 0.472373830237 , 0.532537463031 , 5.65389737685 , 1.34112885695 , 0.922471754123 , 2.94232225242 , 0.774735359774 , 0.645233042387 , 0.902233503422 , 2.06389199982 , 0.941009226952 , 4.7263331494 , 7.78727529189 , 28.4892345328 , 22.8343622882 , 0.454738553954 , 0.51763448394 , 0.629275560727 , 0.337179453659 , 0.394342062886 , 0.483797390261 , 0.481537033558 , 1.19820899855 ]
traf1 = [ 5.57239074764 , 3.94463027271 , 9.82187627072 , 17.6637747418 , 12.8078583137 , 4.98896303131 , 1.26044276869 , 0.761849528199 , 1.47718154615 , 1.99213178602 , 0.355741634508 , 0.442311675517 , 0.201809214452 , 0.365020546082 , 1.86369509938 , 1.21801716357 , 17.3881640899 , 10.0320657159 , 1.19726139889 , 0.571420452441 , 4.18142674465 , 4.31058266454 , 4.78018596297 , 3.28576012223 , 5.85050167165 , 2.70739575173 , 0.421337122472 , 0.496463139899 , 3.28355012424 , 5.34929069964 , 1.23804118318 , 5.1420406618 , 2.29927835034 , 16.6873265139 , 16.435394319 , 0.376377976438 , 2.72118541206 , 1.47441761914 , 1.34107164574 , 1.61090260254 , 8.87085478669 , 17.7458935979 , 27.6341018413 , 2.14146348178 , 1.13110076716 , 4.08295899489 , 0.65407135873 , 3.97976284942 , 3.14643530165 , 1.98292621383 , 4.61209657007 , 0.748269981314 , 1.58598371097 , 0.77671194209 , 0.285708092695 , 0.437693416825 , 0.925092915916 , 0.31978273665 , 0.403664081267 , 0.532834639837 , 0.4830288381 , 0.918549790777 , 0.761965852527 , 0.754987466884 , 0.439885758927 , 0.675604906839 , 0.835107677073 , 1.18418686689 , 0.84401725515 , 4.88466318727 , 7.63040683748 , 29.0859820268 , 22.6893571698 , 0.442177546547 , 0.523817661237 , 0.650807723773 , 0.340159154395 , 0.304019809615 , 0.426296869885 , 0.42629119812 , 0.426278103343 ]
ha1 = [ 5.89444444444 , 3.18777777778 , 7.46333333333 , 12.2277777778 , 10.2844444444 , 5.73333333333 , 2.99111111111 , 2.57888888889 , 1.78666666667 , 2.32666666667 , 1.96 , 3.97 , 2.43666666667 , 1.53333333333 , 1.89 , 3.62222222222 , 12.4722222222 , 8.70666666667 , 1.69333333333 , 1.95555555556 , 5.05 , 6.12 , 4.72222222222 , 3.77 , 4.95777777778 , 2.05555555556 , 0.568888888889 , 1.67777777778 , 3.78333333333 , 5.91666666667 , 4.59666666667 , 4.94666666667 , 3.41333333333 , 12.1044444444 , 13.5255555556 , 1.02444444444 , 2.25555555556 , 2.05888888889 , 2.31555555556 , 4.59666666667 , 11.9833333333 , 19.9788888889 , 25.1888888889 , 10.6177777778 , 19.3833333333 , 15.0088888889 , 15.6722222222 , 13.2555555556 , 16.0633333333 , 17.7844444444 , 20.9 , 14.3088888889 , 18.3566666667 , 10.78 , 4.71666666667 , 0.507777777778 , 0.907777777778 , 0.5 , 0.393333333333 , 0.724444444444 , 0.57 , 0.822222222222 , 0.903333333333 , 0.822222222222 , 0.57 , 0.726666666667 , 0.713333333333 , 0.762222222222 , 0.866666666667 , 3.43666666667 , 6.21888888889 , 20.6988888889 , 16.4911111111 , 0.646666666667 , 0.506666666667 , 0.613333333333 , 0.374444444444 , 0.343333333333 , 0.432222222222 , 0.432222222222 , 0.432222222222 ]
time = []
traf= []
occ = []
ha = []
for time10 in range(160,240,10):
time01 = time10 / 10.0
for i in range(len(time1)):
if time1[i] == time01:
if time1[i] == 21:
print (traf1[i]-occ1[i])/traf1[i]
time.append(time1[i])
traf.append(traf1[i])
occ.append(occ1[i])
ha.append(ha1[i])
break
time.append(time1[-1])
traf.append(traf1[-1])
occ.append(occ1[-1])
ha.append(ha[-1])
print 'MEAN - occ p: ',np.mean(occ)
print 'MEAN - occ t:', np.mean(traf)
print 'MEAN - traf t:', np.mean(ha)
#xlim(20, 22)
ylim(0,23)
fig = plt.figure(1)
errorDis1 = plt.subplot(1,1,1)
ax=plt.gca()
for tick in ax.xaxis.get_major_ticks():
tick.label1.set_fontsize(40)
for tick in ax.yaxis.get_major_ticks():
tick.label1.set_fontsize(40)
errorDis1.set_xlabel('Time',size=50)
errorDis1.set_ylabel('MSE',size=50)
errorDis1.plot(time,ha,'^r--',label='TP-T', linewidth=lwidth, markersize=trisize,markerfacecolor='none',markeredgecolor='r',markeredgewidth=mewidth)
#errorDis1.plot(time,occ,'*r--',label='TPO-P', linewidth=2.5, markersize=40,markerfacecolor='r',markeredgecolor='r')
errorDis1.plot(time,traf,'pb-',label='TPO-T', linewidth = lwidth, markersize=psize,markerfacecolor='none',markeredgecolor='b',markeredgewidth=mewidth)
errorDis1.legend(bbox_to_anchor=(1, 1), prop={'size':legendsize})
plt.grid(True, linewidth = gridwidth)
plt.show()
elif graph == 33.2:#Lin Cheung - TPO-T VS TP-T
#TPO-T v.s. TP-T: MSE as a function of time (b) 20:00-22:00
time1 = [ 16.0 , 16.1 , 16.2 , 16.3 , 16.4 , 16.5 , 16.6 , 16.7 , 16.8 , 16.9 , 17.0 , 17.1 , 17.2 , 17.3 , 17.4 , 17.5 , 17.6 , 17.7 , 17.8 , 17.9 , 18.0 , 18.1 , 18.2 , 18.3 , 18.4 , 18.5 , 18.6 , 18.7 , 18.8 , 18.9 , 19.0 , 19.1 , 19.2 , 19.3 , 19.4 , 19.5 , 19.6 , 19.7 , 19.8 , 19.9 , 20.0 , 20.1 , 20.2 , 20.3 , 20.4 , 20.5 , 20.6 , 20.7 , 20.8 , 20.9 , 21.0 , 21.1 , 21.2 , 21.3 , 21.4 , 21.5 , 21.6 , 21.7 , 21.8 , 21.9 , 22.0 , 22.1 , 22.2 , 22.3 , 22.4 , 22.5 , 22.6 , 22.7 , 22.8 , 22.9 , 23.0 , 23.1 , 23.2 , 23.3 , 23.4 , 23.5 , 23.6 , 23.7 , 23.8 , 23.9 , 24.0 ]
occ1 = [ 5.49903483304 , 4.08265701586 , 10.025271142 , 17.6552033394 , 13.2237366115 , 5.47613895792 , 0.999758928022 , 1.58711989743 , 2.0055282384 , 2.1762483477 , 1.73805082226 , 0.925511037505 , 0.282112288671 , 0.995161099272 , 2.40809123039 , 0.705628833421 , 17.0599761833 , 10.1265743368 , 1.23352766927 , 1.66678462689 , 4.12599619707 , 4.20207804778 , 5.08359786969 , 3.37620211195 , 5.44981027191 , 2.60980002033 , 0.605548177339 , 1.62003962564 , 3.65787863662 , 5.44122935535 , 1.24536231033 , 4.97688619599 , 2.29404395639 , 16.5215749878 , 16.477812214 , 1.19479874357 , 1.94751724097 , 1.51747847861 , 1.51337594337 , 1.44757955587 , 9.07519900694 , 19.3205133236 , 20.694716424 , 0.449683376685 , 1.26411640809 , 2.10787602288 , 0.669587301723 , 0.634732322848 , 0.723407961919 , 1.89994612636 , 1.8721431028 , 0.825934537096 , 1.87151292795 , 3.19554801719 , 1.21571822811 , 0.635516491212 , 0.871681752366 , 0.347386594626 , 0.472373830237 , 0.532537463031 , 5.65389737685 , 1.34112885695 , 0.922471754123 , 2.94232225242 , 0.774735359774 , 0.645233042387 , 0.902233503422 , 2.06389199982 , 0.941009226952 , 4.7263331494 , 7.78727529189 , 28.4892345328 , 22.8343622882 , 0.454738553954 , 0.51763448394 , 0.629275560727 , 0.337179453659 , 0.394342062886 , 0.483797390261 , 0.481537033558 , 1.19820899855 ]
traf1 = [ 5.57239074764 , 3.94463027271 , 9.82187627072 , 17.6637747418 , 12.8078583137 , 4.98896303131 , 1.26044276869 , 0.761849528199 , 1.47718154615 , 1.99213178602 , 0.355741634508 , 0.442311675517 , 0.201809214452 , 0.365020546082 , 1.86369509938 , 1.21801716357 , 17.3881640899 , 10.0320657159 , 1.19726139889 , 0.571420452441 , 4.18142674465 , 4.31058266454 , 4.78018596297 , 3.28576012223 , 5.85050167165 , 2.70739575173 , 0.421337122472 , 0.496463139899 , 3.28355012424 , 5.34929069964 , 1.23804118318 , 5.1420406618 , 2.29927835034 , 16.6873265139 , 16.435394319 , 0.376377976438 , 2.72118541206 , 1.47441761914 , 1.34107164574 , 1.61090260254 , 8.87085478669 , 17.7458935979 , 27.6341018413 , 2.14146348178 , 1.13110076716 , 4.08295899489 , 0.65407135873 , 3.97976284942 , 3.14643530165 , 1.98292621383 , 4.61209657007 , 0.748269981314 , 1.58598371097 , 0.77671194209 , 0.285708092695 , 0.437693416825 , 0.925092915916 , 0.31978273665 , 0.403664081267 , 0.532834639837 , 0.4830288381 , 0.918549790777 , 0.761965852527 , 0.754987466884 , 0.439885758927 , 0.675604906839 , 0.835107677073 , 1.18418686689 , 0.84401725515 , 4.88466318727 , 7.63040683748 , 29.0859820268 , 22.6893571698 , 0.442177546547 , 0.523817661237 , 0.650807723773 , 0.340159154395 , 0.304019809615 , 0.426296869885 , 0.42629119812 , 0.426278103343 ]
ha1 = [ 5.89444444444 , 3.18777777778 , 7.46333333333 , 12.2277777778 , 10.2844444444 , 5.73333333333 , 2.99111111111 , 2.57888888889 , 1.78666666667 , 2.32666666667 , 1.96 , 3.97 , 2.43666666667 , 1.53333333333 , 1.89 , 3.62222222222 , 12.4722222222 , 8.70666666667 , 1.69333333333 , 1.95555555556 , 5.05 , 6.12 , 4.72222222222 , 3.77 , 4.95777777778 , 2.05555555556 , 0.568888888889 , 1.67777777778 , 3.78333333333 , 5.91666666667 , 4.59666666667 , 4.94666666667 , 3.41333333333 , 12.1044444444 , 13.5255555556 , 1.02444444444 , 2.25555555556 , 2.05888888889 , 2.31555555556 , 4.59666666667 , 11.9833333333 , 19.9788888889 , 25.1888888889 , 10.6177777778 , 19.3833333333 , 15.0088888889 , 15.6722222222 , 13.2555555556 , 16.0633333333 , 17.7844444444 , 20.9 , 14.3088888889 , 18.3566666667 , 10.78 , 4.71666666667 , 0.507777777778 , 0.907777777778 , 0.5 , 0.393333333333 , 0.724444444444 , 0.57 , 0.822222222222 , 0.903333333333 , 0.822222222222 , 0.57 , 0.726666666667 , 0.713333333333 , 0.762222222222 , 0.866666666667 , 3.43666666667 , 6.21888888889 , 20.6988888889 , 16.4911111111 , 0.646666666667 , 0.506666666667 , 0.613333333333 , 0.374444444444 , 0.343333333333 , 0.432222222222 , 0.432222222222 , 0.432222222222 ]
time = []
traf= []
occ = []
ha = []
for time10 in range(160,240,1):
time01 = time10 / 10.0
for i in range(len(time1)):
if time1[i] == time01:
if time1[i] == 21:
print (traf1[i]-occ1[i])/traf1[i]
time.append(time1[i])
traf.append(traf1[i])
occ.append(occ1[i])
ha.append(ha1[i])
break
time.append(time1[-1])
traf.append(traf1[-1])
occ.append(occ1[-1])
ha.append(ha[-1])
print 'MEAN - occ p: ',np.mean(occ)
print 'MEAN - occ t:', np.mean(traf)
print 'MEAN - traf t:', np.mean(ha)
xlim(20, 22)
ylim(0,30)
fig = plt.figure(1)
errorDis1 = plt.subplot(1,1,1)
ax=plt.gca()
for tick in ax.xaxis.get_major_ticks():
tick.label1.set_fontsize(xfontsize)
for tick in ax.yaxis.get_major_ticks():
tick.label1.set_fontsize(yfontsize)
errorDis1.set_xlabel('Time',size=xlabelsize)
errorDis1.set_ylabel('MSE',size=ylabelsize)
errorDis1.plot(time,ha,'^r--',label='TP-T', linewidth=lwidth, markersize=trisize,markerfacecolor='none',markeredgecolor='r',markeredgewidth=mewidth)
#errorDis1.plot(time,occ,'*r--',label='TPO-P', linewidth=2.5, markersize=40,markerfacecolor='r',markeredgecolor='r')
errorDis1.plot(time,traf,'pb-',label='TPO-T', linewidth = lwidth, markersize=psize,markerfacecolor='none',markeredgecolor='b',markeredgewidth=mewidth)
errorDis1.legend(bbox_to_anchor=(1, 1), prop={'size':legendsize})
plt.grid(True, linewidth = lwidth)
plt.show()
elif graph == 34:#Lin Cheung - TPO-T VS TPO-P
#TPO-T v.s. TPO-P: MSE as a function of time.
time1 = [ 16.0 , 16.1 , 16.2 , 16.3 , 16.4 , 16.5 , 16.6 , 16.7 , 16.8 , 16.9 , 17.0 , 17.1 , 17.2 , 17.3 , 17.4 , 17.5 , 17.6 , 17.7 , 17.8 , 17.9 , 18.0 , 18.1 , 18.2 , 18.3 , 18.4 , 18.5 , 18.6 , 18.7 , 18.8 , 18.9 , 19.0 , 19.1 , 19.2 , 19.3 , 19.4 , 19.5 , 19.6 , 19.7 , 19.8 , 19.9 , 20.0 , 20.1 , 20.2 , 20.3 , 20.4 , 20.5 , 20.6 , 20.7 , 20.8 , 20.9 , 21.0 , 21.1 , 21.2 , 21.3 , 21.4 , 21.5 , 21.6 , 21.7 , 21.8 , 21.9 , 22.0 , 22.1 , 22.2 , 22.3 , 22.4 , 22.5 , 22.6 , 22.7 , 22.8 , 22.9 , 23.0 , 23.1 , 23.2 , 23.3 , 23.4 , 23.5 , 23.6 , 23.7 , 23.8 , 23.9 , 24.0 ]
occ1 = [ 5.49903483304 , 4.08265701586 , 10.025271142 , 17.6552033394 , 13.2237366115 , 5.47613895792 , 0.999758928022 , 1.58711989743 , 2.0055282384 , 2.1762483477 , 1.73805082226 , 0.925511037505 , 0.282112288671 , 0.995161099272 , 2.40809123039 , 0.705628833421 , 17.0599761833 , 10.1265743368 , 1.23352766927 , 1.66678462689 , 4.12599619707 , 4.20207804778 , 5.08359786969 , 3.37620211195 , 5.44981027191 , 2.60980002033 , 0.605548177339 , 1.62003962564 , 3.65787863662 , 5.44122935535 , 1.24536231033 , 4.97688619599 , 2.29404395639 , 16.5215749878 , 16.477812214 , 1.19479874357 , 1.94751724097 , 1.51747847861 , 1.51337594337 , 1.44757955587 , 9.07519900694 , 19.3205133236 , 20.694716424 , 0.449683376685 , 1.26411640809 , 2.10787602288 , 0.669587301723 , 0.634732322848 , 0.723407961919 , 1.89994612636 , 1.8721431028 , 0.825934537096 , 1.87151292795 , 3.19554801719 , 1.21571822811 , 0.635516491212 , 0.871681752366 , 0.347386594626 , 0.472373830237 , 0.532537463031 , 5.65389737685 , 1.34112885695 , 0.922471754123 , 2.94232225242 , 0.774735359774 , 0.645233042387 , 0.902233503422 , 2.06389199982 , 0.941009226952 , 4.7263331494 , 7.78727529189 , 28.4892345328 , 22.8343622882 , 0.454738553954 , 0.51763448394 , 0.629275560727 , 0.337179453659 , 0.394342062886 , 0.483797390261 , 0.481537033558 , 1.19820899855 ]
traf1 = [ 5.57239074764 , 3.94463027271 , 9.82187627072 , 17.6637747418 , 12.8078583137 , 4.98896303131 , 1.26044276869 , 0.761849528199 , 1.47718154615 , 1.99213178602 , 0.355741634508 , 0.442311675517 , 0.201809214452 , 0.365020546082 , 1.86369509938 , 1.21801716357 , 17.3881640899 , 10.0320657159 , 1.19726139889 , 0.571420452441 , 4.18142674465 , 4.31058266454 , 4.78018596297 , 3.28576012223 , 5.85050167165 , 2.70739575173 , 0.421337122472 , 0.496463139899 , 3.28355012424 , 5.34929069964 , 1.23804118318 , 5.1420406618 , 2.29927835034 , 16.6873265139 , 16.435394319 , 0.376377976438 , 2.72118541206 , 1.47441761914 , 1.34107164574 , 1.61090260254 , 8.87085478669 , 17.7458935979 , 27.6341018413 , 2.14146348178 , 1.13110076716 , 4.08295899489 , 0.65407135873 , 3.97976284942 , 3.14643530165 , 1.98292621383 , 4.61209657007 , 0.748269981314 , 1.58598371097 , 0.77671194209 , 0.285708092695 , 0.437693416825 , 0.925092915916 , 0.31978273665 , 0.403664081267 , 0.532834639837 , 0.4830288381 , 0.918549790777 , 0.761965852527 , 0.754987466884 , 0.439885758927 , 0.675604906839 , 0.835107677073 , 1.18418686689 , 0.84401725515 , 4.88466318727 , 7.63040683748 , 29.0859820268 , 22.6893571698 , 0.442177546547 , 0.523817661237 , 0.650807723773 , 0.340159154395 , 0.304019809615 , 0.426296869885 , 0.42629119812 , 0.426278103343 ]
ha1 = [ 5.89444444444 , 3.18777777778 , 7.46333333333 , 12.2277777778 , 10.2844444444 , 5.73333333333 , 2.99111111111 , 2.57888888889 , 1.78666666667 , 2.32666666667 , 1.96 , 3.97 , 2.43666666667 , 1.53333333333 , 1.89 , 3.62222222222 , 12.4722222222 , 8.70666666667 , 1.69333333333 , 1.95555555556 , 5.05 , 6.12 , 4.72222222222 , 3.77 , 4.95777777778 , 2.05555555556 , 0.568888888889 , 1.67777777778 , 3.78333333333 , 5.91666666667 , 4.59666666667 , 4.94666666667 , 3.41333333333 , 12.1044444444 , 13.5255555556 , 1.02444444444 , 2.25555555556 , 2.05888888889 , 2.31555555556 , 4.59666666667 , 11.9833333333 , 19.9788888889 , 25.1888888889 , 10.6177777778 , 19.3833333333 , 15.0088888889 , 15.6722222222 , 13.2555555556 , 16.0633333333 , 17.7844444444 , 20.9 , 14.3088888889 , 18.3566666667 , 10.78 , 4.71666666667 , 0.507777777778 , 0.907777777778 , 0.5 , 0.393333333333 , 0.724444444444 , 0.57 , 0.822222222222 , 0.903333333333 , 0.822222222222 , 0.57 , 0.726666666667 , 0.713333333333 , 0.762222222222 , 0.866666666667 , 3.43666666667 , 6.21888888889 , 20.6988888889 , 16.4911111111 , 0.646666666667 , 0.506666666667 , 0.613333333333 , 0.374444444444 , 0.343333333333 , 0.432222222222 , 0.432222222222 , 0.432222222222 ]
time = []
traf= []
occ = []
ha = []
for time10 in range(160,240,10):
time01 = time10 / 10.0
for i in range(len(time1)):
if time1[i] == time01:
if time1[i] == 21:
print (traf1[i]-occ1[i])/traf1[i]
time.append(time1[i])
traf.append(traf1[i])
occ.append(occ1[i])
ha.append(ha1[i])
break
time.append(time1[-1])
traf.append(traf1[-1])
occ.append(occ1[-1])
ha.append(ha[-1])
print 'MEAN - occ p: ',np.mean(occ)
print 'MEAN - occ t:', np.mean(traf)
#print 'MEAN - traf t:', np.mean(ha)
#xlim(20, 22)
ylim(0,12)
fig = plt.figure(1)
errorDis1 = plt.subplot(1,1,1)
ax=plt.gca()
for tick in ax.xaxis.get_major_ticks():
tick.label1.set_fontsize(xfontsize)
for tick in ax.yaxis.get_major_ticks():
tick.label1.set_fontsize(yfontsize)
errorDis1.set_xlabel('Time',size=xlabelsize)
errorDis1.set_ylabel('MSE',size=ylabelsize)
#errorDis1.plot(time,ha,'.b--',label='TP-T', linewidth=2.5, markersize=60,markerfacecolor='b',markeredgecolor='b')
errorDis1.plot(time,occ,'pb--',label='TPO-P', linewidth=lwidth, markersize=psize,markerfacecolor='none',markeredgecolor='b',markeredgewidth=mewidth)
errorDis1.plot(time,traf,'or-',label='TPO-T', linewidth = lwidth, markersize=osize,markerfacecolor='none',markeredgecolor='r',markeredgewidth=mewidth)
errorDis1.legend(bbox_to_anchor=(1, 1), prop={'size':legendsize})
plt.grid(True, linewidth = gridwidth)
plt.show()
elif graph == 35:#Lin Cheung - TPO-P VS TP-P, 3 months training, 1 months testing
#TPO-P v.s. TP-P: MSE as a function of time 1624
time1 = [ 16.0 , 16.1 , 16.2 , 16.3 , 16.4 , 16.5 , 16.6 , 16.7 , 16.8 , 16.9 , 17.0 , 17.1 , 17.2 , 17.3 , 17.4 , 17.5 , 17.6 , 17.7 , 17.8 , 17.9 , 18.0 , 18.1 , 18.2 , 18.3 , 18.4 , 18.5 , 18.6 , 18.7 , 18.8 , 18.9 , 19.0 , 19.1 , 19.2 , 19.3 , 19.4 , 19.5 , 19.6 , 19.7 , 19.8 , 19.9 , 20.0 , 20.1 , 20.2 , 20.3 , 20.4 , 20.5 , 20.6 , 20.7 , 20.8 , 20.9 , 21.0 , 21.1 , 21.2 , 21.3 , 21.4 , 21.5 , 21.6 , 21.7 , 21.8 , 21.9 , 22.0 , 22.1 , 22.2 , 22.3 , 22.4 , 22.5 , 22.6 , 22.7 , 22.8 , 22.9 , 23.0 , 23.1 , 23.2 , 23.3 , 23.4 , 23.5 , 23.6 , 23.7 , 23.8 , 23.9 , 24.0 ]
occ1 = [ 5.49903483304 , 4.08265701586 , 10.025271142 , 17.6552033394 , 13.2237366115 , 5.47613895792 , 0.999758928022 , 1.58711989743 , 2.0055282384 , 2.1762483477 , 1.73805082226 , 0.925511037505 , 0.282112288671 , 0.995161099272 , 2.40809123039 , 0.705628833421 , 17.0599761833 , 10.1265743368 , 1.23352766927 , 1.66678462689 , 4.12599619707 , 4.20207804778 , 5.08359786969 , 3.37620211195 , 5.44981027191 , 2.60980002033 , 0.605548177339 , 1.62003962564 , 3.65787863662 , 5.44122935535 , 1.24536231033 , 4.97688619599 , 2.29404395639 , 16.5215749878 , 16.477812214 , 1.19479874357 , 1.94751724097 , 1.51747847861 , 1.51337594337 , 1.44757955587 , 9.07519900694 , 19.3205133236 , 20.694716424 , 0.449683376685 , 1.26411640809 , 2.10787602288 , 0.669587301723 , 0.634732322848 , 0.723407961919 , 1.89994612636 , 1.8721431028 , 0.825934537096 , 1.87151292795 , 3.19554801719 , 1.21571822811 , 0.635516491212 , 0.871681752366 , 0.347386594626 , 0.472373830237 , 0.532537463031 , 5.65389737685 , 1.34112885695 , 0.922471754123 , 2.94232225242 , 0.774735359774 , 0.645233042387 , 0.902233503422 , 2.06389199982 , 0.941009226952 , 4.7263331494 , 7.78727529189 , 28.4892345328 , 22.8343622882 , 0.454738553954 , 0.51763448394 , 0.629275560727 , 0.337179453659 , 0.394342062886 , 0.483797390261 , 0.481537033558 , 1.19820899855 ]
traf1 = [ 5.67034912902 , 3.4439361993 , 7.41826198014 , 12.2542358573 , 9.28203790162 , 5.86881015359 , 2.74121015261 , 2.43203836572 , 1.56769559353 , 2.29906347435 , 2.19519642645 , 3.76270787453 , 2.60791922839 , 1.93977440675 , 2.22490763293 , 2.1285169511 , 12.0268924432 , 8.75495020281 , 1.51164982502 , 1.7262822417 , 3.69702882167 , 5.17441326713 , 3.91906176782 , 3.24130229581 , 4.36181903615 , 2.06036518521 , 0.863133464832 , 1.88208246395 , 3.79041757886 , 6.08279658256 , 4.64154595031 , 5.09382003718 , 3.59051814473 , 11.7662128781 , 13.3825697739 , 1.04480363183 , 1.75460440286 , 1.92492904929 , 2.35518835321 , 4.39700066378 , 10.5874467744 , 19.0551710251 , 22.02362077 , 10.7710691987 , 25.3702078592 , 13.8407086908 , 11.7838011769 , 9.45152399524 , 7.67663240032 , 3.53185195857 , 6.26581398446 , 10.2999464928 , 27.4767195669 , 1.20030632239 , 1.06412381931 , 0.75215874301 , 0.797127220553 , 0.418335430494 , 0.387485269692 , 0.746547344465 , 2.30934764997 , 1.13401107389 , 1.18226625051 , 2.4639587413 , 1.03275962596 , 1.04058915034 , 1.02561195806 , 0.717555965534 , 0.752406516688 , 3.35712889926 , 6.13955660405 , 20.7402572695 , 16.4197585943 , 0.647778847426 , 0.500274852399 , 0.612234609617 , 0.396466438523 , 0.328438554444 , 0.458621687999 , 0.457650006252 , 0.781134210783 ]
time = []
traf= []
occ = []
for time10 in range(160,240,10):
time01 = time10 / 10.0
for i in range(len(time1)):
if time1[i] == time01:
if time1[i] == 21.2:
print traf1[i], occ1[i]
print (traf1[i]-occ1[i])/traf1[i]
time.append(time1[i])
traf.append(traf1[i])
occ.append(occ1[i])
break
time.append(time1[-1])
traf.append(traf1[-1])
occ.append(occ1[-1])
print 'MEAN - occ: ',np.mean(occ)
print 'MEAN - traf:', np.mean(traf)
xlim(16, 24)
ylim(0,12)
fig = plt.figure(1)
errorDis1 = plt.subplot(1,1,1)
ax=plt.gca()
for tick in ax.xaxis.get_major_ticks():
tick.label1.set_fontsize(xfontsize)
for tick in ax.yaxis.get_major_ticks():
tick.label1.set_fontsize(yfontsize)
errorDis1.set_xlabel('Time',size=xlabelsize)
errorDis1.set_ylabel('MSE',size=ylabelsize)
errorDis1.plot(time,occ,'ob-',label='TPO-P', linewidth=lwidth, markersize=osize,markerfacecolor='none',markeredgecolor='b',markeredgewidth=mewidth)
errorDis1.plot(time,traf,'*r--',label='TP-P', linewidth = lwidth, markersize=starsize,markerfacecolor='none',markeredgecolor='r',markeredgewidth=mewidth)
errorDis1.legend(bbox_to_anchor=(1, 1), prop={'size':legendsize})
plt.grid(True, linewidth = gridwidth)
plt.show()
elif graph == 35.1:#Lin Cheung - TPO-P VS TP-P, 3 months training, 1 months testing
#TPO-P v.s. TP-P: MSE as a function of time 2022
time1 = [ 16.0 , 16.1 , 16.2 , 16.3 , 16.4 , 16.5 , 16.6 , 16.7 , 16.8 , 16.9 , 17.0 , 17.1 , 17.2 , 17.3 , 17.4 , 17.5 , 17.6 , 17.7 , 17.8 , 17.9 , 18.0 , 18.1 , 18.2 , 18.3 , 18.4 , 18.5 , 18.6 , 18.7 , 18.8 , 18.9 , 19.0 , 19.1 , 19.2 , 19.3 , 19.4 , 19.5 , 19.6 , 19.7 , 19.8 , 19.9 , 20.0 , 20.1 , 20.2 , 20.3 , 20.4 , 20.5 , 20.6 , 20.7 , 20.8 , 20.9 , 21.0 , 21.1 , 21.2 , 21.3 , 21.4 , 21.5 , 21.6 , 21.7 , 21.8 , 21.9 , 22.0 , 22.1 , 22.2 , 22.3 , 22.4 , 22.5 , 22.6 , 22.7 , 22.8 , 22.9 , 23.0 , 23.1 , 23.2 , 23.3 , 23.4 , 23.5 , 23.6 , 23.7 , 23.8 , 23.9 , 24.0 ]
occ1 = [ 5.49903483304 , 4.08265701586 , 10.025271142 , 17.6552033394 , 13.2237366115 , 5.47613895792 , 0.999758928022 , 1.58711989743 , 2.0055282384 , 2.1762483477 , 1.73805082226 , 0.925511037505 , 0.282112288671 , 0.995161099272 , 2.40809123039 , 0.705628833421 , 17.0599761833 , 10.1265743368 , 1.23352766927 , 1.66678462689 , 4.12599619707 , 4.20207804778 , 5.08359786969 , 3.37620211195 , 5.44981027191 , 2.60980002033 , 0.605548177339 , 1.62003962564 , 3.65787863662 , 5.44122935535 , 1.24536231033 , 4.97688619599 , 2.29404395639 , 16.5215749878 , 16.477812214 , 1.19479874357 , 1.94751724097 , 1.51747847861 , 1.51337594337 , 1.44757955587 , 9.07519900694 , 19.3205133236 , 20.694716424 , 0.449683376685 , 1.26411640809 , 2.10787602288 , 0.669587301723 , 0.634732322848 , 0.723407961919 , 1.89994612636 , 1.8721431028 , 0.825934537096 , 1.87151292795 , 3.19554801719 , 1.21571822811 , 0.635516491212 , 0.871681752366 , 0.347386594626 , 0.472373830237 , 0.532537463031 , 5.65389737685 , 1.34112885695 , 0.922471754123 , 2.94232225242 , 0.774735359774 , 0.645233042387 , 0.902233503422 , 2.06389199982 , 0.941009226952 , 4.7263331494 , 7.78727529189 , 28.4892345328 , 22.8343622882 , 0.454738553954 , 0.51763448394 , 0.629275560727 , 0.337179453659 , 0.394342062886 , 0.483797390261 , 0.481537033558 , 1.19820899855 ]
traf1 = [ 5.67034912902 , 3.4439361993 , 7.41826198014 , 12.2542358573 , 9.28203790162 , 5.86881015359 , 2.74121015261 , 2.43203836572 , 1.56769559353 , 2.29906347435 , 2.19519642645 , 3.76270787453 , 2.60791922839 , 1.93977440675 , 2.22490763293 , 2.1285169511 , 12.0268924432 , 8.75495020281 , 1.51164982502 , 1.7262822417 , 3.69702882167 , 5.17441326713 , 3.91906176782 , 3.24130229581 , 4.36181903615 , 2.06036518521 , 0.863133464832 , 1.88208246395 , 3.79041757886 , 6.08279658256 , 4.64154595031 , 5.09382003718 , 3.59051814473 , 11.7662128781 , 13.3825697739 , 1.04480363183 , 1.75460440286 , 1.92492904929 , 2.35518835321 , 4.39700066378 , 10.5874467744 , 19.0551710251 , 22.02362077 , 10.7710691987 , 25.3702078592 , 13.8407086908 , 11.7838011769 , 9.45152399524 , 7.67663240032 , 3.53185195857 , 6.26581398446 , 10.2999464928 , 27.4767195669 , 1.20030632239 , 1.06412381931 , 0.75215874301 , 0.797127220553 , 0.418335430494 , 0.387485269692 , 0.746547344465 , 2.30934764997 , 1.13401107389 , 1.18226625051 , 2.4639587413 , 1.03275962596 , 1.04058915034 , 1.02561195806 , 0.717555965534 , 0.752406516688 , 3.35712889926 , 6.13955660405 , 20.7402572695 , 16.4197585943 , 0.647778847426 , 0.500274852399 , 0.612234609617 , 0.396466438523 , 0.328438554444 , 0.458621687999 , 0.457650006252 , 0.781134210783 ]
time = []
traf= []
occ = []
for time10 in range(200,220,1):
time01 = time10 / 10.0
for i in range(len(time1)):
if time1[i] == time01:
if time1[i] == 21.2:
print traf1[i], occ1[i]
print (traf1[i]-occ1[i])/traf1[i]
time.append(time1[i])
traf.append(traf1[i])
occ.append(occ1[i])
break
time.append(time1[-1])
traf.append(traf1[-1])
occ.append(occ1[-1])
print 'MEAN - occ: ',np.mean(occ)
print 'MEAN - traf:', np.mean(traf)
xlim(20, 22)
#ylim(0,20)
fig = plt.figure(1)
errorDis1 = plt.subplot(1,1,1)
ax=plt.gca()
for tick in ax.xaxis.get_major_ticks():
tick.label1.set_fontsize(xfontsize)
for tick in ax.yaxis.get_major_ticks():
tick.label1.set_fontsize(yfontsize)
errorDis1.set_xlabel('Time',size=xlabelsize)
errorDis1.set_ylabel('MSE',size=ylabelsize)
errorDis1.plot(time,occ,'ob-',label='TPO-P', linewidth=lwidth, markersize=osize,markerfacecolor='none',markeredgecolor='b',markeredgewidth=mewidth)
errorDis1.plot(time,traf,'*r--',label='TP-P', linewidth = lwidth, markersize=starsize,markerfacecolor='none',markeredgecolor='r',markeredgewidth=mewidth)
errorDis1.legend(bbox_to_anchor=(1, 1), prop={'size':legendsize})
plt.grid(True, linewidth = gridwidth)
plt.show()
if graph == 1:
a = 1
#if graph == 1:#TPO-PT VS TP-P in EV, 3 months training, 1 month testing
# time = [20.0, 20.1, 20.2, 20.3, 20.4, 20.5, 20.6, 20.7, 20.8, 20.9, 21.0, 21.1, 21.2, 21.3, 21.4, 21.5, 21.6, 21.7, 21.8,21.9,22.0]
# occ = [4.43856361049, 3.45269221205, 1.9894396961, 1.9407839505, 3.34191535315, 2.47722156475, 1.82952567828, 1.2440208276, 1.20274150027, 2.27107805172, 2.64679454419, 2.10666487984, 2.73142001716, 1.4004144278, 4.88139748, 4.64862957209, 1.94741566563, 3.32108394665, 5.01034076233, 1.90099875357, 3.14829617202]
# ha = [4.89016012678, 4.0033745933, 2.76519358429, 1.44947016868, 4.72180045316, 3.88661818338, 1.43312481824, 1.35107883556, 1.7456964458, 2.6674446706, 5.48747918328, 4.49054716774, 4.09614888051, 4.69560730652, 4.65258696117, 3.88204650803, 2.83935676091, 4.5961029574, 4.59945065179, 2.17088625344, 3.9071037946]
#
# print np.mean(occ)
# print np.mean(ha)
# i=0
# s = []
# for i in range(len(occ)):
# print time[i]
# if ha[i]-occ[i]:
# t = (ha[i]-occ[i])/ha[i]
# else:
# t = (ha[i]-occ[i])/occ[i]
# print t
# s.append(t)
# print 'mean t', np.mean(s)
# fig = plt.figure(1)
# errorDis1 = plt.subplot(1,1,1)
# ax=plt.gca()
# for tick in ax.xaxis.get_major_ticks():
# tick.label1.set_fontsize(40)
# for tick in ax.yaxis.get_major_ticks():
# tick.label1.set_fontsize(40)
# errorDis1.set_xlabel('time',size=50)
# errorDis1.set_ylabel('MSE',size=50)
# errorDis1.plot(time,ha,'*r--',label='TP-P', linewidth=2.5, markersize=25,markerfacecolor='r',markeredgecolor='r')
# errorDis1.plot(time,occ,'sk-',label='TPO-PT', linewidth = 2.5, markersize=20,markerfacecolor='k',markeredgecolor='k')
#
# errorDis1.legend(bbox_to_anchor=(0.37, 1), loc=0, borderaxespad=0.,prop={'size':40})
# plt.show()
#elif graph == 2:#TPO-TT VS TP-T in EV, 1 months training, 3 months testing
# time = [20.0, 20.1, 20.2, 20.3, 20.4, 20.5, 20.6, 20.7, 20.8, 20.9, 21.0, 21.1, 21.2, 21.3, 21.4, 21.5, 21.6, 21.7, 21.8,21.9,22.0]
# occ = [6.53713071169, 3.6100915748, 2.98813230058, 2.04783764553, 2.60001717019, 1.67795651189, 2.92481559366, 1.78590828584, 0.883847519117, 2.09792479628, 2.77275673653, 6.82743125648, 2.05469069428, 2.51612903226, 5.88560779047, 3.49943148138, 2.40634975286, 3.52572148133, 25.2955480928, 1.86695266159, 12.08213843]
# ha = [5.68783694938, 5.93011176857, 6.64806048652, 5.23185404339, 16.66617357, 9.43609467456, 2.10019723866, 2.68957922419, 4.42330703485, 9.30023011177, 10.2113412229, 7.99375410914, 8.58267587114, 10.5413872452, 5.42728468113, 6.30785667324, 8.48868265988, 9.88826240799, 8.60621301775, 4.16111111111, 5.93625904011]
#
# print np.mean(occ)
# print np.mean(ha)
# i=0
# s = []
# for i in range(len(occ)):
# print time[i]
# if ha[i]-occ[i]:
# t = (ha[i]-occ[i])/ha[i]
# else:
# t = (ha[i]-occ[i])/occ[i]
# print t
# s.append(t)
# print 'mean t', np.mean(s)
# fig = plt.figure(1)
# errorDis1 = plt.subplot(1,1,1)
# ax=plt.gca()
# for tick in ax.xaxis.get_major_ticks():
# tick.label1.set_fontsize(45)
# for tick in ax.yaxis.get_major_ticks():
# tick.label1.set_fontsize(45)
# errorDis1.set_xlabel('time',size=45)
# errorDis1.set_ylabel('MSE',size=45)
# errorDis1.plot(time,ha,'*r--',label='TPO-TT', linewidth=2.5, markersize=25,markerfacecolor='r',markeredgecolor='r')
# errorDis1.plot(time,occ,'sk-',label='TP-T', linewidth = 2.5, markersize=20,markerfacecolor='k',markeredgecolor='k')
# errorDis1.legend(bbox_to_anchor=(0.47, 1), loc=0, borderaxespad=0.,prop={'size':45})
# plt.show()
elif graph == 3:#different areas
area = [1,4,36,144]
corrWd = [0.63432, 0.53022, 0.42718, 0.37254]
corr = [0.60034, 0.51766, 0.4261, 0.31872]
corrWk = [0.41212, 0.38766, 0.33548, 0.251]
fig = plt.figure(1)
errorDis1 = plt.subplot(1,1,1)
ax=plt.gca()
for tick in ax.xaxis.get_major_ticks():