eurashin
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee
  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Documentation for SARA RL Algorithm ## The SARA App and Goals On the domain knowledge side, our goal is to use the SARA framework to create an app that helps undergraduates develop healthy habits for 3 possible intervention components: 1) self-monitoring, 2) sleep, 3) time management. The final decision will depend on user studies. On the reinforcement learning side, our goal is to have an online testbed for algorithms that maintain engagement in self-monitoring in mobile health. As long as we enable after study analyses (essentially we use some sort of micro-randomization, say via posterior sampling/Thompson sampling), then we should strive to develop new algorithmic/statistical ideas and try them out in real life. Our primary goal is to develop algorithmic/statistical ideas that hold promise in advancing the field of digital health. To achieve this goal we gain from the practical experience of seeing what the data streams actually look like (e.g. levels of missingness, problems due to not being able to sense the user's entire state and so on), we gain from learning about how challenging it is to do online learning in a stable manner. Our primary goal **does not** involve solving this one single RL problem with its unique set of actions and unique set of sensors/self-report data. To this end, our current directions include: 1. Provide a way for domain scientists to design their own RL algorithm 2. Allow black box predictors to prove themselves and potentially become acceptable to the domain science. Recall that a Bayesian regression model (either logistic or linear) is simply a GP model with a very simple dot product kernel. Domain scientists are very familiar with these simple GP models (they don't call them GP models--they have other names for them) so the GP framework both provides the opportunity to do (1) yet allow for more flexibility, if the data demands this, as we know that since the direct sum of kernels is a kernel (so the combination of the simple dot product kernel with a kernel that is more expressive is possible). 3. As for (2) as we have discussed, we would like to think about a variety of predictions that might be used as features in the GP model. An advantage of the embedding within the GP framework is the large coding community associated with GPytorch. We do not need to reinvent many standard algorithms. ## The RL Setup There are $N$ users in the study. The longitudinal data for a single user $\mathbf{x}_i$ where $i = 1, ..., N$ can be recorded by the following sequence: \begin{align} \mathbf{x}_i = \{S_{i,1}, A_{i,1}, ...S_{i,k}, A_{i,k}, R_{i,k}, ... S_{i,T_i}, A_{i,T_i}, R_{i,T_i}\} \end{align} Where $k$ indexes the decision $k$th decision time and $\mathbf{x}_{i, k}$ refers to the $k$th decision for user $i$. Because users arrive and exit at an asynchronous manner (not all user trajectories will be the same length), $T_i$ is the final decision time for user $i$, such that $k \in 1, ..., T_i$. The problem will be use context and be formualted either as a bandit or as something in between a bandit and an MDP. >MDP vs bandit depending on whether Sarah has early ideas about prediction distal rewards >Possibly pooling across users depending on whether Eura has early ideas. ### Action Space There will likely be one decision point per user per day. At a decision point, the RL algorithm will decide whether or not we send a notification for the user to self monitor. > We might have 2 per day for the self-monitoring intervention component. > * When should the decision points be? Constant or varying times? > [Susan] See [google doc](https://docs.google.com/document/d/1U8F91D1Mjw7_N2xguy2lfOpEk2w2_Ilxwb_p7RDY9-s/edit). * *Should we do clipping to constrain the number of messages [Kelly]?* * Would facilitate after-study analysis * Entropy--clipping but "in a softer way", encourage probability towards 0.5 * Alternatives to discuss with Sonali (week of 9/28) * Mutual information regularization * Information bottlenekcks Although the notification may take different forms from a behavioral perspective (positive, encouragement, statistic-based, personalized), from an RL perspective, we will only consider whether or not we have sent a notification at all. As a result, our action space is *binary*, where $A_{i,k} \in \{0,1\}$ for not sending or sending a notification respectively. ### Reward Following a state and action pair, the reward will indicate whether or not the user engaged in self-monitoring that evening (or within 24 hours). As a result, the reward is also binary, where $R_{i,k} \in \{0, 1\}$ for whether the user did or did not complete the survey that evening. > Participant may make a commitment intervention at baseline. For example request a committment to a certain number of times per week(set a goal)? We can explain, for example that if they do the self-monitoring x times per week then we can provide better life insights. ### State Space We are interested in features that are indicative of whether or not a notification will prompt the user to self-engage. Some of the features we have considered so far: **Contextual** * Time of day for user * Weekend or weekday? * Type of phone, year of phone * Differences between iOS/Android quality of data **Past interaction based** * App usage (distinguished between self-prompted and notification-prompted) * Past responsivity in the last $n$ days * Dosage/past interventions (how much and how) * Notification feedback (thumbs up, thumb down, none) * Prediction of impending disengagement * Answers to prior self-monitoring questions * We will select some questions that are more indicative of goal success * Features from prediction models (RNN? CNN?) trained to predict: * Impending disengagement * Variability of engagement times **Availability** * We will initially assume it is ok to provide a treatment at any of that intervention component’s decision times. ## Consderations on Modeling the Reward The reward function $r(s, a)$ in our model will ultimately let us determine whether or not to send a notification. At decision time, we will notify the user with a probability $P(a=1)$. \begin{align} P(a=1) = P(r(s, a=1) - r(s, a=0) > 0) \end{align} We will try to pool data unless Kelly needs it for a preliminary study for a grant. ### Should we consider much simpler model? #### Beta Binomial $R(s, a) \sim Bernoulli(p)$ with prior $p\sim Beta$ `1) Start R(s,a)=Bernoulli(p) with Beta prior (same p for all states and actions)` `For k in 1...T:` ` 2) Update p as we observe more state-action pairs` ` 3) At certain intervals, adaptively bin so that state-action pairs with similar p are binned together` Pros: * Simple to code Cons: * Have to discretize states (binning) * High noise #### Bayesian Logistic Regression To find the joint probability $p(y, \mathbf{x})$, we use Bayes' theorem: \begin{align} p(y, \mathbf{x}) = p(\mathbf{x})p(y|\mathbf{x}) \end{align} Where $p(y|\mathbf{x})$ can be modeled as a probability over all possible classes: \begin{align} p(C_1|\mathbf{x}) = \lambda(\mathbf{x}^\mathrm{T}\mathbf{w})\textrm{, where }\lambda(z)=\frac{1}{1 + \textrm{exp}(-z)} \end{align} *How do we choose a prior?* Pros: Cons: #### Random Forest #### Bayesian Deep Learning #### Decision Tree * See Finale's work * Can write as GP * Not very smooth #### Mixture of Experts * "Experts"=different kernels * See Sonali/Finale's work ### Gaussian Processes We propose using a Gaussian Process regression model for the reward function. \begin{align} r(s, a) = f(x) \end{align} where $x = (s, a)$. **Basic Model:Weight-Space View** \begin{align} s \rightarrow \phi(s) \rightarrow \textrm{linear regression} \end{align} * Bayesian linear regression with a kerney trick * Kernel $\phi(s)$: projection of s to some higher feature space * Domain knowledge is used to build kernel **Basic Model:Function-Space View** \begin{align} f(x) \sim GP(m(x), k(x,x')) \end{align} * GP is a distribution over functions * Kernel k(s,s') measures "similarity" between tuples * Relationship to weight-space $\phi(s)$: $k(s,s')=\phi(s)^T\sum_0\phi(s')$ ### Questions * *How often should we perform a posterior update? How do we appoach this in a principled way?* * This will depend on the timescale of the intervention * What assumptions should we make about nonstationarity? * Assuming stationarity, can update as often as you want * The data will be noisy so once a day may be too frequent (if we only have one decision point per day per user). > Susan: Bigger issue is that how does one think about this from a principled point of view? update times are akin to hyperparameters. Need to consult with Anna Li. **Additive Model (potential plan for long term)** \begin{align} f(x) \sim f^{(1)}(x)+f^{(2)}(x) + ... + f^{(D)}(x) \end{align} where $f^{(d)}(x) \sim GP(m^{(d)}(x), k^{(d)}(x, x'))$. To help with interpretability, we may consider additive GP models as in [Chang 2019](https://www.nature.com/articles/s41467-019-09785-8) and [Dvenaud 2011](https://arxiv.org/abs/1112.4394). Instead of specifying one GP for the reward function, we can specify multiple GPs. Each GP may correspond to a different grouping of our features by meaning (clinician determined features vs. additional features) or type (numerical features vs. time-based features). This formulation lets us observe the *importance* of different groupings in determining the reward (e.g. do certain features make more difference in the reward than clinician determined ones?). It also allows us to specify different kernels per grouping as necessary (e.g. we could use a periodic kernel for a time-based feature, like week, vs. a standard RBF for numeric feature, like temperature outside). **Semi-parametric Model (potential plan for long term)** \begin{align} f(x) \sim GP(m(x), k(x,x')) + (A - \pi)h(x)^T\beta \end{align} This formulation lets us consider random effects and action centering (the kernel is then the direct sum of a dot product kernel and a more complex kernel, like the squared exponential) ## Modular Algorithm Implementation The number of modules is not fixed and is open for discussion. We can change the modules to allow for best software practices and the most intuitive compartmentalization. ### Modules | Module | How often | Where | For who | | -------- | -------- | -------- | -------- | | 1: Action selection at decision time (poterior sampling) | Every decision point | On the phone or cloud | Every user individually | | 2: Updating the reward function (calculating the posterior) | ? Needs discussion | In the cloud | Pooled or individual? | | 3: Hyperparameter update | ? Needs discussion | In the cloud | Everyone at once|

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully