Dual N-Back, Learning and Heart Rate Variability

Following my Heart Rate Variability, Learning and Flow study I took the recommendations from fellow quantified selfers and ran another round of sessions using a Dual N-Back game produced by the Brain Workshop.

What I did:

  • played a Dual 2-Back brain game on my Mac once or twice sitting at the same location in the morning each day for 8 days,
  • set the game for 90 trials that lasted anywhere from 273 to 282 seconds per session resulting in a measured success score that was expressed in terms of % correct,
  • measured the total heart rate coherence accumulated points score as given by Heartmath Pro over the total session,
  • divided the total accumulated points per session by the number of minutes to derive a “points per minute” score per session,
  • after entering that data into excel graphed the resulting points per session over the learning cycle.

How I did it:

Everything for this study was executed on the Mac. Heartmath Pro, the DualNBack game and excel were all windows on the Mac screen. Because I had set a disciplined approach to the first brain game I simply rotated the method in here.

As before I started the Heartmath Pro and waited until 30 seconds had elapsed so I was getting an HRV based cardiac coherence reading. After the coherence reading began I would start the Dual 2-Back game. The game was approximately 4.5 minutes to play. Here is a short YouTube video showing the mechanic of a Dual N-Back game.

Playing Dual 2-Back meant I was remembering the letter and location shown two iterations prior to the one being show on the screen currently.

What I Learned:

My correct answer percentage per session increased linearly the more I played. When I started I played using instinct then begin using a simple strategy to track the different elements around session 9. From there the learning continued but it was still linear. The strategy alone did not take the scores immediately higher, but it did enable continued improvement.

Slide1My Heart Rate Variability (HRV) also steadily increased the more I played. The points/minute proxy for HRV started at a low of 10 when I started playing and was in the 25 to 30 range at the 15 through 17th session. My subjective experience was of stress and concentration in the early session then more relaxed in the later sessions, mostly because I had worked out a strategy and attributed different scores to my having implemented the strategy well or not. Specifically, my mindset went from “I don’t know how to improve” in sessions 1 through 8 to “I need to implement a known strategy better” in 9 through 17. Here are the points/minute results over the sessions:


Dual N-back demands constant attention, unlike the nearly autonomous reactions the category brain game allowed after repeated play. My experience with Dual N-back was consistent low level stress where the category game was more like “zoning out” and watching my fingers hit the screen. In comparison to the range of 10 to 30 points/minute in the Dual N-back game the category game points/minute were routinely between 30 and 50 as shown here:


One insight I gleaned was that there is no “know it” or “don’t know it” binary state with respect to mastering a task. Knowledge and capability steadily increase as reflected in the quality of the output. Physiological stress decreases steadily as reflected in the increase in HRV. So my own tendency to think of mastery as binary is incorrect. Mastery at the capability and physiological level is a continuum and we move linearly along it. And movement along that continuum is as much about belief in the ability to improve as it is about underlying capability.

HRV, Simple Games & Imagination

After feedback from Bob and Gwern on the learning post I have started collecting heart rate variability (HRV) while playing Dual-N-Back game that Gwern recommended. Dual-N-Back is much more intense than the simple category recognition game I have been measuring. I will share the results there when I gave a good amount of data. Out of curiousity I kept playing the simple game from the first post and continued recording the results.

What I have seen with continued plays of that first simple game has surprised me. According to the principles in Csikszentmihalyi’s Flow I would expect a stress response from my HRV reading in the beginning, a relaxed (high) HRV when I was in Flow then for the reading to taper off as I become bored with the task. I’m not finding that. Here is the graph:


What has happened is after the first sessions of learning how to use the category game (session 1 through 6) my HRV became relaxed and has stayed there. In fact the “up-down-up-down” you see on the graph is an expression of the fact I do two or three sessions a day and sometimes I get into a groove in different sessions. The graph if you average the sessions across the day eliminates this and is clearer on how stable my HRV has been once I familiarized myself with the game:


So this particular category game engages my attention enough to get me into a relaxed state that yields consistently higher HRV. I am a bit thoughtful during the task and at times my mind wanders because I am bored. And the numbers show that I am averaging a much higher HRV overall after having become familiar with the task.

What I see in the different session scores is a state of attention playing out. When I am engaged and focus my HRV as reflected in the points scores is higher. Each time I play I use the same tablet at the same desk in the same sound and light environment. The task is the same, and I usually score the same amount of points. What is different is whether I have a story in my head that I should be doing something else or have been doing the task for too long. That story is completely from my imagination. So imagination drives HRV as much as anything.

Heart Rate Variability, Learning & Flow

I looked at how my Heart Rate Variability (HRV) changed through the process of learning a simple task from introduction of the activity through to a point where the task was nearly pre-conscious and automatic. I compared the change in HRV to Csikszentmihalyi’s concept of moving from anxiety through Flow to boredom.

What I did:

  • played an Android based “brain game” twice through for approximately 4.5 minutes per session for twelve sessions,
  • measured the total heart rate coherence accumulated points score as given by Heartmath Pro over the total session,
  • divided the total accumulated points per session by the number of minutes to derive a “points per minute” score per session,
  • after entering that data into excel graphed the resulting points per session over the learning cycle.

How I did it:

In each session I would start Heartmath Pro and wait until 30 seconds had elapsed so I was getting an HRV based cardiac coherence reading. As soon as software started getting this reading started I would begin to play “Mind Games” on a Nexus 7 tablet. The game I played was 120 seconds long and included choosing one of four categories appropriate for a shown picture. The choices were cards, dice, cars or people and this example screenshot shows an image for a car with the four buttons below:



I played two repetitions of the 120 second game per HRV reading session for an approximate total session length of 4.5 minutes and two sessions a day for six days.

Heartmath Pro awards points per five second interval based on a “coherence score.” The score is based on the ratio of Low Frequency cardiac output to High Frequency, where cardiac coherence is considered to be achieved when all frequencies group in the Low Frequency band around .1Hz. Every five seconds the software awards achievement points based on the coherence score, meaning if your coherence score was 3.5 for that five seconds the software adds 3.5 points to your points total. The final outcome of a session looks like the this:


This scoring is a proxy for how variable your heart rate was during a session and thus how relaxed your physiology was in the period. Comparing the points total per minute to other measures like LF/HF and rMSSD show that higher points per minute and more “stress free” LF/HF and rMSSD correlate.

Once the sessions were completed I entered the session length and score in an excel spreadsheet which then calculated the points/minute for that session. In the session shown above 138 achievement points divided by 4.52 minutes gave an outcome of 40.9 points/minute. Scores playing the game over the twelve sessions ranged from 21.0 to 52.3 points/minute.

What I learned:

My initial idea was to avoid creating stress with the mind game by not paying attention to the mind game score, which was a measure of correctly categorized images. I was trying to only engage my attention and take a reading of HRV. I wanted to compare my HRV during engaged attention to a baseline where I let my mind wander and to when I was working on a computer. It was in session seven where I entered a very relaxed state and both the points/session and the mind game scores were going noticeably upward that I started looking at this learning curve in isolation.

In that seventh session I entered a relaxed state and no longer had to think about the answer as the image flashed on the screen. My fingers just moved. By sessions eight through eleven I was watching my fingers move without really thinking at all. And time, while it did not disappear, was no longer in my attention. I thought I may have entered a state described by Csikszentmihalyi’s Flow theory where  challenge and skills balance, as shown in this graph:

Flow Channel Image

When undertaking a task and the challenges match the skills and feedback is immediate one enters a relaxed and enjoyable state where time seems to disappear and the action just emerges. In the seventh and eighth sessions I realized this might be happening. Here is how that change in state was reflected in my HRV readings:


As higher HRV is associated with a relaxed state, what we see here is my physiological reaction to a challenge of a uniform difficulty was becoming more relaxed with repetition.

My subjective experience in sessions one through five was that of feeling “alert in the head” meaning I was calculating the answers as the images came up. And I was keenly aware of the time during each session and recall saying “only 20 seconds to go” or “only one more session.” This was a state of low level stress and anxiety.

Session six still felt like that but the HRV points/minute score was starting upward. By session seven the subjective experience started to change. I was relaxed during those sessions and time, while not completely gone, seemed to fade. My HRV points/minute continued upward. During session eleven and twelve the scores seemed to drop. I was doing the brain game automatically and not feeling stress of doing the game but my mind was starting to wander to other topics. Boredom had begun.

Using the Flow chart this is what I think the HRV chart shows:


In the first five sessions my HRV reading was an average of 25 points/minute. As subjectively I began entering the Flow state from session six through ten my average HRV reading was 43 points/minute. During session 11 and 12 as my mind started to wander a bit the average on those sessions was 35 points per minute. Not stress, but not as relaxed and engaged.

Issues and Next Steps:

The issue here is I am writing this up before gathering sufficient data to see the full curve. For example, if I keep playing the game to absolute stultifying boredom where does the HRV points/minute level out? And how do I add challenge that is compatible with the “learned skill” of choosing the four categories?

The next steps are to see if HRV can be an indicator of location on the Flow continuum with respect to a learning task. If so, the challenge inherent in that task can be adjusted if the HRV readings indicatate that the learner is either 1) not emerging from early stages of learning anxiety or 2) the learner is dropping into a state of boredom because the task is mastered.

The Problem of Split Attention

In a heart rate session today I was in nice focus and high coherence until I thought of a to-do that I had to take care of later in the day. There was a navigational “I have to be somewhere else” feel and at that moment my RR interbeat interval went sideways as shown below in the red circle:



What was happening? In that moment I was trying to hold two things in my attention – one my breath as it followed the up and down journey of my interbeat interval, and the second the phone call I had to make. My nervous system then dropped the variability of my heart rate.

After recognizing the moment of split attention I returned my attention to my breath and the variability returned. In this case thought clearly triggered a change in variability, and releasing the thought returned the variability to its start point.

What was happening? A hypothesis is that I overwhelmed my conscious processing capacity of 126 bits per second as described by Csikszentmihalyi’s concept of Flow. Flow is a very fashionable framework and I think it is useful. Three things are necessary for Flow when undertaking a task – clear goals, clear feedback and a perceived balance of challenge versus perceived skills.

The task I was engaged in was focussing on my heart rate for 30 minutes. I perceived that I could make the phone call, so I was not out of balance in that sense. There was no feedback change. I think what happened is that I questioned my goals – should I instead be making the phone call versus sitting measuring heart rate variability?

Maintaining the integrity of moment to moment attention somehow has to be tied into how I prioritize my actions. From where does the framework for prioritizing actions come? It may be a shortcut to maintaining a lower level of stress.

rMSSD – Finding the Right Metric

My question throughout these months of study has been around unnecessary distraction from an enjoyable life due to stressing out about things that did not merit the stress. My very first results were around surprising ways I was stressing myself out that on examination disappeared. Most of this work was self reported upsets. 

Once I started down the road to finding technology that could help me know when I was upset things became very complicated very fast. There are a large number of devices that claim to measure stress but my experience was that they were not consistently reading stress events. I highlight Heartmath in a lot of my work and it does provide a good baseline for relaxed coherence, but the technology is virtually unusable in all but quiet meditative session. For example, if you turn your head the readings will drop out to zero which is not very useful if you are meeting someone in a coffee shop. 

I have spent a lot of time with apps and Bluetooth heart rate belts. I built my knowledge reading academic papers and with off the shelf apps got to the point I have a good set of readings on stress events. The most complicated manual structure I devised was this:

  • take a reading with a Polar H7 heart rate sensor,
  • capture the output in SweetbeatLife app,
  • email the results to myself from the app,
  • download that associate file
  • import the data in that file to Kubios,
  • in Kubios cut the data into 30 second increments which meant three keystrokes repeated up to 120 times,
  • generate a pdf report that shows 11 different heart rate variability features,
  • enter the data from those features back into a spreadsheet (typically 660 entries),
  • manually tag whether I was clear headed or upset in a new column on the spreadsheet,
  • save that spreadsheet to CSV format,
  • copy a text version of that CSV format into the WEKA arff format,
  • use that arff formatted data to run an Artifical Neural Network in WEKA,
  • reword that WEKA data back into a prose form that said “this is how much I was upset or not”

I got pretty good results that were consistent with some academic papers I read and I had the satisfaction of learning a lot about HRV, and the process was not sustainable. I want to take readings while shooting shotguns and getting a foot massage, not spend all my time crunching data. 

To cut through that complexity and make the measuring and reading of data a small part of the experience I am settling on rMSSD as a single metric on which I am going to focus. Both the SweetBeatLIfe app and HeartRateLogger give a real time rMSSD reading and have that as an exportable feature. I can use Kubios to extract it from all the Heartmath work I have done. And I was pleased to read in an academic paper “SDNN/RMSSD as a Surrogate for LF/HF: A Revised Investigation” in Section 4.1 titled “The Epoch Aspect” that the rMSSD was a stable measurement when used in 10, 20, 30, 60, 120, 300 and 600 second readings. That means there has been some work done to support the fact that an rMSSD on 30 second increments can be reliable as long as I compare it to other 30 second increments. The study also indicates that rMSSD is a good proxy for the frequency based measurements that many of the apps use to indicate stress. 

So with my process of data collection vastly simplified I can work on refining and interpreting data given the various contexts I will be operating in. Administrative burden relieved I am off to the foot masseuse. 



Doc’s Needle Better Than Dentist Drill

Finishing off my service provider stress-off I had the opportunity to take a reading while getting shots at the Doctor. I used the Polar H7, SweetBeat Life and Kubios to pull the data together. I was quite surprised to see that getting a needle stuck in me was not nearly as stressful at having the tooth drilled, and other then the moment of anticipation prior to the jab I was quite relaxed. 


You can see at time had 2 I was anticipating the jab and the jab itself happened between 3 and 4. Afterward I was quite pleased when it was over. So looking across service providers my stress leader board looks like this:


When relaxed my average pNN50 was just a bit higher than getting a needle at the doctor. Doctors win gold, hairdressers win silver and dentists get a distant bronze. I use average pNN50 read at 30 second intervals to compare because the length of time I was in an anticipatory state and the time of treatment was different for each provider.

I can only speculate why the stress levels were not what I was expecting. I would have guessed a doctor’s jab would be nearer the dentists drill. Two factors may have influenced the readings, both related to mental state. First, the length of time was different for each. The doctor’s needle was very fast. The haircut had not pain, but it was 45 minutes long. And I was in the dentists chair for an hour during which 20 minutes was drilling. So mentally I was working on different time horizons. 

Second, the certainty of outcome and context was different. In the doctors office my wife was with me, we were joking around and discussing our upcoming trip to Vietnam. We know the doctor and the atmosphere was quite convivial. The jab was going to be quick and done. So my relaxed state was consistent with those environmental factors. The haircut was with a long time and trusted provider and sadly I had to tell him at the end I was moving from London to San Francisco and would no longer be seeing him. So the readings tail off at the end where I said goodbye. Finally, the dentist was putting in a filling “to see how it goes” with the possibility that if they drilled and found the tooth in too bad a shape more detailed, longer and painful work was going to have necessary. So the anticipation in that chair was very high stakes. 

Despite my calling this a description of the effect of the doctor and dentist, what we are actually seeing is the physiological output of my expectations. Where this journey has taken us is where it began. My interpretation of the situation fires my physiological stress. With the doctor, dentist and hairdresser I was sitting and they were using a sharp object to bring on some physical improvement. In each case my own interpretation of what was happening and what was about to happen triggered my reaction, so we continue to show that all stress has a powerful subjective element.    

Hairdresser beats Dentist in Stress-off

Taking my heart reading while getting a haircut begins to flush out the professional services stress leaderboard. Using Polar H7 heart rate strap and a new app, the Heart Rate Variability Logger by Marco Altini I captured several time domain measurements for the comparison.

In this case I used the pNN50 which is a percentage of the normal heartbeat intervals that are greater than 50 milliseconds. The intuition there is if a low percentage of your heartbeat intervals are over 50 milliseconds then your heart is beating regularly and quickly, so you are likely in an excited state. Conversely, if 30% of your heartbeats are over 50 milliseconds you have a fair bit of variability in the beats.

Here is the comparison:

Slide1The green line above is the average of my baseline when relaxed (32% pNN50) and the red line below is the stressed baseline (4.5% pNN50). These measurements are all taken over consecutive 30 second periods so I am comparing apples to apples.

The orange line shows a snapshot of the tooth drilling session at the dentist. As you can see, it closely follows the stress average. The purple line is the haircut. Much higher pNN50, averaging up around 20%. Much less stress for sure.

So though getting a haircut is not as relaxing as meditation, if you are having a bad day head over to your hairdresser for a trim. It may put you in a better mood.


Stress Reading While Firing Shotgun


On holiday last week I went to the range with my son and shot his Remington 12 gauge shotgun,  AR15 and FN SCAR. We also did a little handgun work with the M1911. It was a nice day for it. While shooting the Remington I took my heart reading using the Polar H7 strap which sent data to the Sweetwater app from which I exported the RR interval output to Kubios

