Skip to content

Commit

Permalink
set up gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
angerhang committed Jul 10, 2023
1 parent cc9a6ed commit 83c477b
Show file tree
Hide file tree
Showing 55 changed files with 3,826 additions and 102 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
I" {"source"=>"/Users/hangy/Dphil/code/asleep", "destination"=>"/Users/hangy/Dphil/code/asleep/_site", "collections_dir"=>"", "cache_dir"=>".jekyll-cache", "plugins_dir"=>"_plugins", "layouts_dir"=>"_layouts", "data_dir"=>"_data", "includes_dir"=>"_includes", "collections"=>{"posts"=>{"output"=>true, "permalink"=>"/:categories/:year/:month/:day/:title:output_ext"}}, "safe"=>false, "include"=>[".htaccess"], "exclude"=>[".sass-cache", ".jekyll-cache", "gemfiles", "Gemfile", "Gemfile.lock", "node_modules", "vendor/bundle/", "vendor/cache/", "vendor/gems/", "vendor/ruby/"], "keep_files"=>[".git", ".svn"], "encoding"=>"utf-8", "markdown_ext"=>"markdown,mkdown,mkdn,mkd,md", "strict_front_matter"=>false, "show_drafts"=>nil, "limit_posts"=>0, "future"=>false, "unpublished"=>false, "whitelist"=>[], "plugins"=>[], "markdown"=>"kramdown", "highlighter"=>"rouge", "lsi"=>false, "excerpt_separator"=>"\n\n", "incremental"=>false, "detach"=>false, "port"=>"4000", "host"=>"127.0.0.1", "baseurl"=>"/ssl-wearables", "show_dir_listing"=>false, "permalink"=>"date", "paginate_path"=>"/page:num", "timezone"=>nil, "quiet"=>false, "verbose"=>false, "defaults"=>[], "liquid"=>{"error_mode"=>"warn", "strict_filters"=>false, "strict_variables"=>false}, "kramdown"=>{"auto_ids"=>true, "toc_levels"=>[1, 2, 3, 4, 5, 6], "entity_output"=>"as_char", "smart_quotes"=>"lsquo,rsquo,ldquo,rdquo", "input"=>"GFM", "hard_wrap"=>false, "guess_lang"=>true, "footnote_nr"=>1, "show_warnings"=>false}, "title"=>"OxWearables SSL-wearables", "tagline"=>"Communicate your research and beyond", "paginate"=>1, "locale"=>"en", "author"=>{"name"=>"OxWearables", "url"=>"https://oxwearables.github.io/ssl-wearables/"}, "gems"=>["jekyll-paginate"], "livereload_port"=>35729, "serving"=>true, "watch"=>true, "url"=>"http://localhost:4000"}:ET
I"�{"source"=>"/Users/hangy/Dphil/code/asleep", "destination"=>"/Users/hangy/Dphil/code/asleep/_site", "collections_dir"=>"", "cache_dir"=>".jekyll-cache", "plugins_dir"=>"_plugins", "layouts_dir"=>"_layouts", "data_dir"=>"_data", "includes_dir"=>"_includes", "collections"=>{"posts"=>{"output"=>true, "permalink"=>"/:categories/:year/:month/:day/:title:output_ext"}}, "safe"=>false, "include"=>[".htaccess"], "exclude"=>[".sass-cache", ".jekyll-cache", "gemfiles", "Gemfile", "Gemfile.lock", "node_modules", "vendor/bundle/", "vendor/cache/", "vendor/gems/", "vendor/ruby/"], "keep_files"=>[".git", ".svn"], "encoding"=>"utf-8", "markdown_ext"=>"markdown,mkdown,mkdn,mkd,md", "strict_front_matter"=>false, "show_drafts"=>nil, "limit_posts"=>0, "future"=>false, "unpublished"=>false, "whitelist"=>[], "plugins"=>[], "markdown"=>"kramdown", "highlighter"=>"rouge", "lsi"=>false, "excerpt_separator"=>"\n\n", "incremental"=>false, "detach"=>false, "port"=>"4000", "host"=>"127.0.0.1", "baseurl"=>"/ssl-wearables", "show_dir_listing"=>false, "permalink"=>"date", "paginate_path"=>"/page:num", "timezone"=>nil, "quiet"=>false, "verbose"=>false, "defaults"=>[], "liquid"=>{"error_mode"=>"warn", "strict_filters"=>false, "strict_variables"=>false}, "kramdown"=>{"auto_ids"=>true, "toc_levels"=>[1, 2, 3, 4, 5, 6], "entity_output"=>"as_char", "smart_quotes"=>"lsquo,rsquo,ldquo,rdquo", "input"=>"GFM", "hard_wrap"=>false, "guess_lang"=>true, "footnote_nr"=>1, "show_warnings"=>false, "syntax_highlighter"=>"rouge", "syntax_highlighter_opts"=>{:default_lang=>"plaintext", :guess_lang=>true}, "coderay"=>{}}, "title"=>"OxWearables SSL-wearables", "tagline"=>"Communicate your research and beyond", "paginate"=>1, "locale"=>"en", "author"=>{"name"=>"OxWearables", "url"=>"https://oxwearables.github.io/ssl-wearables/"}, "gems"=>["jekyll-paginate"], "livereload_port"=>35729, "serving"=>true, "watch"=>true, "url"=>"http://localhost:4000"}:ET
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
I"<!------------------------------------------ Hyperlinks ---------------------------------------------------->
<!--- If you want to update links for your code/paper/demo, modify that in _includes/page-header.html -->
<!------------------------------------- End of hyperlinks -------------------------------------------------->

