From the course: Advanced Go Programming: Data Structures, Code Architecture, and Testing

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Introduction to rolling mean challenge

Introduction to rolling mean challenge

(upbeat music) - [Instructor] All of our exploration with streams brings us to our second challenge. You'll use the techniques we've learned so far to calculate the rolling mean of a data set. The mean of a data set is calculated by first adding all the points in the data set and then dividing their sum by the number of points in the data set. How would you do this for a very large stream of data? First, the sum of this data set could cause overflow errors due to its size. Secondly, this calculation might take a long time. So how can we get around this problem and get some meaningful averages for our data streams? A common solution to this problem is to instead calculate the rolling mean or average, which makes use of the sliding windows technique that you saw earlier. The calculation of the rolling mean is done by dividing the stream into sliding windows and calculating the mean for each of them. The example…

Contents