Previously I had used an Artificial Neural Network (ANN) to determine my stress levels from 11 different measures that Kubios produces. Of those, the ANN told me that the Heart Rate Variability Triangularity Index (HRVTI) was the best predictor of stress level. 

My HRVTI when relaxed averaged 9.72 and when stressed averaged 5.25 so I had a range to compare my readings. Here is a graph showing the ten minute period when I was loading & shooting the 12 gauge.  



You can see from the graph that I was in a stress state through the period. The average was 4.8 versus the average of 5.2 HRVTI that I got from stress events like a trip to the dentist. So being at the range with a gun in your hand is a pretty stressful event. I think that makes sense. Not only did I have a weapon in my hand there were guns blazing all around me, so the qualitative experience was certainly one of being on high alert. 

Using the Quantified Self three prime questions I can report:

  • What did you do? Measured my stress level while shooting a 12 gauge shotgun.
  • How did you do it? See above
  • What did you learn? Blazing away with a shotgun is physiologically more stressful than having a tooth drilled. 

Machine Learning, Heart Rate Variability & Highway Congestion

Using a machine learning algorithm I had determined my baseline for relaxation and stress. When I began I had used 11 features to train the algorithm which means I used 11 sources of data that the algorithm used to try and predict a relaxed or stress sate. The WEKA software has the ability to show which of the data sources is the most useful in determining the outcome and as it did so it allowed me to narrow the features to three. All three are heart rate variability measurements in the time domain, rMSSD, pNN50 and Heart Rate Variability Triangularity Index (HRVI).

Now that I have a trained Artifical Neural Network algorithm on WEKA I can use it to look at large sets of historical data. The more immediate problem I am trying to solve is how to get an indication in real time regarding my physiological state. I want to be in a meeting and be able to see on a screen that I my system has shifted to fight/flight mode.

When I looked at the stress and relaxed data into a spreadsheet these time domain features were markedly lower when stressed, and higher when relaxed. I could use them as a real time proxy for stress if I could find the vehicle to deliver those numbers in real time. I found an iPhone app called Heart Rate Variability Logger. To use it you need a bluetooth heart rate belt and I have the Polar H7. So I was set to start testing.

As I was playing with the app last night I had to call down to the front desk of my hotel to make arrangements to catch and early flight the following morning. I was pretty relaxed prior to the call. On contacting the front desk they told me “all roads were closed” and that my journey of 20 minutes was going to take an hour. That meant a 4am wakeup. You can see when I got this news at about 40% of the way into the session (where it says 16.2):


In the baseline data that I used for the machine learning algorithm, my average pNN50 while relaxed was 32.6 and while stressed, 4.5. Here my pNN50 went from around 30 to 16. That is a pretty good indicator that news of my early wakeup stressed me out. I did some paced breathing to come out of it.

The good news is my hour long journey actually took 30 minutes so my pNN50 was in fine shape as I made my flight with plenty of time. I was also pleased that I now have a practical way to monitor my stress in real time that is backed by insights gleaned from a machine learning algorithm.

Machine Learning & Stress Prediction

Seeking a reliable way to measure when I was am in a relaxed and focussed frame of mind and when I was feeling stress I looked again at the data I had collected for several sessions. I used the data from the readings when I was getting my tooth drilled and when I was giving a speech as a reliable reading of when I was in a stress state. I also used sessions of high coherence while using Heartmath Pro as a baseline for when I was in a relaxed state. I used this as a training set which I fed into an Artificial Neural Network using a freeware package called WEKA.  

The machine learning algorithm came back with a 98.3% accuracy on the ability to classify whether I was relaxed or stressed. Now that I had an algorithm I could run it on other data to see how it looked. First I ran the data for a meeting I had with a colleague that was very positive. Running the data I was not surprised to see that I was relaxed during the majority of the session. Twice I dropped into stress in a 53 minute meeting. That was consistent with my experience. 


Running the algorithm on a second meeting gave me a different outcome. I remember the meeting well and the conversation was not combative, but the topic was more difficult. This result was more of a stress state with a four time periods where I was in Poise. Again this was consistent with my experience of the meeting. 


I cut the data in the training set and the meeting data lists into 30 second increments. This is the shortest period of time needed to get a meaningful set of heart rate variability data.  It also allows me to use my previous work in returning to Poise as a comparison. The next step is to run the algorithm on the data from different situations. 


Get every new post delivered to your Inbox.

Join 915 other followers