cs320 performance evaluation plotting data sets semi log
play

CS320: Performance Evaluation Plotting data sets Semi log plots - PowerPoint PPT Presentation

CS320: Performance Evaluation Plotting data sets Semi log plots Log log plots Analyzing Program Performance In Computer Science, we plot functions describing the run time (or the memory use) of a program a s a function of the input size. We


  1. CS320: Performance Evaluation Plotting data sets Semi log plots Log log plots

  2. Analyzing Program Performance In Computer Science, we plot functions describing the run time (or the memory use) of a program a s a function of the input size. We run a program for a number of input sizes and end up with performance data sets. We want to characterize these as an order of magnitude, e.g. O(n 2 ) or O(2 n ) complexity, i.e., we want to look at a plot and establish its O growth behavior. Let’s look at some examples.

  3. Example: 3 data sets f, g and h 180" n f(n) g(n) h(n) 160" 1 2 9 2 140" 2 12 18 6 120" 3 36 35 24 100" f" 4 80 68 68 g" 80" 5 150 131 162 h" 60" What kinds of functions are 40" f, g and h? 20" exponential? which base? • 0" polynomial? which degree? 1" 2" 3" 4" 5" • Hard / impossible to infer WHY?

  4. Why are functions hard to infer? Two problems: ¨ Very small domain (here 1..5) n Try to get a large data domain ¨ Interpreting polynomial and exponential functions from plots is hard, they all just swoop up

  5. Larger domain 18000" n f(n) g(n) h(n) 16000" 2 9 2 1 14000" 12 18 6 2 12000" 36 35 24 3 10000" f" 80 68 68 4 g" 8000" 5 150 131 162 h" 6000" 400 520 624 7 4000" 1100 4106 2510 10 2000" 1872 16396 5196 12 0" 0" 2" 4" 6" 8" 10" 12" 14" Notice that values for n=1-5 are practically on the floor now, and we see different behavior further on. The steeper a plot, the higher its Order of Magnitude.

  6. Larger domain 18000" n f(n) g(n) h(n) 16000" 2 9 2 1 14000" 12 18 6 2 12000" 36 35 24 3 10000" f" 80 68 68 4 g" 8000" 5 150 131 162 h" 6000" 400 520 624 7 4000" 1100 4106 2510 10 2000" 1872 16396 5196 12 0" 0" 2" 4" 6" 8" 10" 12" 14" Which function may be polynomial, which exponential? Still, not all clear (order, base…), h(n) may spike up later…

  7. Straight Lines We get the most information from straight lines ! ¨ We can easily recognize a straight line (y = ax+b) n The slope (a) and y intercept (b) tells us all. ¨ So we need to turn our data sets into straight lines. ¨ This is easiest done using log-s, because they turn an exponential into a multiplicative factor, and a multiplicative factor into a shift. log a n = n log a log a*n = log a + log n

  8. Exponential functions n log(2 n ) = n log2 linear in n log(3 n ) = n log3 the log(base) of the exponential becomes the multiplicative constant and determines the slope in the plot n log(4*3 n ) = n log3 + log4 linear, same slope log((3 n )/4) = n log3 – log4 but *4 or /4 shifts the plot up or down

  9. Exponentials: semi log plot n 2 n 3 n 20*3 n 10000000" 0 1 1 20 1000000" 1 2 3 60 2 4 9 180 100000" 3 8 27 540 10000" 2^n" 4 16 81 1620 3^n" 5 32 243 4860 1000" 20"3^n" 7 128 2087 41740 100" 10 1024 56349 1126980 10" Semi log plot: y–axis on log scale 1" x-axis linear 0" 2" 4" 6" 8" 10" 12" slope: log base shift: multiplicative factor

  10. Polynomials n What if we take the log of a polynomial? e.g. f(n) = 5n 3 log(f(n)) = log(5n 3 ) = log5 + 3 log(n) not a straight line! n But the log of a polynomial is linear in log(n) n Therefore we need to plot polynomials on a log log scale (both x and y axis logarithmic)

  11. Polynomials: log-log plot n n 2 n 3 20*n 3 1000000" 1 1 1 20 100000" 2 4 8 160 4 16 64 1280 10000" 8 64 512 10240 n^2" 16 256 4096 81820 1000" n^3" 32 1024 32768 655360 20"n^3" 100" slope: degree 10" shift: multiplicative factor 1" 1" 10" 100"

  12. Example Plot data: 1,64 2,128 3,256 4,512 log log linear linear 5,1024 6,2048 Semi log plot makes a 7,4096 straight line 8,8192 semi log

  13. Example continued Plot data: Semi log plot 1,64 makes a straight line. 2,128 Therefore we have 3,256 exponential data. 4,512 semi log 5,1024 slope: (13-6)/(8-1)=1 6,2048 7,4096 log 2 base = 1, therefore base = 2 log base = 2 1 = 2 8,8192

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend