








Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!









Homework 2 CMPS
Reiner Kraft ([email protected])
Abstract
Battery life represents an important factor for mobile computing devices. One of the main energy consumers in these devices is the hard disc. Therefore algorithms that help to preserve and optimize battery life to preserve energy by optimizing disc spin-down is a worthwhile research area.
This report evaluates the online learning algorithm know as the âshare algorithmâ developed by Herbster and Warmuth [1] and investigates how different parameter settings effect the overall energy usage of the algorithm. We compare the energy usage of the share algorithm to various other algorithms and the theoretical lower bound, the optimal algorithm.
In the remainder of the report we investigate how different expert distributions (linearly, harmonically, and exponentially spaced timeout distributions), the learning rate, the shifting rate, and other parameters effect the overall energy usage of the algorithm. We also investigate weights of the experts and see how these related to the overall performance of the algorithm.
As a result we see that the share algorithm outperforms various other algorithms, which confirms the findings in Helmbold et al. [2]. Still, there is a big performance gap left between the share algorithm and the optimal algorithm, which motivates to try out different algorithms. We pick one alternative algorithm that was mentioned in class, which uses previous decisions of the optimal algorithm to predict time-outs. However, even this alternative algorithm doesnât seem to perform better than the share algorithm. Therefore the challenge of finding an algorithm that can do better as the share algorithm remains as an open problem.
We first describe the experiment setup. Initially, we define a learning rate η 4 and a shifting rate
α 0.08. This rate was derived from previous experiments [2], and we will use it as a starting
point for the share algorithm. Later we will update these values with more optimal ones for the data set used. The learning rate controls how fast the weights of the experts with wrong predictions are reduced. The shifting rate controls how lost weights are shared among experts. We assume spin-down costs in the range between 1 and 20 seconds. Per default we use 100 experts that represent timeout distributions. The distributions are represented as matrices as follows:
Linearly spaced time out value for experts:
LEi s, i s.^
n
Harmonically spaced time out value for experts:
HEi s, s
( n 1 ) i
Exponentially spaced time out value for experts:
base 2
EEi s, s
base
n i
The data file that represents a trace of idle times over a day contains 199724 entries. The unit of the entries is microseconds. We further define an initial weight vector for the experts as
Initial weight vector
wi
n
Further a function to calculate a time-out (prediction) - given a weight vector and an expert vector using weighted average:
timeout w x( , )
w x.
n
i
wi
=
Example:
timeout w LE, < 1 > = 505000
Then we need further definitions that deal with energy consumption. These are described in detail in [1,2] but shown here for convenience (using MathCAD notation):
Calculate the energy that an expert used with its prediction, given the idle time, the time-out, and the spin-down costs:
Energy idle t( , ,spindown) if idle( t idle, ,t spindown)
Energy used by optimal (optimal amount of energy used given idle time and spin-down cost):
optimal idle spindown( , ) if idle( spindown , idle,spindown)
ExcessEnergy idle t( , ,spindown) Energy idle t( , ,spindown) optimal idle spindown( , )
Calculate the loss of an expert, given the energy used by the prediction, the optimal energy, and the spin-down cost
Loss idle t( , ,spindown)
ExcessEnergy idle t( , ,spindown) spindown
We noticed that the share algorithm gradually shrinks the weights towards 0. Therefore we add an additional rescale step to normalize the weights after each update: This avoids underflow by bounding the ratio between weights.
Perform a trial (shared update)
Input: a vector of expert predictions, the current weight vector, the actual idle time, and the spin- down cost.
Returns: an updated weight vector
performTrialSharedUpdate currentweight x( , , idle,spindowncost) loss vLoss ( x idle, ,spindowncost)
iw vCalcIntermediateWeight currentweight( ,loss) pool pool iw loss( , )
vCalcNewWeight iw loss( , ,pool)
Calculate total energy usage of master algorithm over a sequence of trials (shared update)
Input: A vector of experts predictions (x), a vector of initial weights w, the spin-down-cost for which we want to calculate the cumulative loss, a range that indicates the trial we want to iterate over, and the data that contains the real idle times used
calcTotalEnergyUsageMA ( w x, , spindowncost, data,numTrials) cw w energyUsedA 0
prediction timeout cw x( ,) idle data (^) i cw performTrialSharedUpdate cw x( , , idle,spindowncost) energyUsedA energyUsedA Energy idle prediction( , ,spindowncost)
fori â 0 ..numTrials 1
energyUsedA 1000000
In the first experiment we compare the energy usage of the individual experts using different timeout distributions (linear, harmonic, and exponential). Furthermore, the optimal algorithm represents a theoretical lower bound and is used for comparison. We use a spin-down cost of 10 seconds, which has proven to represent a good practical value [2]. The timeouts of the experts are less equal than the spin-down cost. According to [1] we can neglect time-out values greater than the spin-down cost.
Generally we run the experiments on small samples of the data (e.g., 10,000, or 20,000 idle times) for practical purposes. For instance, running the master algorithm on 10,000 samples takes roughly a minute. Once the experiment setup seems to be stable and as desired we run the algorithms over night with a larger data set (e.g., 100,000) since this takes several hours to compute. It has been confirmed that the overall outcome of the results doesnât change much for a larger sample, and so we can safely confirm the assumptions obtained from smaller samples. Again, most of the experiments were run at a later stage with the large data set to make sure there were no mistakes with the conclusions derived from the smaller sample.
expSpacedExpertsi
hSpacedExpertsi
lSpacedExpertsi
optEnergyi
MAEnergyi
i
0 10 20 30 40 50 60 70 80 90 100
1 10^3
1 10^4
1 10^5
1 10^6
1 10^7
Energy Usage Individual Experts
nth Expert
Total Energy Usage (LOG Scale) in sec.
Figure 1. Energy usage of individual experts compared to optimal and master algorithm
From the plot we can see that the used energy differs significantly for experts over different timeout distributions. This does not seem to have an overall effect to the master algorithm, which indicates that the master algorithm seems to be robust regarding the choice of experts.
We can still observe a gap between the algorithms and the optimal algorithm, which motivates to find an algorithm that shrinks that gap further.
We can also observe the differences in the energy consumption of the experts in different timeout distributions. The exponential ones consume more energy for most of the experts, but the top numbered experts consume significantly less.
In this setup we compare the energy usage of the shared master algorithm using different time- out distributions over spin-down times between 1 and 20 seconds. As a reference we show how the other algorithms perform. We run the algorithm for each spin-down cost over a sequence of 100,000 trials.
In addition, we show the energy usage of the best-fixed, the 2-competitive, and an experimental algorithm mentioned in class, which we call adoptOPT.
For the best-fixed we picked a random sample of 10000 idle times and calculated the energy usage. We kept the idle time with the minimum energy usage then for the best-fixed, which
We want to learn how the weights of the experts change over time. Again, we use different expert timeout distributions. In this experiment we chose a fixed spin-down cost of 10 seconds over a sequence of 10,100,1000,5000,10000,20000, and 50,000 trials (which we highlight in the plot).
w0i
w10i
w100i
w1000i
w5000i
w10000i
w20000i
w50000i
i
0 20 40 60 80 100
0
Figure 3 Weights of linearly spaced experts over a sequence of 50000 trials
w0i
w10i
w100i
w1000i
w5000i
w10000i
w20000i
w50000i
i
0 20 40 60 80 100
0
Figure 4 Weights of harmonically spaced experts over a sequence of 50,000 trials
w0i
w10i
w100i
w1000i
w5000i
w10000i
w20000i
w50000i
i
0 10 20 30 40 50 60 70 80 90 100
0
1
Figure 5 Weights of exponentially spaced experts over a sequence of 50,000 trials
On the plot we can nicely see how the experts in different distributions shift over time, loose weights because of wrong predictions, and gradually regain weights if they do well again.
There is a broader range of weight changes in the linearly spaced experts timeouts. The harmonically and the exponentially spaced experts are flat for most of the leftmost region. Weight changes and shifting only occurs at the high numbered experts.
In this experiment we want to learn how the number of experts has an effect to the total energy usage. Therefore we chose again a fixed spin-down cost of 10 seconds. We then let the master algorithm run with 2,5,10,20,30,..,100 experts in different time-out distributions and plot the energy usage.
yexpRange
expRangeVexpRange
0 10 20 30 40 50 60 70 80 90 100
Figure 8 Number of experts and total energy used (exponentially spaced experts)
We can see from the plot that the results are different in different timeout distributions. Overall we the amount of energy used does not change significantly when increasing the number of experts over 40. On the other hand increasing the number of experts slows down the run-time behavior of our algorithm, since this will result in a bigger expert and weight vector.
It seems that choosing a small amount of experts (e.g. 5-10) seems to produce the best results and uses the least amount of resources during run-time.
There is a difference in the linearly spaced and the harmonically spaced experts with few available experts. Energy costs are high for a few linearly spaced experts (less than 10), and more experts actually help to reduce the total energy usage. We can see local minima at 40 and 70 experts. This is in contrast to the harmonically spaced where less than 10 experts help to minimize energy usage. More than ten will increase the energy usage considerably.
For the exponentially spaced 5-10 experts seems to be a good choice. Having more doesnât really help. The explanation is that there are less active experts available at any time (see next experiment for more details on this). Therefore a few experts are sufficient for this distribution.
We introduce the term âactive expertâ for an expert that has a weight > epsilon (where epsilon is <10 -15). When running the previous experts we noticed that the number of experts especially for in the exponential timeout distribution is quite low compared to the initial number of experts. For instance, after 4500 trials there is only one active expert left. It then takes a few thousand trials until the amount of active experts grows back to the initial number of active experts (e.g., 100 in our experiments).
activeLrangeExp
activeHrangeExp
activeErangeExp
(^0 5000) rangeExp31 10 (^4) 1.5 10 (^4) 2 10 4
0
20
40
60
80
100
Linearly spaced experts Harmonically spaced Experts Exponentially spaced Experts
Figure 9 Active experts over time in different time-out distributions
We can observe from the plot that the exponentially distributed time-outs of experts have the least amount of active experts on average. The have peaks, but then go down again sharply soon.
The harmonically distributed experts have a higher average and the most active experts are in the linear distribution of time-outs.
From the previous experiment we know that a smaller number of experts produces good results. Further, from the first two experiments we also know that the exponentially spaced experts use less energy. It could be the case that since the exponentially spaced experts also have the least amount of active experts over time they have the best energy performance value.
It would be interesting to track this in more detail, since this picture shows nicely how the master algorithm works on the expertsâ weights.
In this experiment we try out different learning rates between 1.0 and 6.0. We use a fixed spin- down cost of 10 seconds over a sequence of 20,000 trials. The goal is to identify a good learning
In this experiment we try out different shifting rates between 0.02 and 0.2. We use a fixed spin- down cost of 10 seconds over 50,000 trials. The goal is to identify a good shifting rate with lower energy consumption.
energyLSRshiftingRange
energyHSRshiftingRange
energyESRshiftingRange
vShiftingRateshiftingRange
0 0.05 0.1 0.15 0.
1580
1600
1620
1640
1660
1680
1700
Linearly spaced experts Harmonically spaced experts Exponentially spaced experts
Figure 11 How shifting rate effect the overall energy usage
The plot is slightly different than the one in the previous experiment. If we increase the shifting rate, we also increate the amount of energy used in the harmonically and exponentially spaced experts gradually.
There is a local minimum for exponentially spaced experts around 0.1 and for harmonically spaced experts around 0.14. For linearly spaced experts the energy usage goes down at 0. and then stays flat.
This experiment confirms that our initial assumption of using 0.08 isnât too bad but not optimal for this data set. We will use 0.10 in our optimized version of the master algorithm for this data set.
From the previous algorithms we learned better parameter settings for the shared algorithm. Therefore we suggest using the following new parameters for this data set:
Number of experts: 10 Learning rate: 6. Shifting rate: 0. Distribution: Exponential
We changed also the adoptOPT algorithm as follows: adoptOPT will consider the previous four trials and compares these with the optimal algorithm. If the optimal algorithm in three out of four cases keeps the disc spinning, we predict with the spindown costs. However, this didnât improve the performance. We tried several variations on this algorithm without any significant success in beating the performance of the master algorithm. The key seems to be for this algorithm to devise a better prediction pattern for idle times that are longer than the spin-down cost.
We conducted many additional experiments compared to the paper [2] that helped to gain more insights on how the share algorithm works. These insights helped to fine-tune the algorithm for the specific data set. Furthermore, the experiments motivated to devise a better algorithm that uses less energy as the shared master algorithm, and therefore shrinks the gap between the master and the optimal algorithm. A proposed modified version adoptOPT was investigated, and looks as promising start to explore different adaptive algorithms, or different learning algorithms that beat the master algorithm. For instance, we could think about a new modified master algorithm that tries to learn and predict idle times that are larger as the spin-down cost to simulate closer the outcome of the optimal algorithm.
[1] David Helmbold, Darrell D.E. Long, Tracy L. Sconyers and Bruce Sherrod. Adaptive Disk Spin-Down For Mobile Computers [2] Jyrki Kivinen and Manfred Warmuth Averaging Expert Predictions [3] Olivier Bousquet and Manfred Warmuth Tracking a Small Set of Experts by Mixing Past Posteriors