-
Notifications
You must be signed in to change notification settings - Fork 0
/
method_of_moments.html
807 lines (622 loc) · 20.2 KB
/
method_of_moments.html
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
<!DOCTYPE html>
<html>
<title>USING METHOD OF MOMENTS TO MODEL DATABASE METRICS </title>
<xmp theme="readable" style="display:none;">
## Introduction
This article exploits statistical technique method of moments (MOM) and generalized method of moments (GMM) to estimate database statistics from the past data. Both GMM and MOM's are parametric unsupervised form of learning. I am restricting this to Oracle Database in this example, but it can be extended to any database system.
We initially select a distribution to model our random variable. Our random variables in database statistical parameters could be any statistic that we collect say in AWR report. To start our analysis, we collected AWR reports over several months. We then scraped these data and stored our metrics in csv formats. I have presented some csv files corresponding to these statistics in my github page.
## Parameters Of Interest
Lets say we want to use the method of moments to predict the following AWR statistics for the database Load Profile in AWR statistics. This is given in this section.
%matplotlib inline
from IPython.display import Image
import pandas as pd
import random
import matplotlib.pyplot as plt
from scipy.stats.kde import gaussian_kde
from plotly import tools
import scipy.stats as scs
from scipy.stats import *
from scipy import stats
import plotly.plotly as py
from plotly.graph_objs import *
import numpy as np
pd.set_option('display.max_columns', 10)
Image(filename='images/load_profile.png')
![png](method_of_moments_files/method_of_moments_6_0.png)
Reading our historic load profile data in the dataframe.
df=pd.read_csv('data/TMP_AWR_LOAD_PROFILE_AGG.csv', sep='|',parse_dates=True)
df.head()
<div>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>site_id</th>
<th>config_id</th>
<th>run_id</th>
<th>stat_id</th>
<th>stat_name</th>
<th>stat_per_sec</th>
<th>stat_per_txn</th>
<th>stat_per_exec</th>
<th>stat_per_call</th>
<th>start_time</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>37</td>
<td>1</td>
<td>1</td>
<td>265418</td>
<td>Global Cache blocks received</td>
<td>4467.21</td>
<td>16.36</td>
<td>NaN</td>
<td>NaN</td>
<td>03-OCT-14 08.00.00.000000 AM</td>
</tr>
<tr>
<th>1</th>
<td>37</td>
<td>1</td>
<td>1</td>
<td>265427</td>
<td>Transactions</td>
<td>274.49</td>
<td>NaN</td>
<td>NaN</td>
<td>NaN</td>
<td>03-OCT-14 08.00.00.000000 AM</td>
</tr>
<tr>
<th>2</th>
<td>37</td>
<td>1</td>
<td>1</td>
<td>265410</td>
<td>Logical read (blocks)</td>
<td>291880.19</td>
<td>1064.87</td>
<td>NaN</td>
<td>NaN</td>
<td>03-OCT-14 08.00.00.000000 AM</td>
</tr>
<tr>
<th>3</th>
<td>37</td>
<td>1</td>
<td>1</td>
<td>265419</td>
<td>Global Cache blocks served</td>
<td>4467.02</td>
<td>16.34</td>
<td>NaN</td>
<td>NaN</td>
<td>03-OCT-14 08.00.00.000000 AM</td>
</tr>
<tr>
<th>4</th>
<td>37</td>
<td>1</td>
<td>1</td>
<td>265421</td>
<td>Parses (SQL)</td>
<td>1131.04</td>
<td>4.14</td>
<td>NaN</td>
<td>NaN</td>
<td>03-OCT-14 08.00.00.000000 AM</td>
</tr>
</tbody>
</table>
</div>
As we can we have the data for several statistics viz. Global Cache blocks received, Transactions, Logical read (blocks), Global Cache blocks served, etc from the AWR load profile start from date 03-OCT-14 until 02-NOV-15.
I am interested in forecasting only stat_per_sec information on this AWR Load profile, so using pivot function in pandas we get the following reconstructed dataframe.
df=df.pivot_table(index='start_time', columns='stat_name', values='stat_per_sec')
df.head()
<div>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th>stat_name</th>
<th>Background CPU(s)</th>
<th>Block changes</th>
<th>DB CPU(s)</th>
<th>DB Time(s)</th>
<th>Executes (SQL)</th>
<th>...</th>
<th>Session Logical Read IM</th>
<th>Transactions</th>
<th>User calls</th>
<th>Write IO (MB)</th>
<th>Write IO requests</th>
</tr>
<tr>
<th>start_time</th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th>01-APR-15 08.00.00.000000 AM</th>
<td>2.34</td>
<td>7171.66</td>
<td>8.34</td>
<td>21.33</td>
<td>7295.85</td>
<td>...</td>
<td>NaN</td>
<td>342.13</td>
<td>3172.36</td>
<td>7.38</td>
<td>791.23</td>
</tr>
<tr>
<th>01-APR-15 10.00.00.000000 PM</th>
<td>1.88</td>
<td>5829.02</td>
<td>5.75</td>
<td>14.98</td>
<td>4943.24</td>
<td>...</td>
<td>NaN</td>
<td>243.01</td>
<td>2288.04</td>
<td>5.59</td>
<td>603.88</td>
</tr>
<tr>
<th>01-JAN-15 08.00.00.000000 AM</th>
<td>NaN</td>
<td>1746.34</td>
<td>1.80</td>
<td>4.07</td>
<td>2277.13</td>
<td>...</td>
<td>NaN</td>
<td>139.59</td>
<td>970.47</td>
<td>1.61</td>
<td>162.10</td>
</tr>
<tr>
<th>01-JUL-15 08.00.00.000000 AM</th>
<td>2.07</td>
<td>6530.64</td>
<td>6.92</td>
<td>18.46</td>
<td>6485.98</td>
<td>...</td>
<td>NaN</td>
<td>334.05</td>
<td>3064.53</td>
<td>6.76</td>
<td>721.93</td>
</tr>
<tr>
<th>01-JUL-15 10.00.00.000000 PM</th>
<td>1.80</td>
<td>5853.14</td>
<td>5.19</td>
<td>14.20</td>
<td>4787.97</td>
<td>...</td>
<td>NaN</td>
<td>259.02</td>
<td>2370.28</td>
<td>5.70</td>
<td>606.48</td>
</tr>
</tbody>
</table>
<p>5 rows × 24 columns</p>
</div>
print (df.columns)
Index([u'Background CPU(s)', u'Block changes', u'DB CPU(s)', u'DB Time(s)',
u'Executes (SQL)', u'Global Cache blocks received',
u'Global Cache blocks served', u'Hard parses (SQL)', u'IM scan rows',
u'Logical read (blocks)', u'Logons', u'Parses (SQL)',
u'Physical read (blocks)', u'Physical write (blocks)', u'Read IO (MB)',
u'Read IO requests', u'Redo size (bytes)', u'Rollbacks',
u'SQL Work Area (MB)', u'Session Logical Read IM', u'Transactions',
u'User calls', u'Write IO (MB)', u'Write IO requests'],
dtype='object', name=u'stat_name')
## Distribution Selection
All of these database statistics are continous random variables, so we model using some continous distributions.
scipy offers several continous distributions for the purpose of modelling, viz Gamma, Normal, Anglit, Arcsine, Beta, Cauchy etc.
Once we have the estimated model, we can then use the Kolmogorov-Smirov test to evaluate your fit using scipy.stats.kstest. Lets start with the most popular gamma distribution.
Say I am interested in Background CPU(s) information, calculating the gamma distribution parameters alpha and beta.
sample_mean=df['Background CPU(s)'].mean()
sample_var=np.var(df['Background CPU(s)'], ddof=1)
(sample_mean,sample_var)
(2.157353689567431, 0.23047410162538273)
Alphas and Betas of Gamma distribution:
###############
#### Gamma ####
###############
alpha = sample_mean**2 / sample_var
beta = sample_mean / sample_var
alpha,beta
(20.19391727342622, 9.360503737092497)
## MOM Estimation
Using estimated parameters and plot the distribution on top of data
gamma_rv = scs.gamma(a=alpha, scale=1/beta)
# Get the probability for each value in the data
x_vals = np.linspace(df['Background CPU(s)'].min(), df['Background CPU(s)'].max())
gamma_p = gamma_rv.pdf(x_vals)
df.head()
<div>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th>stat_name</th>
<th>Background CPU(s)</th>
<th>Block changes</th>
<th>DB CPU(s)</th>
<th>DB Time(s)</th>
<th>Executes (SQL)</th>
<th>...</th>
<th>Session Logical Read IM</th>
<th>Transactions</th>
<th>User calls</th>
<th>Write IO (MB)</th>
<th>Write IO requests</th>
</tr>
<tr>
<th>start_time</th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th>01-APR-15 08.00.00.000000 AM</th>
<td>2.34</td>
<td>7171.66</td>
<td>8.34</td>
<td>21.33</td>
<td>7295.85</td>
<td>...</td>
<td>NaN</td>
<td>342.13</td>
<td>3172.36</td>
<td>7.38</td>
<td>791.23</td>
</tr>
<tr>
<th>01-APR-15 10.00.00.000000 PM</th>
<td>1.88</td>
<td>5829.02</td>
<td>5.75</td>
<td>14.98</td>
<td>4943.24</td>
<td>...</td>
<td>NaN</td>
<td>243.01</td>
<td>2288.04</td>
<td>5.59</td>
<td>603.88</td>
</tr>
<tr>
<th>01-JAN-15 08.00.00.000000 AM</th>
<td>NaN</td>
<td>1746.34</td>
<td>1.80</td>
<td>4.07</td>
<td>2277.13</td>
<td>...</td>
<td>NaN</td>
<td>139.59</td>
<td>970.47</td>
<td>1.61</td>
<td>162.10</td>
</tr>
<tr>
<th>01-JUL-15 08.00.00.000000 AM</th>
<td>2.07</td>
<td>6530.64</td>
<td>6.92</td>
<td>18.46</td>
<td>6485.98</td>
<td>...</td>
<td>NaN</td>
<td>334.05</td>
<td>3064.53</td>
<td>6.76</td>
<td>721.93</td>
</tr>
<tr>
<th>01-JUL-15 10.00.00.000000 PM</th>
<td>1.80</td>
<td>5853.14</td>
<td>5.19</td>
<td>14.20</td>
<td>4787.97</td>
<td>...</td>
<td>NaN</td>
<td>259.02</td>
<td>2370.28</td>
<td>5.70</td>
<td>606.48</td>
</tr>
</tbody>
</table>
<p>5 rows × 24 columns</p>
</div>
# Generate random colormap
def rand_cmap(nlabels, type='bright', first_color_black=True, last_color_black=False, verbose=True):
"""
Creates a random colormap to be used together with matplotlib. Useful for segmentation tasks
:param nlabels: Number of labels (size of colormap)
:param type: 'bright' for strong colors, 'soft' for pastel colors
:param first_color_black: Option to use first color as black, True or False
:param last_color_black: Option to use last color as black, True or False
:param verbose: Prints the number of labels and shows the colormap. True or False
:return: colormap for matplotlib
"""
from matplotlib.colors import LinearSegmentedColormap
import colorsys
import numpy as np
if type not in ('bright', 'soft'):
print ('Please choose "bright" or "soft" for type')
return
if verbose:
print('Number of labels: ' + str(nlabels))
# Generate color map for bright colors, based on hsv
if type == 'bright':
randHSVcolors = [(np.random.uniform(low=0.0, high=1),
np.random.uniform(low=0.2, high=1),
np.random.uniform(low=0.9, high=1)) for i in xrange(nlabels)]
# Convert HSV list to RGB
randRGBcolors = []
for HSVcolor in randHSVcolors:
randRGBcolors.append(colorsys.hsv_to_rgb(HSVcolor[0], HSVcolor[1], HSVcolor[2]))
if first_color_black:
randRGBcolors[0] = [0, 0, 0]
if last_color_black:
randRGBcolors[-1] = [0, 0, 0]
random_colormap = LinearSegmentedColormap.from_list('new_map', randRGBcolors, N=nlabels)
# Generate soft pastel colors, by limiting the RGB spectrum
if type == 'soft':
low = 0.6
high = 0.95
randRGBcolors = [(np.random.uniform(low=low, high=high),
np.random.uniform(low=low, high=high),
np.random.uniform(low=low, high=high)) for i in xrange(nlabels)]
if first_color_black:
randRGBcolors[0] = [0, 0, 0]
if last_color_black:
randRGBcolors[-1] = [0, 0, 0]
random_colormap = LinearSegmentedColormap.from_list('new_map', randRGBcolors, N=nlabels)
# Display colorbar
if verbose:
from matplotlib import colors, colorbar
from matplotlib import pyplot as plt
fig, ax = plt.subplots(1, 1, figsize=(15, 0.5))
bounds = np.linspace(0, nlabels, nlabels + 1)
norm = colors.BoundaryNorm(bounds, nlabels)
cb = colorbar.ColorbarBase(ax, cmap=random_colormap, norm=norm, spacing='proportional', ticks=None,
boundaries=bounds, format='%1i', orientation=u'horizontal')
return random_colormap
bright_cmap = rand_cmap(50, type='bright', first_color_black=False, last_color_black=True, verbose=True)
Number of labels: 50
![png](method_of_moments_files/method_of_moments_23_1.png)
soft_cmap = rand_cmap(50, type='soft', first_color_black=False, last_color_black=True, verbose=True)
Number of labels: 50
![png](method_of_moments_files/method_of_moments_24_1.png)
'''Use the estimated parameters and plot the distribution on top of data'''
fig, ax = plt.subplots()
scol=soft_cmap(random.choice(range(50)))
bcol1=bright_cmap(random.choice(range(50)))
bcol2=bright_cmap(random.choice(range(50)))
# Plot those values on top of the real data
ax = df['Background CPU(s)'].hist(bins=20, normed=1, color=bcol1, figsize=(10, 7))
ax.set_xlabel('Statistics')
ax.set_ylabel('Probability Density')
ax.set_title('Background CPU(s)')
scol2=bright_cmap(random.choice(range(50)))
ax.plot(x_vals, gamma_p, c=bcol2, label='Gamma')
ax.set_axis_bgcolor(scol)
ax.legend()
#py.iplot_mpl(fig, filename='s6_log-scales')
<matplotlib.legend.Legend at 0x11184a3d0>
![png](method_of_moments_files/method_of_moments_25_1.png)
# Lets put everything in a function
# Define a function that plots distribution fitted to one month's of data
def plot_mom(df, col):
sample_mean=df[col].mean()
sample_var=np.var(df[col], ddof=1)
alpha = sample_mean**2 / sample_var
beta = sample_mean / sample_var
gamma_rv = scs.gamma(a=alpha, scale=1/beta)
# Get the probability for each value in the data
x_vals = np.linspace(df[col].min(), df[col].max())
gamma_p = gamma_rv.pdf(x_vals)
fig, ax = plt.subplots()
# Plot those values on top of the real data
scol=soft_cmap(random.choice(range(50)))
bcol1=bright_cmap(random.choice(range(50)))
bcol2=bright_cmap(random.choice(range(50)))
ax = df[col].hist(bins=20, normed=1, color=bcol1, figsize=(10, 7))
ax.set_axis_bgcolor(scol)
ax.set_xlabel('Statistics')
ax.set_ylabel('Probability Density')
ax.set_title(col)
ax.plot(x_vals, gamma_p, color=bcol2, label='Predicted Values')
ax.legend()
df.columns
Index([u'Background CPU(s)', u'Block changes', u'DB CPU(s)', u'DB Time(s)',
u'Executes (SQL)', u'Global Cache blocks received',
u'Global Cache blocks served', u'Hard parses (SQL)', u'IM scan rows',
u'Logical read (blocks)', u'Logons', u'Parses (SQL)',
u'Physical read (blocks)', u'Physical write (blocks)', u'Read IO (MB)',
u'Read IO requests', u'Redo size (bytes)', u'Rollbacks',
u'SQL Work Area (MB)', u'Session Logical Read IM', u'Transactions',
u'User calls', u'Write IO (MB)', u'Write IO requests'],
dtype='object', name=u'stat_name')
Lets just pick the following important statistics to estimate:
* 'Background CPU(s)'
* 'DB CPU(s)',
* 'Executes (SQL)',
* 'IM scan rows',
* 'Hard parses (SQL)',
* 'Logical read (blocks)',
* 'Parses (SQL)',
* 'Physical read (blocks)',
* 'Physical write (blocks)'
columns_of_interest=['Background CPU(s)', 'DB CPU(s)', 'Executes (SQL)', 'User calls', 'Hard parses (SQL)', 'Logical read (blocks)', 'Parses (SQL)', 'Physical read (blocks)', 'Physical write (blocks)']
for col in columns_of_interest:
plot_mom(df, col)
fig.savefig('images/'+col)
![png](method_of_moments_files/method_of_moments_30_0.png)
![png](method_of_moments_files/method_of_moments_30_1.png)
![png](method_of_moments_files/method_of_moments_30_2.png)
![png](method_of_moments_files/method_of_moments_30_3.png)
![png](method_of_moments_files/method_of_moments_30_4.png)
![png](method_of_moments_files/method_of_moments_30_5.png)
![png](method_of_moments_files/method_of_moments_30_6.png)
![png](method_of_moments_files/method_of_moments_30_7.png)
![png](method_of_moments_files/method_of_moments_30_8.png)
df.head()
<div>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th>stat_name</th>
<th>Background CPU(s)</th>
<th>Block changes</th>
<th>DB CPU(s)</th>
<th>DB Time(s)</th>
<th>Executes (SQL)</th>
<th>...</th>
<th>Session Logical Read IM</th>
<th>Transactions</th>
<th>User calls</th>
<th>Write IO (MB)</th>
<th>Write IO requests</th>
</tr>
<tr>
<th>start_time</th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th>01-APR-15 08.00.00.000000 AM</th>
<td>2.34</td>
<td>7171.66</td>
<td>8.34</td>
<td>21.33</td>
<td>7295.85</td>
<td>...</td>
<td>NaN</td>
<td>342.13</td>
<td>3172.36</td>
<td>7.38</td>
<td>791.23</td>
</tr>
<tr>
<th>01-APR-15 10.00.00.000000 PM</th>
<td>1.88</td>
<td>5829.02</td>
<td>5.75</td>
<td>14.98</td>
<td>4943.24</td>
<td>...</td>
<td>NaN</td>
<td>243.01</td>
<td>2288.04</td>
<td>5.59</td>
<td>603.88</td>
</tr>
<tr>
<th>01-JAN-15 08.00.00.000000 AM</th>
<td>NaN</td>
<td>1746.34</td>
<td>1.80</td>
<td>4.07</td>
<td>2277.13</td>
<td>...</td>
<td>NaN</td>
<td>139.59</td>
<td>970.47</td>
<td>1.61</td>
<td>162.10</td>
</tr>
<tr>
<th>01-JUL-15 08.00.00.000000 AM</th>
<td>2.07</td>
<td>6530.64</td>
<td>6.92</td>
<td>18.46</td>
<td>6485.98</td>
<td>...</td>
<td>NaN</td>
<td>334.05</td>
<td>3064.53</td>
<td>6.76</td>
<td>721.93</td>
</tr>
<tr>
<th>01-JUL-15 10.00.00.000000 PM</th>
<td>1.80</td>
<td>5853.14</td>
<td>5.19</td>
<td>14.20</td>
<td>4787.97</td>
<td>...</td>
<td>NaN</td>
<td>259.02</td>
<td>2370.28</td>
<td>5.70</td>
<td>606.48</td>
</tr>
</tbody>
</table>
<p>5 rows × 24 columns</p>
</div>
This above function would generate the MOM estimate for any database statistic that we would want.
For example if we want to predict MOM's for "Global Cache blocks served", we just need to call this function:
plot_mom(df,'Global Cache blocks received')
fig.savefig('images/cache_blocks.png')
![png](method_of_moments_files/method_of_moments_33_0.png)
For "Rollbacks" example our estimation is:
plot_mom(df,'Rollbacks')
fig.savefig('images/rollbacks.png')
![png](method_of_moments_files/method_of_moments_35_0.png)
## Conclusion:
As we can we our estimations (plotted in red) are pretty good estimation of our actual values that we observe in our real outputs. This concludes our discussion on MOM estimators on database statistics.
</xmp>
<script src="http://cdn.ztx.io/strapdown/strapdown.min.js"></script>
</html>