<!---------------------------------------------------------------------------------------------------------->
<!----------------------------------------- Abstract ------------------------------------------------------->
<hr />

<p style="text-align: center;">Abstract</p>
<p>
<b>Background</b>: Sleep is essential to life. Accurate measurement and classification of sleep/wake and sleep stages is important in clinical studies for sleep disorder diagnoses and in the interpretation of data from consumer devices for monitoring physical and mental well-being. Existing non-polysomnography sleep classification techniques mainly rely on heuristic methods developed in relatively small cohorts. Thus, we aimed to establish the accuracy of wrist-worn accelerometers for sleep stage classification and subsequently describe the association between sleep duration and efficiency (proportion of total time asleep when in bed) with mortality outcomes.

<br /><br />
<b>Methods</b>: We developed and validated a self-supervised deep neural network for sleep stage classification using concurrent laboratory-based polysomnography and accelerometry data from three countries (Australia, the UK, and the USA). The model was validated within-cohort using subject-wise five-fold cross-validation for sleep-wake classification and in a three-class setting for sleep stage classification {wake, rapid-eye-movement sleep (REM), non-rapid-eye-movement sleep (NREM)} and by external validation. We assessed the face validity of our model for population inference by applying the model to the UK Biobank with ~100,000 participants, each of whom wore a wristband for up to seven days. The derived sleep parameters were used in a Cox regression model to study the association of sleep duration and sleep efficiency with all-cause mortality.

<br /><br />
<b>Findings</b>: After exclusion, 1,448 participant nights of data were used to train the sleep classifier. The difference between polysomnography and the model classifications on the external validation was 34.7 minutes (95% limits of agreement (LoA): -37.8 to 107.2 minutes) for total sleep duration, 2.6 minutes for REM duration (95% LoA: -68.4 to 73.4 minutes) and 32.1 minutes (95% LoA: -54.4 to 118.5 minutes) for NREM duration. The derived sleep architecture estimate in the UK Biobank sample showed good face validity. Among 66,214 UK Biobank participants, 1,642 mortality events were observed. Short sleepers (&lt;6 hours) had a higher risk of mortality compared to participants with normal sleep duration (6 to 7.9 hours), regardless of whether they had low sleep efficiency (Hazard ratios (HRs): 1.69; 95% confidence intervals (CIs): 1.28 to 2.24 ) or high sleep efficiency (HRs: 1.42; 95% CIs: 1.14 to 1.77).

<br /><br />
<b>Interpretation</b>: Deep-learning-based sleep classification using accelerometers has a fair to moderate agreement with polysomnography. Our findings suggest that having short overnight sleep confers mortality risk irrespective of sleep continuity.

</p>
<hr />

<!--------------------------------------- End abstract ----------------------------------------------------->
<!---------------------------------------------------------------------------------------------------------->

<!---------------------------------------------------------------------------------------------------------->
<!------------------------------------------ Main body ------------------------------------------------------>
<h1 id="study-design">Study design</h1>
<p><strong>We developed a foundation model for human activity recognition (HAR) using self-supervision. The pre-trained model is available to build high-performance human activity classifiers using accelerometer data.</strong></p>

<p><img src="assets/ssl_diagram.png" alt="alt text" title="Overview" /></p>

<h1 id="results">Results</h1>

<h3 id="agreement-between-the-sleepnet-and-the-ground-truth-polysomnography">Agreement between the SleepNet and the ground truth polysomnography</h3>
<p><img src="assets/baseline.png" alt="alt text" title="limited_subject" /></p>

<h3 id="self-supervised-pre-training-out-performs-supervised-pre-training">Self-supervised pre-training out-performs supervised pre-training</h3>
<p><img src="assets/transfer.png" alt="alt text" title="limited_subject" /></p>

