Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
cavvia committed Oct 22, 2015
1 parent f648411 commit c877e65
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -46,13 +46,13 @@ Usage

Take, for example, a social network in which users can follow each other. You want to track trending users. You construct a one week delta, to capture trends in your follows data over one week periods:
```ruby
follows_delta = Forgetsy::Delta.create('user_follows', t: 1.week)
follows_delta = Forgetsy::Delta.create('user_follows', t: 1.week, replay: true)
```
The delta consists of two sets of counters indexed by category identifiers. In this example, the identifiers will be user ids. One set decays over the mean lifetime specified by _t_, and another set decays over double the lifetime.

You can now add observations to the delta, in the form of follow events. Each time a user follows another, you increment the followed user id. You can also do this retrospectively, using the `replay` option:
You can now add observations to the delta, in the form of follow events. Each time a user follows another, you increment the followed user id. We can also do this retrospectively, since we have passed the `replay` option to the factory method above:
```ruby
follows_delta = Forgetsy::Delta.create('user_follows', t: 1.week, replay: true)
follows_delta = Forgetsy::Delta.fetch('user_follows')
follows_delta.incr('UserFoo', date: 2.weeks.ago)
follows_delta.incr('UserBar', date: 10.days.ago)
follows_delta.incr('UserBar', date: 1.week.ago)
Expand Down

0 comments on commit c877e65

Please sign in to comment.