Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
introduction [2015/10/28 20:34]
a.leofreddi
introduction [2019/05/09 16:39] (current)
admin
Line 1: Line 1:
-====== ​Quick Start ======+====== ​Introduction ​======
  
-TimEL'​s expressivity ​comes mainly form the ability ​of model time recurrent events with a number of specific aggregation functions.+A lot of data comes in the form of time-series, and while usually they'​re easy to manipulate, the process can become trickyHere TimEL comes to help!
  
-As the data type is very important since it affects ​the computation,​ multiple resample functions are available to support both rescale ​and data type conversion on the fly when needed.+Indeed TimEL is a good fit to solve various time-series problems, mainly ​the metering ​and billing ones (that'​s where it originates from).
  
-The following basic function are available:+Now let's image an hypothetical scenario to see how TimEL could help. Let's say you're implementing a next killer web game where you get a point for each rescued kitten. Now you want to reward your most loyal players with an in game bonus based on the achieved score.
  
-  * [[Scalar]] +More specifically,​ imagine that for each player session your backend system logs hourly the user session length (rounded hourly) and the relative score totalled during the session.
-  * [[Integral]] +
-  * [[Average]]+
  
-Each of these functions receive the value to resample as first argument, and can be used with an optional 2nd argument which is the temporal interval to which the resample should be applied.+It might happen that sometimes a user session ​is still open, so in such a case the backend will emit a single entry covering more than 1 hour when the session is complete.
  
-Note that the temporal interval may be a fixed (defined using the [[Interval]] function) or a recurring one (defined using the [[Every]] function).+Now imagine we have two players, A and B, with the following scores:
  
-When no interval is provided, an aggregation function will produce a single output with the longest interval possible.+<​HTML>​ 
 +<script src="​https://​code.highcharts.com/​highcharts.js"></​script>​ 
 +</​HTML>​
  
-Follows an example of the following function, evaluated in the interval 2015-01-01 to 2015-02-01 (we use the ISO format to avoid confusion):+<​HTML>​ 
 +<div id="​score1"​ style="​min-width: 310px; height400px;"></​div>​ 
 +</​HTML>​
  
 +<JS>
 +    jQuery('#​score1'​).highcharts({
 +//
 + title: { text: '​Yesterday\'​s player score' },
 + xAxis: {
 +            categories: ['​08:​00',​ '​09:​00',​ '​10:​00',​ '​11:​00',​ '​12:​00',​ '​13:​00',​ '​14:​00',​ '​15:​00',​ '​16:​00',​ '​17:​00',​ '​18:​00'​]
 +        },
 + plotOptions:​ {
 +     series: {
 +        step: '​left'​
 +     }
 + },
 +        series: [{
 +            name: '​A',​
 +            data: [
 +                [0, 0],
 +                [1, 36],
 +                [3, 0],
 +                [5, 16],
 +                [6, 0],
 +                [7, 18],
 +                [8, 0],
 +            ]
 +        }, {
 +            name: '​B',​
 +            data: [
 +                [0, 0],
 +                [2, 20],
 +                [3, 0],
 +                [5, 12],
 +                [6, 26],
 +                [7, 0],
 +                [8, 0],
 +            ]
 +        }]
 +//
 +});
 +</JS>
  
 +At 9:00, player A started to play and stopped at 11, scoring 36 points - so your backend logged 36 points in between 9:00 and 11:00. Player B started one hour later, and played only for one hour (scoring 20 points).
  
 +Now let's imagine that we want to compute the total score achieved by A and B together, every hour.
  
 +What would be the score in between 9:00 and 10:00 ? Well, it would be only A's one, but we have to consider that he saved 36 kittens for a 2 hours period.
  
 +Without more data, we can assume that if he saved 36 kittens in 2 hours, he saved 18 each hour. So we can say that between 09:00 and 11:00, 18 kittens were saved. One hour later 38 kittens were saved (18 by A, and 20 by B)!
 +
 +And that's what TimEL will automatically do, because we feed it using an [[Integral]] variable.
  
  • introduction.1446064441.txt.gz
  • Last modified: 2015/10/28 20:34
  • by a.leofreddi