<h3 id="sleep-variations-in-the-uk-biobank">Sleep variations in the UK Biobank</h3>
<p><img src="assets/subject.png" alt="alt text" title="limited_subject" /></p>

<h3 id="short-sleep-duration-is-associated-with-mortality-regardless-of-sleep-efficiency">Short sleep duration is associated with mortality regardless of sleep efficiency</h3>
<p><img src="assets/visu.png" alt="alt text" title="cluster" /></p>

<h2 id="bibliography">Bibliography</h2>

<div class="language-tex highlighter-rouge"><div class="highlight"><pre class="highlight"><code>@article <span class="p">{</span>Yuan2023.07.07.23292251,
author = <span class="p">{</span>Hang Yuan and Tatiana Plekhanova and Rosemary Walmsley and Amy C. Reynolds and Kathleen J. Maddison and Maja Bucan and Philip Gehrman and Alex Rowlands and David W. Ray and Derrick Bennett and Joanne McVeigh and Leon Straker and Peter Eastwood and Simon D. Kyle and Aiden Doherty<span class="p">}</span>,
title = <span class="p">{</span>Self-supervised learning of accelerometer data provides new insights for sleep and its association with mortality<span class="p">}</span>,
elocation-id = <span class="p">{</span>2023.07.07.23292251<span class="p">}</span>,
year = <span class="p">{</span>2023<span class="p">}</span>,
doi = <span class="p">{</span>10.1101/2023.07.07.23292251<span class="p">}</span>,
publisher = <span class="p">{</span>Cold Spring Harbor Laboratory Press<span class="p">}</span>,
URL = <span class="p">{</span>https://www.medrxiv.org/content/early/2023/07/08/2023.07.07.23292251<span class="p">}</span>,
eprint = <span class="p">{</span>https://www.medrxiv.org/content/early/2023/07/08/2023.07.07.23292251.full.pdf<span class="p">}</span>,
journal = <span class="p">{</span>medRxiv<span class="p">}</span>
<span class="p">}</span>
</code></pre></div></div>

<h2 id="acknowledgement">Acknowledgement</h2>

<blockquote>
<p>We would like to thank all the study participantsand collaborators</p>
</blockquote>
:ET
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
I"(!<!------------------------------------------ Hyperlinks ---------------------------------------------------->
<!--- If you want to update links for your code/paper/demo, modify that in _includes/page-header.html -->
<!------------------------------------- End of hyperlinks -------------------------------------------------->

<!---------------------------------------------------------------------------------------------------------->
<!----------------------------------------- Abstract ------------------------------------------------------->
<hr />

<p style="text-align: center;">Abstract</p>
<p>
<b>Background</b>: Sleep is essential to life. Accurate measurement and classification of sleep/wake and sleep stages is important in clinical studies for sleep disorder diagnoses and in the interpretation of data from consumer devices for monitoring physical and mental well-being. Existing non-polysomnography sleep classification techniques mainly rely on heuristic methods developed in relatively small cohorts. Thus, we aimed to establish the accuracy of wrist-worn accelerometers for sleep stage classification and subsequently describe the association between sleep duration and efficiency (proportion of total time asleep when in bed) with mortality outcomes.

<br /><br />
<b>Methods</b>: We developed and validated a self-supervised deep neural network for sleep stage classification using concurrent laboratory-based polysomnography and accelerometry data from three countries (Australia, the UK, and the USA). The model was validated within-cohort using subject-wise five-fold cross-validation for sleep-wake classification and in a three-class setting for sleep stage classification {wake, rapid-eye-movement sleep (REM), non-rapid-eye-movement sleep (NREM)} and by external validation. We assessed the face validity of our model for population inference by applying the model to the UK Biobank with ~100,000 participants, each of whom wore a wristband for up to seven days. The derived sleep parameters were used in a Cox regression model to study the association of sleep duration and sleep efficiency with all-cause mortality.

<br /><br />
<b>Findings</b>: After exclusion, 1,448 participant nights of data were used to train the sleep classifier. The difference between polysomnography and the model classifications on the external validation was 34.7 minutes (95% limits of agreement (LoA): -37.8 to 107.2 minutes) for total sleep duration, 2.6 minutes for REM duration (95% LoA: -68.4 to 73.4 minutes) and 32.1 minutes (95% LoA: -54.4 to 118.5 minutes) for NREM duration. The derived sleep architecture estimate in the UK Biobank sample showed good face validity. Among 66,214 UK Biobank participants, 1,642 mortality events were observed. Short sleepers (&lt;6 hours) had a higher risk of mortality compared to participants with normal sleep duration (6 to 7.9 hours), regardless of whether they had low sleep efficiency (Hazard ratios (HRs): 1.69; 95% confidence intervals (CIs): 1.28 to 2.24 ) or high sleep efficiency (HRs: 1.42; 95% CIs: 1.14 to 1.77).

<br /><br />
<b>Interpretation</b>: Deep-learning-based sleep classification using accelerometers has a fair to moderate agreement with polysomnography. Our findings suggest that having short overnight sleep confers mortality risk irrespective of sleep continuity.

</p>
<hr />

<!--------------------------------------- End abstract ----------------------------------------------------->
<!---------------------------------------------------------------------------------------------------------->

<!---------------------------------------------------------------------------------------------------------->
<!------------------------------------------ Main body ------------------------------------------------------>
<p>All the models developed in this project has been made avaliable</p>
<h2 id="using-the-pre-trained-model">Using the pre-trained model</h2>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">torch</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="n">np</span>

<span class="n">repo</span> <span class="o">=</span> <span class="s">'OxWearables/ssl-wearables'</span>
<span class="n">harnet10</span> <span class="o">=</span> <span class="n">torch</span><span class="p">.</span><span class="n">hub</span><span class="p">.</span><span class="n">load</span><span class="p">(</span><span class="n">repo</span><span class="p">,</span> <span class="s">'harnet10'</span><span class="p">,</span> <span class="n">class_num</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">pretrained</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>

<span class="n">x</span> <span class="o">=</span> <span class="n">np</span><span class="p">.</span><span class="n">random</span><span class="p">.</span><span class="n">rand</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">300</span><span class="p">)</span>
<span class="n">x</span> <span class="o">=</span> <span class="n">torch</span><span class="p">.</span><span class="n">FloatTensor</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
<span class="n">harnet10</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
</code></pre></div></div>

<h1 id="study-design">Study design</h1>
<p><strong>We developed a foundation model for human activity recognition (HAR) using self-supervision. The pre-trained model is available to build high-performance human activity classifiers using accelerometer data.</strong></p>

<p><img src="assets/ssl_diagram.png" alt="alt text" title="Overview" /></p>

<h1 id="results">Results</h1>

<h3 id="agreement-between-the-sleepnet-and-the-ground-truth-polysomnography">Agreement between the SleepNet and the ground truth polysomnography</h3>
<p><img src="assets/baseline.png" alt="alt text" title="limited_subject" /></p>

<h3 id="self-supervised-pre-training-out-performs-supervised-pre-training">Self-supervised pre-training out-performs supervised pre-training</h3>
<p><img src="assets/transfer.png" alt="alt text" title="limited_subject" /></p>

<h3 id="sleep-variations-in-the-uk-biobank">Sleep variations in the UK Biobank</h3>
<p><img src="assets/subject.png" alt="alt text" title="limited_subject" /></p>

<h3 id="short-sleep-duration-is-associated-with-mortality-regardless-of-sleep-efficiency">Short sleep duration is associated with mortality regardless of sleep efficiency</h3>
<p><img src="assets/visu.png" alt="alt text" title="cluster" /></p>

<h2 id="bibliography">Bibliography</h2>

<div class="language-tex highlighter-rouge"><div class="highlight"><pre class="highlight"><code>@article <span class="p">{</span>Yuan2023.07.07.23292251,
author = <span class="p">{</span>Hang Yuan and Tatiana Plekhanova and Rosemary Walmsley and Amy C. Reynolds and Kathleen J. Maddison and Maja Bucan and Philip Gehrman and Alex Rowlands and David W. Ray and Derrick Bennett and Joanne McVeigh and Leon Straker and Peter Eastwood and Simon D. Kyle and Aiden Doherty<span class="p">}</span>,
title = <span class="p">{</span>Self-supervised learning of accelerometer data provides new insights for sleep and its association with mortality<span class="p">}</span>,
elocation-id = <span class="p">{</span>2023.07.07.23292251<span class="p">}</span>,
year = <span class="p">{</span>2023<span class="p">}</span>,
doi = <span class="p">{</span>10.1101/2023.07.07.23292251<span class="p">}</span>,
publisher = <span class="p">{</span>Cold Spring Harbor Laboratory Press<span class="p">}</span>,
URL = <span class="p">{</span>https://www.medrxiv.org/content/early/2023/07/08/2023.07.07.23292251<span class="p">}</span>,
eprint = <span class="p">{</span>https://www.medrxiv.org/content/early/2023/07/08/2023.07.07.23292251.full.pdf<span class="p">}</span>,
journal = <span class="p">{</span>medRxiv<span class="p">}</span>
<span class="p">}</span>
</code></pre></div></div>

<h2 id="acknowledgement">Acknowledgement</h2>

<blockquote>
<p>We would like to thank all the study participants and collaborators and also Novo Nordisk for providing the primary funding for this project.</p>
</blockquote>
:ET
Loading

0 comments on commit 83c477b

Please sign in to comment.