Friday, 14 February 2014

Algorithms Used

The algorithms are very simple. Data collection is done by taking a repeated set of 25 samples at 10Hz. For each set the average is calculated for each axis. Then the maximum deviation is worked out. The highest deviation is the stored.

Over a 1 minute period the largest overall deviation is accumulated.

The figures are then stored in 10 minute wide buckets, recording the highest figure for that 10 minute period.

Effectively you get the largest movement in any ten minute period in mG.

The sleep quality is a very simple setup at present:
  • Any 10 minute period value above 1000 (ie 1G) is regarded as awake/super restless/being abducted by aliens. 
  • Similarly a figure around 120 marks the boundary between light and heavy sleep. 

The smart alarm averages across the night, and wakes you at the first point between the wake up hours where your movement exceeds average.

3 comments:

  1. Hello! Why take the highest figure instead of the average? I get very messy graphs, and according to he app, I'm awake like.. 40% of the time.
    An average every 2, or 10 minutes seems much more accurate to me? Isn't it?

    ReplyDelete
  2. Hello!

    I'm still not really satisfied with the recorded sleep patterns and I'm trying to understand what your algorithm does:
    - It takes the largest move of a 2.5s loop, store it
    - After 2 min, takes the largest of all the individual largests, store it.
    - After ten minutes, takes the largest of the largests of the largests and store it as final data.
    Is that correct?

    That a hell lot of measurments for a very small amount of recorded data.
    And always taking the largest acceleration, never averaging, means that if I have just one little spasm over a period of 10 minutes, morpheuz will take this as how I was spending 10 minutes of my sleep.

    Either I don't get it, or I really don't see how this is an actual representation of the sleep pattern.. I always had highly serrated curves that were pretty meaningless, with morpheuz estimating that I spend 35% of my night "awake".

    Could you enlighten me?

    You have made great and amazing improvements on the app during the last year, but I have the impression that the algorithm is flawed to begin with. What's your thoughts?

    ReplyDelete
    Replies
    1. Essentially it captures the largest relatively quick (i.e. within 2.5 s) movement within the time frame as an indication of sleep. Clearly there are limitations on defining sleep by the use of movement alone, but it does provide insight.

      During the time I have tried other algorithms but none seem to provide a result that characterises the sleep as well. If I find one, then you can safely assume I will use it.

      Delete

Bug? Please report using this form. Would like a new feature? Please use this form.