Adversarial Unsupervised Representation Learning for Activity Time-Series
Extracted source text ยท arXiv 1811.06847
%File: formatting-instruction.tex
\documentclass[letterpaper]{article}
\usepackage{aaai}
%\nocopyright
\usepackage{times}
\usepackage{helvet}
\usepackage{courier}
\frenchspacing
\setlength{\pdfpagewidth}{8.5in}
\setlength{\pdfpageheight}{11in}
\pdfinfo{
/Title (Adversarial Unsupervised Representation Learning for Activity Time-Series)
/Author (Karan Aggarwal, Shafiq Joty, Luis Fernandez-Luque, Jaideep Srivastava)
}
\setcounter{secnumdepth}{0}
% The file aaai.sty is the style file for AAAI Press
% proceedings, working notes, and technical reports.
%
\setlength\titlebox{2in}
\usepackage{booktabs} % For formal tables
\pdfoutput=1
\usepackage{times} %Required
\usepackage{helvet} %Required
\usepackage{courier} %Required
%\usepackage[hyphens]{url} %Required
\usepackage{graphicx} %Required
\usepackage{mathtools}
\usepackage{booktabs}
\usepackage{color}
\usepackage{hyperref}
\usepackage{dblfloatfix}
%\usepackage{subfig}
\usepackage{etoolbox}
\usepackage{calc}
\usepackage{xcolor}
%\usepackage{algorithmic}
\usepackage[ruled, noline, longend, linesnumbered, boxed]{algorithm2e}
\usepackage{mdwlist}
\usepackage[skins]{tcolorbox}
\input{my_macro}
%\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
% T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\begin{document}
\title{Adversarial Unsupervised Representation Learning for Activity Time-Series}
\author{Karan Aggarwal\textsuperscript{1}, Shafiq Joty\textsuperscript{2}, Luis Fernandez-Luque\textsuperscript{3}, Jaideep Srivastava\textsuperscript{1}\\
\textsuperscript{1}University of Minnesota, \textsuperscript{2}Nanyang Technological University, \textsuperscript{3}Qatar Computing Research Institute \\
aggar081@umn.edu, srjoty@ntu.edu.sg, lluque@hbku.edu.qa, srivasta@umn.edu\\
}
\maketitle
\begin{abstract}
Sufficient physical activity and restful sleep play a major role in the prevention and cure of many chronic conditions. Being able to proactively screen and monitor such chronic conditions would be a big step forward for overall health. %It is not a trivial task to understand their impact on chronic conditions.
%Currently, data from electronic health records (EHRs), sleep lab studies and activity/sleep logs are used. A person is most likely to visit the clinic after showing some symptoms or recommendations.
The rapid increase in the popularity of wearable devices provides a significant new source, making it possible to track the user's lifestyle real-time. %With long wait-times in clinics for screening, this new lifestyle data source can be utilized to help in chronic condition screening. %Additionally, there's a potential to complement the clinical data with wearables data for longitudinal tracking of the subjects. Disorder label data is available only for a fraction of subjects, along with unrepresentative subject populations. Therefore, unsupervised learning techniques are warranted that have been used successfully in a variety of domains. %Applying deep learning methods for wearables data provide a new opportunity to overcome this barrier.
In this paper, we propose a novel unsupervised representation learning technique called \acttovec\ that learns and ``summarizes" the discrete-valued activity time-series. It learns the representations with three components: \Ni the co-occurrence and magnitude of the activity levels in a time-segment, \Nii neighboring context of {the} time-segment, and \Niii {promoting} subject-invariance with adversarial training. %\red{Additionally, our learned representations can be exploited in a semi-supervised framework, unlike the traditional time-series models.} %These components contain ordinal, smoothing, and adversarial losses
We evaluate our method on four disorder prediction tasks using linear classifiers. Empirical evaluation
demonstrates that our proposed method scales and performs
better than many strong baselines. The adversarial
regime helps improve the generalizability of our representations by promoting subject invariant features. We also show that using the representations at the level of a day works the best since human activity is structured in terms of daily routines. %Our unsupervised representation learning method can be used as pre-trained embeddings to boost the performance of deep learning models based on the activity data, especially in case of partial availability of labels for the downstream tasks.
\end{abstract}
%
% The code below should be generated by the tool at
% http://dl.acm.org/ccs.cfm
% Please copy and paste the code instead of the example below.
%
%\maketitle
%\renewcommand{\shortauthors}{\textcolor{red}{Confidential Copy. DO NOT DISTRIBUTE}}
%\input{samplebody-conf}
\section{Introduction}
\label{sec:intro}
\input{sections/introduction.tex}
\section{Related Work} \label{sec:rel}
\input{sections/related.tex}
%\section{Problem Statement} \label{sec:problem}
%\input{problemstatement.tex}
\section{Our Approach} \label{sec:model}
\input{sections/model.tex}
\section{Experimental Settings} \label{sec:settings}
\input{sections/settings.tex}
\section{Results and Discussion} \label{sec:results}
\input{sections/results.tex}
\section{Conclusions} \label{sec:conclusion}
\input{sections/conclusions.tex}
\balance
\bibliographystyle{aaai}
{\bibliography{references}}
\end{document}
\begin{table}[tp]
\renewcommand{\arraystretch}{0.9}
\caption{\textbf{Acc}uracy, \textbf{Pre}cision, \textbf{Rec}all, \textbf{Spec}ificity, and $\mathbf{F_1}$ values for \textbf{Sleep-Apnea} prediction for each method.}
\label{ApneaResults}
\centering
\vspace*{-0.3\baselineskip}
\resizebox{\columnwidth}{!}{%
\begin{tabular}%{|C{1.6cm}|C{1.35cm}|C{1.31cm}|C{1cm}|C{1.51cm}|C{0.8cm}|}
{l|l|ccccc}
\toprule
Method & Clf. & Acc. & Pre. & Rec. & Spec. & $F_{1}$ \\
\midrule
\texttt{Majority} & 0-R & 74.6 & 00.0 & 00.0 & 100.0 & 00.0\\
\texttt{Random} & & 50.0 & 25.6 & 50.0 & 50.0 & 33.9 \\
\midrule
% \hline
\texttt{SAX-VSM} & & 74.6 & 00.0 & 00.0 & \emph{100.0} & 00.0 \\
%\texttt{CBoW} & 0.50 & 1.00 & 1.00 & 0.66\\
\texttt{BOSS} & & 70.4 & 30.0 & 12.5 & 90.1 & 17.6\\
\texttt{BOSSVS} & & 68.2& 20.0 & 8.3 & 88.6 & 11.7\\
\texttt{HCTSA} & LR & 66.1 & 26.7 & 16.3 & 83.9 & 20.3\\
\texttt{Task-specific} & {CNN} & 55.3 & 31.0 & 62.8 & 52.7 & 41.5\\
\midrule
\sampletovec & LR & 50.0 & 27.8 & 54.0 & 48.5 & 36.7\\
\hourtovec & LR & 70.3 & 46.1 & 22.2 & 89.6 & 30.0\\
\hourtovecreg & LR & 71.4 & 36.8 & 14.3 & 91.4 & 20.5\\
\daytovec & {LR} & 61.9 & 32.8 & 42.0 & 69.1 & 36.8\\
\daytovecreg & {LR} & 65.1 & 39.6 & 38.2 & 76.1 & \textbf{38.9}\\
%\daytovecreg & {NB} & 61.3 & 38.3 & \emph{57.4} & 62.9 & \textbf{45.9}\\
\weektovec & {LR} & \emph{75.1} & \emph{57.1} & 8.3 & 97.9 & 14.5 \\ \midrule
%\texttt{Task-spec} & {CNN} & 55.3 & 31.0 & 62.8 & 52.7 & 41.5\\
%\texttt{Task-spec+Pre} & {CNN} & 68.2 & 39.6 & 47.5 & 75.4 & 43.2\\
\pbox{20cm}{\texttt{\daytovecreg+Order}} & {LR} & 62.1 & 33.2 & 51.9 & 72.1 & 40.5\\
\pbox{20cm}{\texttt{\daytovecreg+Order}\\ +\texttt{Adversary}} & {LR} & 62.6 & 38.3 & 50.6 & 71.1 & \textbf{43.6}\\\bottomrule
\end{tabular}
}
%\vspace{-0.5em}
\end{table}
\begin{table}[b!]
\renewcommand{\arraystretch}{0.9}
\caption{ \textbf{Pre}cision (weighted), \textbf{Rec}all (weighted), $F_1$ values (weighted), and $F_1$-micro scores for the three class classification --- non-diabetic, pre-diabetic, and diabetic --- of \textbf{diabetes} prediction for each methods. }
\label{diabResults}
\centering
\vspace*{-0.3\baselineskip}
\resizebox{\columnwidth}{!}{%
\begin{tabular}{l|l|cccc}
\midrule
Method & Clf. & Pre. & Rec. & $F_{1}$-macro & $F_{1}$-micro \\
\midrule
\texttt{Majority} & 0-R & 23.7 & 48.7 & 21.7 & 31.9 \\
\texttt{Random} & & 37.7 & 33.3 & 33.3 & 33.3 \\
\midrule
%\hline
\texttt{SAX-VSM} & & 34.4 & 43.9 & 38.6 & 24.3 \\
% \texttt{CBoW} & 0.50 & 1.00 & 1.00 & 0.66\\
\texttt{BOSS} & & 39.1 & 38.8 & 38.9 & 31.5 \\
\texttt{BOSSVS} & & 39.6 & 40.7 & 40.1 & 32.7 \\
\texttt{HCTSA} & LR & 39.6 & 40.9 & 40.0 & 35.0 \\
\texttt{Task-specific} & {CNN} & 40.0 & \emph{51.4} & 45.2 & 41.0\\
\midrule
\sampletovec & LR & 41.2 & 38.9 & 40.0 & 36.7 \\
\hourtovec & LR & 39.5 & 44.4 & 41.4 & 33.3\\
\hourtovecreg & LR & 40.8 & 43.9 & 42.1 & 32.0 \\
\daytovec & LR & 41.2 & 40.7 & 40.9 & 38.0\\
\daytovecreg & LR & 44.7 & 40.7 & 41.8 & \textbf{39.5}\\
%\daytovecreg & NB & 43.5 & 39.2 & 40.6 & 36.5\\
\weektovec & {LR} & 40.8 & 44.4 & 40.6 & 34.1\\
\midrule
%\texttt{Task-spec} & {CNN} & 40.0 & \emph{51.4} & 45.2 & 41.0\\
% \texttt{Task-spec+Pre} & {CNN} & 45.8 & 46.4 & 44.6 & 41.7 \\
\pbox{20cm}{\texttt{\daytovecreg+Order}} & {LR} & 41.4 & 51.1 & 45.3 & 40.2\\
\pbox{20cm}{\texttt{\daytovecreg+Order}\\ +\texttt{Adversary}} & {LR} & \emph{45.9} & 46.7 & \emph{45.8} & \textbf{42.5}\\\bottomrule
\end{tabular}
}
\end{table}
\begin{table}[t!]
%\vspace{-1em}
\renewcommand{\arraystretch}{0.9}
\caption{ \textbf{Pre}cision (weighted), \textbf{Rec}all (weighted), $F_1$ (weighted), and $F_1$-micro scores for three class classification --- no-insomnia, pre-insomnia, and (moderate+severe) insomnia --- of \textbf{insomnia} prediction.}
\label{insomniaResults}
\centering
\vspace*{-0.3\baselineskip}
\resizebox{\columnwidth}{!}{%
\begin{tabular}{l|l|cccc}
\midrule
Method & Clf. & Pre. & Rec. & $F_{1}$-macro & $F_{1}$-micro \\
\midrule
\texttt{Majority} & 0-R & 38.3 & 61.9 & 47.4 & 25.5\\
\texttt{Random} & & 46.6 & 33.3 & 33.3 & 33.3 \\
\midrule
%\hline
\texttt{SAX-VSM} & & 38.3 & 61.9 & 47.4 & 25.5 \\
% \texttt{CBoW} & 0.50 & 1.00 & 1.00 & 0.66\\
\texttt{BOSS} & & 47.6 & 52.2 & 49.8 & 34.9 \\
\texttt{BOSSVS} & & 45.2 & 50.1& 47.5 & 33.1 \\
\texttt{HCTSA} & LR & 45,1 & 49.5 & 46.7 & 33.7 \\
\texttt{Task-specific} & {CNN} & 50.9 & 50.6 & 50.7 & 40.1\\ \midrule
\sampletovec & LR & 41.6 & 43.9 & 42.4 & 35.3\\
\hourtovec & LR & 42.5 & 52.4 & 44.6 & 28.5\\
\hourtovecreg & LR & 39.8 & 51.3 & 43.5 & 28.7 \\
\daytovec & LR & 46.2 & 44.4 & 45.2 & 35.8 \\
\daytovecreg & LR & 47.9 & 45.5 & 46.6 & \textbf{39.7}\\
%\daytovecreg & NB & 48.2 & 39.2 & 40.8 & 33.3\\
\weektovec & {LR} & 51.5 & 55.0 & 44.2 & 31.5\\\midrule
\texttt{\daytovecreg+Order} & {LR} & 51.2 & 50.6 & 50.9 & 40.3\\
\pbox{20cm}{\texttt{\daytovecreg+Order}\\ +\texttt{Adversary}} & {LR} & 54.3 & 59.7 & 55.7 & \textbf{41.4} \\\bottomrule
%\texttt{Sig2Vec + \newline Reg} & 0.50 & 1.00 & \\ \hline
\end{tabular}
}
\end{table}
\begin{table}[b!]
\renewcommand{\arraystretch}{0.9}
\caption{\textbf{Acc}uracy, \textbf{Pre}cision, \textbf{Rec}all, \textbf{Spec}ificity, and $\mathbf{F_1}$ values for \textbf{Hypertension} prediction for each method.}
\label{hyperResults}
\centering
\vspace*{-0.3\baselineskip}
\resizebox{\columnwidth}{!}{%
\begin{tabular}%{|C{1.6cm}|C{1.35cm}|C{1.31cm}|C{1cm}|C{1.51cm}|C{0.8cm}|}
{l|l|ccccc}
\toprule
Method & Clf. & Acc. & Pre. & Rec. & Spec. & $F_{1}$ \\
\midrule
\texttt{Majority} & 0-R & 74.9 & 00.0 & 00.0 & 100.0 & 00.0\\
\texttt{Random} & & 50.0 & 25.1 & 50.0 & 50.0 & 33.4 \\
\midrule
%\hline
\texttt{SAX-VSM} & & 74.9 & 0.00 & 0.00 & \emph{100.0} & 0.00 \\
% \texttt{CBoW} & 0.50 & 1.00 & 1.00 & 0.66\\
\texttt{BOSS} & & \emph{69.9} & 35.2 & 25.5 & 84.5 & 29.6\\
\texttt{BOSSVS} & & 69.9 & 36.1 & 27.7 & 83.8 & 31.3\\
\texttt{HCTSA} & LR & 61.8 & 28.6 & 17.9 & 80.8 & 22.0\\
\texttt{Task-specific} & {CNN} & 69.4 & 44.1 & 31.2 & 84.4 & 36.6\\
\midrule
\sampletovec & LR & 51.3 & 33.3 & 48.3 & 52.7 & 39.5\\
\hourtovec & LR & 68.2 & 36.7 & 18.4 & 87.4 & 24.4 \\
\hourtovecreg & LR & 68.2 & 36.0 & 17.0 & 88.2 & 23.1 \\
\daytovec & LR & 60.8 & 39.1 & 41.7 & 69.8 & 40.3\\
\daytovecreg & LR & 68.2 & 41.8 & 45.0 & 76.8 & \textbf{43.4}\\
%\daytovecreg & NB & 59.3 & 38.0 & \emph{56.1} & 60.6 & \textbf{45.3}\\
\weektovec & {LR} & 67.7 & \emph{58.3} & 11.1 & 96.0 & 18.7 \\
\midrule
%\texttt{Task-spec} & {CNN} & 69.4 & 44.1 & 31.2 & 84.4 & 36.6\\
%\texttt{Task-spec+Pre} & {CNN} & 65.8 & 39.1 & 37.5 & 77.0 & 38.3\\
\pbox{20cm}{\texttt{\daytovecreg+Order}} & {LR} & \emph{71.2} & 40.7 & 46.9 & 79.3 & 43.6\\
\pbox{20cm}{\texttt{\daytovecreg+Order}\\ +\texttt{Adversary}} & {LR} & 60.6 & 40.2 & \emph{48.8} & 70.5 & \textbf{44.1}\\\bottomrule
\end{tabular}
}
% \vspace{-1em}
\end{table}
% DEFINITIONS of the paper (use \newcommand instead of \def)
\usepackage{xspace}
\usepackage{latexsym}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{color}
\usepackage{colortbl}
\usepackage{epsfig}
\usepackage{graphicx}
\usepackage{pbox}
\usepackage{array,multirow,graphicx}
%\usepackage{subfigure}
\usepackage{paralist}
\usepackage{enumerate}
%\usepackage{enumitem}
%\usepackage[table]{xcolor}
%\usepackage[all]{xy}
\usepackage[color,matrix,arrow,all]{xy}
%\usepackage{cite}
\usepackage{comment}
\usepackage{booktabs}
\usepackage{balance}
\usepackage{stmaryrd}
\usepackage{pifont}
\usepackage{hhline}
%\usepackage{mathabx}
\usepackage{listings}
\usepackage{array}
\usepackage{float}
\usepackage[flushleft]{threeparttable}
\usepackage{graphicx,wrapfig,lipsum}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{subcaption}
\usetikzlibrary{arrows}
%\setlength{\parskip}{0pt}
%\setlength{\parsep}{0pt}
%\setlength{\headsep}{0pt}
%\setlength{\topskip}{0pt}
%\setlength{\topmargin}{0pt}
%\setlength{\topsep}{0pt}
%\setlength{\partopsep}{0pt}
%\linespread{0.95}
\DeclareMathAlphabet{\pazocal}{OMS}{zplm}{m}{n}
\usepackage{array}
\newcolumntype{M}{>{\begin{varwidth}{2cm}}l<{\end{varwidth}}}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
%%% colors
\newcommand{\final}[1]{\textcolor{black}{#1}}
\newcommand{\warning}[1]{\textcolor{red}{#1}}
%\newcommand{\new}[1]{\textcolor{blue}{#1}}
%\newcommand{\new}[1]{\textcolor{black}{#1}}
%% abbr
\newcommand{\ie}{{\em i.e.,}\xspace}
\newcommand{\eg}{{\em e.g.,}\xspace}
\newcommand{\wrt}{\emph{w.r.t.}\xspace}
\newcommand{\aka}{\emph{a.k.a.}\xspace}
\newenvironment{noindlist}
{\begin{list}{\labelitemi}{\leftmargin=0em \itemindent=1em}}
{\end{list}}
\newcommand{\red}[1]{\textcolor{red}{#1}}
\newcommand{\blue}[1]{\textcolor{blue}{#1}}
\newenvironment{noindenumerate}
{\begin{enumerate}{\labelitemi}{\leftmargin=0em \itemindent=1em}}
{\end{enumerate}}
%%% inline lists
\newcommand{\Ni}{({\em i})~}
\newcommand{\Nii}{({\em ii})~}
\newcommand{\Niii}{({\em iii})~}
\newcommand{\NI}{({1})~}
\newcommand{\NII}{({2})~}
\newcommand{\NIII}{({3})~}
\newcommand{\Niv}{({\em iv})~}
\newcommand{\Nv}{({\em v})~}
\newcommand{\Nvi}{({\em vi})~}
\newcommand{\Na}{({\em a})~}
\newcommand{\Nb}{({\em b})~}
\newcommand{\Nc}{({\em c})~}
\newcommand{\acttovec}{\emph{activity2vec}}
\newcommand{\sampletovec}{\texttt{sample2vec}}
\newcommand{\hourtovec}{\texttt{hour2vec}}
\newcommand{\daytovec}{\texttt{day2vec}}
\newcommand{\weektovec}{\texttt{week2vec}}
\newcommand{\doctovec}{\texttt{doc2vec}}
\newcommand{\wordtovec}{\texttt{word2vec}}
\newcommand{\sampletovecreg}{\texttt{sample2vec+Reg}}
\newcommand{\hourtovecreg}{\texttt{hour2vec+Reg}}
\newcommand{\daytovecreg}{\texttt{day2vec+Reg}}
\DeclareMathOperator \real{\mathbb{R}}
\newcommand{\srccon}{({\em $S_i$})~}
\newcommand{\Ls}{\mathcal{L}}
\newcommand{\Lb}{\pazocal{L}}
\newcommand{\Ns}{\pazocal{N}}
\newcommand{\Vs}{\pazocal{V}}
\newcommand{\Os}{\pazocal{O}}
\newcommand{\Js}{\pazocal{J}}
\newcommand{\Us}{\pazocal{U}}
\newcommand{\As}{\pazocal{A}}
\newcommand{\Cs}{\pazocal{C}}
\newcommand{\Ds}{\pazocal{D}}
\newcommand{\Es}{\pazocal{E}}
\newcommand{\Gs}{\pazocal{G}}
\newcommand{\Ks}{\pazocal{K}}
\newcommand{\Rs}{\pazocal{R}}
\newcommand{\ph}{\mathbf{\Phi}}
\newcommand\norm[1]{\left\lVert#1\right\rVert}
%\interdisplaylinepenalty=2500
%\clubpenalty = 10000
% \widowpenalty = 100000
% \displaywidowpenalty = 10000
%\setlength{\abovedisplayskip}{2pt}
%\setlength{\belowdisplayskip}{2pt}
%\interlinepenalty=-100
\vspace{-0.25em}
Physical activity and sleep are crucial to health and wellbeing. Requisite activity and sufficient sleep prevent various illnesses such as diabetes and depression~\cite{warburton2006health}. Rise in chronic conditions, mainly due to aging and unhealthy lifestyles, is putting our healthcare system under stress.
% with long waiting times leading to a delayed delivery of services. %It is widely accepted that a combination of a healthy lifestyle, and an early-detection approach to illnesses, has the best chance of addressing the twin challenges of health quality and healthcare cost~\cite{shelgikar2014multidisciplinary}. %~\cite{some Obamacare citation goes here}.
%Clearly this requires action from both sides, namely, the populace needs to become more health conscious, and the healthcare system needs to become more prevention-oriented. %While far from reaching a satisfactory level by any measure, increasing popularity of healthy foods and exercise/fitness regimes, especially among the younger generation, shows that the populace is becoming aware.
%With an increasingly health-conscious populace, healthcare system have an opportunity to take a more proactive approach towards health and wellness.%completing the other half.% of a positive virtuous cycle of mutual responsibility.
%A specific example is the rapidly increasing popularity of various kinds of wearable devices like Fitbit, which collect detailed data about the body's movements.%, pulse rate, breathing rate, blood pressure. on a continuous basis.
In the current approach to sleep-disorder screening subjects have to go through different diagnosis steps, involving questionnaires and \emph{polysomnography} (PSG). With increasing popularity of wearable devices like \textit{Fitbit}, which collect detailed data about the body's movements, there is an increased interest in using actigraphy for detecting sleep-related disorders and tracking longitudinal changes in the subject's condition. Although much lower fidelity than clinical devices, availability of wearables provides a novel opportunity, owing to its non-intrusive and real-time capabilities; specifically, if we can develop techniques to extract information from the vast amounts of body-monitoring data. Such techniques could be useful to assist healthcare professionals as well as help monitor behavioral therapy, e.g., exercise. \emph{This application is an essential motivation of this work.}
%With this motivation, we focus on sleep medicine in this work. Since the quality of sleep and physical activity patterns are known to be related to common disorders like diabetes, in principle we can expect to use actigraphy data for screening such conditions. \emph{In this work, we focus on presenting a method for screening the subjects for potential health disorders from their actigraphy data}.
%Health-care professionals also have to rely on patient's subjective feedback to understand health-related behaviors such as sleep or physical activity for the questionnaires. Problems with memory recall have raised interests in using wearables to study sleep and physical activity better. With an enormous increase in the popularity of fitness wearables~\cite{wmarket}, we now can track a subject's routine in real-time, providing access alike to patients and health-care providers. % --- with a major sleep disorder, obstructive sleep apnea syndrome --- alone costing \$87 billion per year in estimated productivity loss~\cite{apnea,watson2016health}. %Current diagnosis approach involves conducting \emph{polysomnography} (PSG) during an overnight stay in a sleep lab, with multiple sensors attached to the subject's body. %Physical activity is often mediated by other factors, for example, people living with chronic conditions such as cancer \cite{bower2014cancer} and diabetes \cite{jensen2017fatigue} often suffer extreme tiredness (aka fatigue) which can result on low physical activity tolerance. The fatigue can also be exacerbated by diagnoses such as depression or even be a side effect of certain drugs. Another important factor is sleep. %Despite there is a significant amount of evidence on the health benefits of physical activity and good sleep quality, we don't know much the interplaying factors between those behaviors and health outcomes. One of the main reason is that many of those studies do rely on asking the patients, which poses challenges with regards of recall and also questions are asked with a very broad granularity (e.g. weekly or daily questions).
%such an automatic screening system could be beneficial in health-care for identifying subjects at risk, monitor therapy compliance, and provide real-time recommendations.
%Often, these connected devices are integrated with an ecosystem where data like weight and blood pressure is also available, thanks to other consumer health devices.
%The wearables market hit \$14 billion in 2016 and is expected to rise to \$34 billion by 2020 \cite{wmarket}. With over 411 million expected shipments in 2020, a significant proportion of the population, at least in the high-income countries, can be expected to possess wearables. %Hence, we are on a cusp of a new paradigm with an opportunity for real-time monitoring by using the activity signals for various aspects of health, including accessing the risk of serious conditions, their diagnosis, recommendations of therapy, and their monitoring, among others.
%An automated tracking system that collects human activity signals from wearable devices in real-time, mines the activity patterns to extract relevant information, can go a long way for health-care delivery. Such system can reduce the waiting times by helping in identifying subjects at risk, monitor their compliance during therapy, and provide real-time recommendations based on consumer's behavior~\cite{yom2017encouraging}. This has the potential to provide significant savings in health-care costs, and improved lifestyle due to early detection of potentially debilitating conditions.
%offers new opportunities to gain more details insights of those essential human behaviors, but analyzing time-series based data from wearables is open many data analytics challenges.
%Monitoring and analytics of physical activity and sleep are of paramount importance for the management of chronic conditions. However, it is not a simple task. For example, there are many unknown factors such as the best dosing of physical activity for people living a chronic condition. Healthcare professionals and patients do not readily know which frequency and timing of physical activity are the best.
%While leveraging wearables data for disorder screening might provide significant benefits in health-care. A major technical challenge is the unavailability of enough parallel clinical data from the users of wearable device in a non-clinical setting. In most realistic scenarios, clinical data is available only for a tiny fraction of subjects who consent to research surveys or studies.
%availability of a parallel clinical data for only a (small) fraction of subjects who consent to research surveys or studies.
%Clinical data relevant to sleep screening is available only for those who have gone through a clinical evaluation like polysomnography. Not only is this a tiny fraction of the population, when intersected with those for whom actigraphy data is available, the resulting population becomes truly minuscule. Thus, a screening approach involving data from clinical evaluation renders useless the activity data from a majority of subjects and might give an unrepresentative sample of the population. Hence, any approach towards using physical activity signals should be designed to take into account the generalization of the approach. Task-specific supervised learning tends to generalize poorly on skewed datasets \cite{bengio2013representation}. \emph{An unsupervised scalable approach that can learn essential activity characteristics (features) from abundant (unlabeled) wearable data is required to achieve generalizability.}
%\begin{figure}[t!]
% \centering
% \includegraphics[scale=0.25]{images/workflow_act.pdf}
%\caption{Work-flow of our proposed solution. Subjects track their activity using wearables like Fitbit, with a fraction of subjects' clinical data available. Our proposed method \acttovec\ learns embeddings for activity signals in an unsupervised way. Supervised learning models (not a subject of this work) can utilize our embeddings.}
% \vspace{-2em}
% \label{fig:workflow}
%\end{figure}
\noindent Only a minuscule proportion of the population has both their clinical data and wearables data available. Thus a purely supervised approach utilizing the wearables-clinical data corpus is sub-optimal since it renders the activity data from a majority of subjects redundant. Hence, any approach towards using activity signals should utilize the unsupervised learning. Second, an important aspect is that information in actigraphy signals depends on the \emph{subjects} and their \emph{environments}, such as their routines and surroundings~\cite{storm2015step} along with measurement errors owing to device design. % along with noise introduced in the activity signals due to subject's environment, pose further challenges.
We propose a two-pronged approach. First, a mapping of the temporal relations of the activities from the time-series to a feature space should be learned. Second, this feature space should take into account the subject's environment, and make the representations invariant to the subject and their environment. %In this work, we propose an unsupervised representation learning approach, using multi-task learning, to leverage the unlabeled data and
%the co-occurrence relations between different lifestyle disorders to cater to issues described before.
%% traditional method
%Traditional time-series representation methods use symbolic representation like Symbolic Aggregate Approximation (SAX), converting time-series into a typical sequence by assuming a distribution over the symbols~\cite{lin2007experiencing, senin2013sax}. %Time-series vector-space models like SAX-VSM~\cite{senin2013sax}, use TF-IDF (term frequency-inverse document frequency) vectors to represent a time sequence.
%Despite successful applications in a wide variety of tasks involving classification and clustering \cite{bagnall2017great}, the symbolic representation methods are limiting in several ways. First,
%it prevents the model from considering sufficiently long sequential dependencies by using bag-of-words (BoW) representations like TF-IDF vectors.
%, leading to the so-called \emph{curse of dimensionality} problem \cite{Bengio03}. %This is especially a crucial problem for a domain like healthcare signals, where we do not have much data to learn higher order Markov dependencies
%Second, due to its high dimensions, the traditional vector space models often suffer from sparsity problems, making the prediction model inefficient \cite{le2014distributed}.
%First, existing entity grid models use the discrete representation for grammatical roles and features, which prevents the model from considering sufficiently long entity transitions \cite{Bengio03}.
%SAX SAX converts each time-series window into a symbolic sequence by assuming a Gaussian distribution over the symbols.
%\warning{Incomplete} In the domain of time-series analysis, a number of symbolic representation models exist, the most common being Symbolic Aggregate
%Approximation (SAX)~\cite{lin2007experiencing} and its variants. SAX converts each time-series window into a symbolic sequence by assuming a Gaussian distribution over the symbols. A number of time-series classification approaches based on deep learning have been proposed lately~\cite{wang16}. Time-series vector-space models (\eg\ SAX-VSM) use TF-IDF (term frequency-inverse document frequency) vectors. To the best of our knowledge, our \acttovec~is the first work that uses a distributed representation learning approach to time-series.
\noindent We propose a new method
%outlined in Figure~\ref{fig:workflow},
that addresses the challenges mentioned above. The core of our method is an unsupervised representation learning model, \acttovec\ that learns \emph{distributed} representations for activity signals spanning over a time segment (\eg\ at a day level) in a subject invariant manner.
We use two public data-sets to evaluate our approach against baselines on four disorder prediction tasks. Using a linear classifier (logistic regression), we show that our proposed representation learning method outperforms the baseline time-series representation methods with a good margin, with day-level time-segment representations performing the best. The \textbf{linear} classifier with our learned features \emph{performs at par with the non-linear convolution neural network} baseline trained end-to-end on the classification tasks. We also demonstrate the effectiveness of the subject-invariance loss in inducing subject invariant features.
%Our experiments also show that the embeddings learned with subject-invariance loss improve the performance of our model by making the embeddings more general.
Unlike traditional time-series methods, our feature vectors can be used to boost the performance of the supervised learning models. It has been shown that using unsupervised pre-trained vectors to initialize the supervised models produces better performance~\cite{hinton2012deep}. Our method is general enough to be applied to other domains with similar time-series like activity tracking through smart-phones, traffic monitoring, or other types of sensor data. %The unsupervised embeddings we provide can be used in .
Specifically, we make the following contributions:
%Our main contributions are as below:
\begin{noindlist}
%\begin{noindenum}
%\begin{enumerate}[(a)]
\item \textbf{Unsupervised scalable embeddings for activity time-series:} To utilize enormous unlabeled human activity data, we propose a novel unsupervised representation learning method \acttovec\ %that learns \emph{condensed} vector representation for activity time-series. %from raw activity data (\ie\ without using label information).
that uncovers activity patterns through \emph{distributed} representation in a scalable fashion, which can be leveraged towards prediction tasks.
\item \textbf{A {hierarchical} model of representation:} One of the persistent challenges in the time-series domain is the selection of time-segments granularity that serve as the primary analysis units. We explore learning representations at various levels of time granularity. We devise a novel algorithm that optimizes two different measures to capture local and global patterns in the activity time-series, along with an ordinal loss to account for the natural ordering in the activity signals.
%\red{a smoothing criteria and an}
%on time-series values.
\item \textbf{Subject-invariant representations:} %\red{Since the representations are learned from a large dataset of human activity signals, they capture \emph{distributional} similarity between the signal values. However, }
The noise from the subjects environments can hinder the generalization. In order to make the representations invariant to subject environments, we train our representations with a subject invariance loss in the adversarial training setting.% \cite{goodfellow2014generative}.
%. We use an adversarial setting~\cite{ganin2015unsupervised} to achieve the subject invariance in our embeddings.
%\item \textbf{Learning efficient linear features:} Our method projects the input time-series into space with features without learning on the end task. \red{This needs revision}
%\end{enumerate}
\end{noindlist}
%\begin{enumerate}[(i)]
%The remainder of this article is organized as follows. Sec. \ref{sec:rel} surveys related work, Sec.~\ref{sec:model} presents the framework for \acttovec, Sec. \ref{sec:settings} describes the experimental settings, Sec.\ref{sec:results} describes the results, and we conclude in Sec. \ref{sec:conclusion}.
% our neural coherence model for the monologue and its extension to the asynchronous conversation in Section~\ref{sec:model}. In Section \ref{sec:tasks}, we describe the evaluation tasks along with the datasets used in these tasks. The experiments and analysis of results are presented in Section \ref{sec:exp}. Finally, we summarize our contributions with future directions in Section Section~\ref{sec:conclusion}.
%In summary, our main contributions are: \Ni we propose an unsupervised distributed
%representation learning framework for time-series analysis that
%beats existing time-series symbolic representation methods on multiple disorder prediction tasks; \Nii we investigate at different levels of time-granularity and show that day-level
%representations generalize best; and \Niii we devise an integrated learning algorithm that captures local and global properties of a time-series.
%we propose an unsupervised
%learning method for disorder diagnosis that leverages the
%undiagnosed subjects activity data; \Nii
%our tasks by using simple linear classifiers; 3) and 4) We demonstrate that the
%addition of smoothing constraint at right granularity level can
%help models generalize better.
%We explore our representational learning model at various levels of granularity.
%We use a two-pronged approach to embedding the local structure (symbol level) and global level (hour, day, week) of structure in the activity time-series. We use two publically available actigraphy datasets for training with diagnosis data being available in only one of the datasets. Four disorder diagnosis tasks were selected for testing our approach, with day level of time-segment embeddings perform the best of all other granular levels, beating baseline time-series
%symbolic representational classification techniques. Addition of regularized smoothing for a notion of periodicity in human activity helps to improve the performance of our model.
%Our main contributions are: 1) an embedding framework for multi-task (disorders) prediction on human activity data using an unsupervised learning approach, and 2) a representational learning approach to time-series analysis that uses both local (symbol) and global (\eg day) level time-segments to create time-series representations in a lower dimensional space.
%(4th paragraph) Specific challenges in learning vector representation for activity signals -- granularity (min, hour, day, week), smoothing constraints. Each health application might require different levels of granularity.
%Modeling compositionality -- external memory (\eg\ memory nets) vs. internal memory (\eg\ recurrent nets).
%\emph{Motivation:} in physical activity research, it is still rare to find data-sets that have the time-series longitudinal observations along with the subject's clinical diagnosis for multiple disorders. Instead, we usually have the common longitudinal observations in multiple data-sets along with the diagnosis data distributed over these data-sets for different patients. The supervised learning approach that's usually used for end-to-end learning is unable to utilize the multiple data-sets, in the absence of shared diagnosis data of the disorders. We observed similar issue with the presence of human activity data across two data-sets: SOL and MESA. While SOL data-set has multiple disorders data, MESA's multi-disorder data is unavailable, despite having a much larger number of subjects (n=2237) than SOL (n=1887). Tools for providing embedding framework combining multi-task predictions across different health conditions have consequently a significant potential.
%Health lifestyle analytics is an excellent example of the potential of such analytical approaches. For example, it is of crucial importance to better understand the interlinks between all the factors that related to physical activity, sleep, fatigue and chronic condition-related factors \cite{bower2014cancer}. The complexity of those factors is very complicated and still matter of biomedical research. Overall we can say that we do not understand well the etiology of many of our behaviors and conditions such as fatigue and sleep problems. Large available datasets can be used to leverage more insights in those aspects, but as this paper is addressing, it does require the development of new methods. Hence, it is important to leverage unsupervised learning methods to uncover the common patterns in the time-series data, rather than throwing off the shelf the available data-sets of the common time-series observations.
%\emph{Our contribution:} this paper presents a feasibility study on the development of an embedding framework for the analysis of lifestyles behavioral data (physical activity and sleep).
%Our approach has been validated using data captured with wearables in a large cohort of people (more than 3000 subjects) which combines multiple datasets derived from two public health studies. These people do have a wide range of chronic conditions. We decided to focus on i) sleep apnea which is a serious sleep disorder linked to obesity and often leading to fatigue, ii) diabetes as physical activity and sleep play a major role in the management of the condition, iii) insomnia since it is a common sleep disorder, and iv) hypertension as is a major risk factor for cardiovascular diseases can physical activity and sleep do play a major role in controlling hypertension.
%THIS NEEDS SOME EXPANSION
%(paragraph) Evaluation and take home message -- how we evaluate the model -- tasks, datasets.
%\emph{Paper organization:}(paragraph) Paper organization (optional for short conference papers)
%We divide related work into three parts as described below.%: \Ni human activity recognition, %\Nii representational learning, and \Niii time-series analysis methods.
\begin{figure}[t!]
\centering
\vspace{-1.5em}
\includegraphics[width=0.45\textwidth]{images/activity.pdf}
\vspace{-1em}
\caption{Activity time-series for a subject over a week.}
\vspace{-1em}
\label{fig:activity}
\end{figure}
\begin{noindlist}
\item \textbf{Human activity for health informatics:} Wearable sensors have mostly been used for human activity recognition (HAR) task in machine learning~\cite{bulling2014tutorial,alsheikh2016deep}, while medical practitioners perform a manual examination on the actigraphy data for diagnosing mostly sleep-disorders~\cite{sadeh2011role}.
Recent works have tried using actigraphy data for quantifying sleep quality using deep learning~\cite{sathyanarayana2016impact} or for actively monitoring human behavioral patterns~\cite{althoff2017harnessing}. The novelty of our method is that we propose task-agnostic models rather than plain supervised learning.% that can potentially be used for screening.
\item \textbf{Representation learning:}
~\citeauthor{bengio2013representation} provide an overview of representation learning, used to construct a space that is discriminative for downstream tasks.
It is based on ideas of better network convergence by adding (unsupervised) pre-trained vectors that encode the mutual information between the input features~\cite{goodfellow2016}. Recently, the area has made enormous progress in NLP, vision, and speech~\cite{collobert2011natural,hinton2012deep}. Of particular interest are the distributed bag-of-words (DBOW) architectures~\cite{mikolov2013distributed,Grover.Leskovec:16,saha2017regularized} optimized to predict the context of the structure, unlike continuous-bag-of-words (CBOW) that predicts the structure from its context. In a similar fashion, we use
DBOW to capture local patterns in a time segment. Our novelty lies in integrating it in an adversarial setting~\cite{Ganin:2016} with an unsupervised predictor, which is a combination of DBOW with global context and ordinal constraints for activity time-series.
\item \textbf{Time series analysis literature:}
These methods mainly use pair-wise similarity concept to perform
classification~\cite{bagnall2017great} and clustering tasks, with a distance metric like Euclidean.
Dynamic Time Warping~\cite{berndt1994using} is a widely used technique for finding similarity between two time-series which is computationally expensive due to its pair-wise similarity approach. This has led to the creation of symbolic representation techniques like SAX~\cite{lin2007experiencing} and BOSS~\cite{schafer2015boss}, that convert time-series into a symbolic sequence based on amplitudes or frequency analysis, respectively. SAX-VSM and BOSS-VS~\cite{schafer2016scalable} use tf-idf (term frequency-inverse
document frequency) transformation of these symbolic sequences to get vector representation of sequence windows.
%is a symbolic representation technique that uses
%Fourier transform of the time-series-windows to create symbolic sequences.
% creates vector space
%in a similar fashion to SAX-VSM.
HCTSA~\cite{fulcher2014highly} is an \emph{unsupervised}
time-series feature extraction engine with over 7800 feature space based on frequency-domain and time-domain analysis of the time-series, unlike the above supervised vector space models. These time-series models, however, cannot complement the supervised learning model, unlike our model's embeddings that can be used to initialize the architectures with back-propagation like neural networks.
%TODO: add a description about the discrete time-series representations
\end{noindlist}
%\red{We depict a use case of our proposed approach in Figure \ref{fig:workflow}. We use activity time-series data to train our unsupervised learning model, \acttovec\ that learns embeddings from activity signals. The representations can then be used as input to supervised task classifier (not a subject of study in this work). In the following,}
In this section, we describe our method \acttovec. We first describe challenges, followed by the model components that address these challenges.
%pre-trained embeddings for supervised disorder prediction tasks (not a subject of study in this work) for which we have limited labeled clinical data.
% access to clinical diagnosis data only for a small portion of the subjects.} %We use the wearables data The learned embeddings can then be used to improve the performance of the supervised models for the disorder prediction tasks for which we have limited diagnosis labels.}
% To address the problems identified in the previous section.
%Real time activity data collected from wearables can be used to train our representation learning model, \acttovec.
%\acttovec\ learns to encode units of activity signals into distributed representations (\aka embeddings) from raw data. %These pre-trained embeddings are in turn used to improve the performance of the supervised models for the disorder prediction tasks for which diagnosis labels are available only for a small subset. The framework further leverages co-morbidity for multi-task learning on the disorder prediction tasks. In the following, we first describe \acttovec, then we present our supervised model, and finally the multi-task learning setting.
% are then of the disorder classifiers for which diagnosis.
% only a diagnosis data is available.
%In this section we present our proposed approach. The section is divided into two parts: 1) Unsupervised representation learning describing our \acttovec\ method, 2) Supervised Learning models with task-specific and multi-task learning.
%\subsection{\acttovec~model}
\subsection{Challenges for \acttovec}
\label{subsec:acttovec}
To create a representational schema for activity time-series, the first natural challenge is determining the \textbf{right granularity} of the analysis unit. For example, consider the sample time-series in Figure \ref{fig:activity}, where the x-axis represents the time in 30 seconds epochs and the y-axis represents the activity levels (or counts), which in our setting are discrete values, ranging from $0$ to $5000$.
Learning vector representations for each activity level might result in sparse vectors that are too fine-grained to be effective in the downstream tasks. Similarly, learning a representation with too big an analysis unit (\eg\ spanning a week) could result in generic vectors lacking required discriminative power. %to solve the downstream tasks.
As we demonstrate later in our experiments, the right level of granularity is somewhere in between (a day span). Within the analysis units, the \textbf{relative magnitude} of the signal values (\eg\ `10' $<$ `15') should also be taken into account.
Considering granularity of analysis unit shorter than the sequence length posits another challenge -- how to capture the \textbf{global contextual dependencies} between the units. Since the units are parts of a sequence that describes a person's activity over a timespan, they are likely to be inter-dependent which should be captured in the representations.
The same activity can look very different across the subjects owing to \textbf{subject-specific} noise and environment, \eg\ how they wear the device on their wrist. Our \acttovec\ model addresses these challenges as described in the next section.
%\red{Our model relates to the sequential methods like LSTM by the way of taking into account the global temporal dependencies. By considering the inter segment and intra-segment context we can take an analogy with a shallow auto-encoder with very dense localized connections and sparse neighboring connections. While we leverage the discreet valued nature of our time-series, we apply this method to continuous valued time-series by discretization, the way it is done in the traditional time-series literature. However, the use of adversarial setting was motivated by the environment induced noise, which might not be applicable to other domains.}
%In the following, we present our representation learning model that addresses the above challenges.
%representational model. The second is to capture the context of the chosen representational granularity unit. Therefore, our model is based on following three aspects: 1) granularity of representations, 2) incorporating the time-series measurements of the chosen representational granularity, and; 3) capturing the contextual information of the representational granularity.
%\subsection{Granularity of Time-Series Representation}
\subsection{Problem Formulation and Time Granularity}
\begin{table}[b!]
%\renewcommand{\arraystretch}{1}
%\vspace{0.5em}
\caption{Notation table }
\label{table:notation}
\centering
\resizebox{\columnwidth}{!}{
\begin{tabular}{|l|L{8.5cm}|}
\hline
Notation & Description\\\hline
$P$ & Set of subjects \\
$S$ & Time-series dataset \\
$S_n$ & $n$-th time-series sequence $(t_1,\dots,t_l)$ from set $S$ \\
$T_k$ & Time-series segment $(t_a,\dots,t_{a+L-1})$ \\
$\mathcal{T}$ & Set of time-segments\\
$g$ & Time-granularity of the model \\
$d$ & Dimension of distributed representation space\\
$\mathbf{\Phi}$ & Embedding Matrix representing the mapping function\\
$\mathbf{\Phi}(T_k)$ & Representation of time-segment $T_k$\\
$t_j$ & A time-series value/symbol in the segment $T_k=(t_a,\dots,t_{a+L-1})$\\
$T_i$ & A neighboring segment of time-segment $T_k$ under consideration\\
$\mathcal{N}(T_k)$ & Neighborhood of time-segment $T_k$\\
$\Ls_s$ & Segment specific loss based on the pair $(T_k, t_j)$\\
$\Ls_o$ & Ordinal Regression loss based on the pair $(T_k, t_j)$\\
$\Ls_{nc}$ & Neighbor prediction loss based on the pair $(T_k, T_i)$ with $T_i \in \mathcal{N}(T_k)$\\
$\Ls_r$ & Smoothing loss based on the pair $(T_k, T_i)$ with $T_i \in \mathcal{N}(T_k)$\\
$\Ls_a$ & Adversarial loss based on the pair $(T_k, p)$ with $p \in P$ \\\hline
\end{tabular}
}
% %\vspace{-1.5em}
\end{table}
%\red{For representing the time-series data, it is important to consider the right time-unit for which the embeddings are created. For example, for the activity signal, the granularity of analysis could be at the level of devices' sampling rate (30 seconds in our case), an hour, a day, or a week. Each has its advantages and disadvantages as mentioned. SEEMS redundant, can remove?}% before. %Let the length of the time-series be $n$ and the size of embedding vectors be $d$.
%\warning{Choosing analysis unit at the basal level (\ie\ device generated samples) can preserve fine-grained information about the time series, but the resulting vectors could be sparse and susceptible to noise at the input source. On the other hand, a granularity at the week's scale would produce more condensed vectors, however at the cost of signal's low-level information.} \warning{SHAFIQ: This is duplicating and can be removed if we need space}
\begin{figure*}[tp]
\centering
\fbox{
\scalebox{0.18}{\includegraphics*[viewport=10 110 2075 1180]{images/flowdiag_.pdf}}
}
%\includegraphics[width=0.85\textwidth]{flowdiag_.pdf}
\caption{Graphical flow of \acttovec's components: encoder E (embedding matrix), regularized predictors F, and the subject discriminator D. Figure on left shows the sub-losses of the three components, while figure on right shows the overall schema of a three-player game between F, D, and E. First, segmentation is done based on the time granularity. For a selected segment $T_k$, its embedding $\ph(T_k)$ is first looked up from E. The embedding is then used by the predictors in F and the discriminator D. The encoder E plays a cooperative game with F to allow it to induce the necessary information. E also plays an adversarial min-max game against D to prevent it from identifying the subject from the embedding to promote subject invariance.}
\label{fig:flowdiag}
%\vspace{-1.6em}
\end{figure*}
Let $S = \{S_1, S_2, \cdots, S_N\}$ denote a set of activity sequences for $P$ unique subjects, where each sequence $S_n = (t_1,t_2,\dots,t_l)$ is $l$-length activity (\eg\ step counts) for a subject $p$ over a time period (a week here). Let $g \in \{$30 sec, 1 hour, 1 day, 1 week$\}$ specify the granularity we want to encode. We first break each sequence $S_n$ into $K$ consecutive time segments of equal length based on $g$ (top of Figure \ref{fig:flowdiag}).
Let $T_k = (t_a,t_{a+1},\dots,t_{a+L-1}) \in \mathcal{T}$ be such a segment of length $L$ that starts at time $a$. Our aim is to learn a mapping function $\ph: \mathcal{T} \rightarrow \real^{d}$ to represent each time segment $T_k$ by a $d$ dimensional representation. Equivalently, if we represent each time segment in the dataset with a unique identifier (ID), the mapping function $\ph$ is a lookup operation on an embedding matrix of a single hidden layer neural network with non-linear activations. Our goal is to learn the embedding matrix by considering the segment's \emph{content} and \emph{context} while promoting subjective invariance. $S_n$ can be obtained by concatenating (or averaging) the $K$ segment-level vectors; we use concatenation. In this work, we consider the following time spans for a comparative analysis:
%we use one hidden layer network (without any non-linear activation) for learning the embedding matrix. Mapping is a look-up operation, implemented as a (1-hot) vector-matrix product.
%To create a distributed representation for a sequence, our aim is to learn a mapping function $\ph: \mathcal{T} \rightarrow \real^{d}$, where $d$ is the dimensions of the representation.
%Let $(t_1,t_2,\dots,t_n) \in \mathcal{T} $ be a stream of $n$ activity measures for a subject over a time period (a week in our case), and the granularity chosen to be $g \in \{$30 seconds, 1 hour, 1 day, 1 week$\}$.
%To create distributed representations, we want to learn a mapping function $\ph: \mathcal{T} \rightarrow \real^{m \times d}$, where $m = \lfloor \frac{n}{g} \rfloor$ and $d$ is the dimensions of the representation.
%could incur very high dimensional overhead (\ie\ $n \times d$), and
%in the embeddings at the expense of very high dimensional overhead, $n \times d$ and possible susceptibility to noise at the input source.
%\begin{itemize}
%\vspace{-0.25em}
\begin{noindlist}
\item \textbf{Sample (\sampletovec):} representation for each 30-second sample. Our 20,160 length time-series yields a representation space of $\real^{20160 \times d}$.
%\vspace{-0.25em}
\item \textbf{Hour (\hourtovec):} representation for one-hour chunks, producing a vector space of $\real^{168 \times d}$.
%\vspace{-0.5em}
\item \textbf{Day (\daytovec):} embeds time-series at the level of a day span, giving us a representational space of $\real^{7 \times d}$.
%\vspace{-0.5em}
\item \textbf{Week (\weektovec):} provides embeddings at the scale of a week, yielding a vector in $\real^{d}$ space.
%\vspace{-0.5em}
\end{noindlist}
%\end{itemize}
% %\vspace{-0.5em}
For a given granularity level, \acttovec\ learns the mapping function $\ph$.
{While it is possible to use a pre-processing step with change-points detection (CPD) to get the time-segments instead of manually setting the granularity, this step needs careful adjustments to set the thresholds for CPD models adding to further complexity of the model. In principle, we can have a space search over the possible granularities instead of using the pre-defined set above. We skip that step in this work for the sake of simplicity. Instead, we demonstrate the model's behavior for the choice of granularities that are intuitive to humans.} Figure~\ref{fig:flowdiag} presents the graphical flow of \acttovec.
\noindent Our model relates to the sequential methods like LSTM by taking into account the global temporal dependencies. Considering the inter-segment and intra-segment context is analogous to a shallow auto-encoder with very dense localized connections and sparse neighboring connections. While we leverage the discrete valued nature of our time-series, we can apply this method to continuous valued time-series by discretization, as done in the traditional time-series literature. The adversarial setting motivated by the environmental noise, which might not apply to other domains. We first present the loss components, and then the combined loss.
%\begin{equation}\label{eq:totalloss}
%\begin{split}
%\Ls(\ph)=\sum_{\substack{T_i \in \mathcal{T}\\ T_j,T_c \in V(T_i)}} [\sum_{\substack{t_i \in w\\ w \in T_i}}\Ls_g(T_i,t_j)]+\Ls_c(T_i,T_j)+\Ls_r(T_i,T_c)
%\end{split}
%\end{equation}
%
% how we learn the function $f$ that transforms a time-series sample to a vector for a given granularity level.
%Next, we discuss the modeling of time-series measurements.
%\subsection{Segment content based loss}
\subsection{Modeling Segment Content in \acttovec} \label{subsec:content}
We use two loss functions in \acttovec\ to capture the content of a segment -- the ordinal relation between time-series values and their co-occurrence patterns.
\subsubsection{\textbf{Segment-Specific Loss}}
We use the segment-specific loss to learn a representation for each time segment by predicting its own values. %This is similar in spirit to the distributed bag-of-words model of Le et al.~\cite{le2014distributed} (2014), where activity symbols (analogous to `words') and time segments (analogous to `sentences') are assigned unique identifiers, each of which corresponds to a vector (to be learned) in a shared embedding matrix $\ph$.
Given an input sequence $T_k = (t_a,t_{a+1},\dots,t_{a+L-1})$, we first map it to a unique vector $\ph(T_k)$ by looking up the corresponding vector in the shared embedding matrix $\ph$. We then use $\ph(T_k)$ to predict each symbol $t_{j}$ sampled randomly from a window in $T_k$. However, using a softmax layer for the prediction is very computationally expensive. To compute the prediction loss in an efficient manner, we use Noise-Contranstive Estimation~\cite{gutmann2012noise} as an alternative to softmax: % following~\cite{mikolov2013distributed}.
%Formally, the prediction loss can be written as:
%\small
%\vspace{-0.25em}
\begin{eqnarray}\label{eq:granloss}
\Ls_s(\ph,\mathbf{W_s}|T_k,t_j) = - \log\sigma(\mathbf{w}_{t_j}^\top \ph (T_k)) \\ \nonumber
\hspace{-0.5em} - \hspace{-0.5em} \sum_{m=1}^{M} \mathbb{E}_{t_m \sim \nu(t)} \log\sigma(-\mathbf{w}_{t_m}^\top \ph (T_k))
%\vspace{-0.5em}
\end{eqnarray}
%\normalsize
\noindent where $\sigma$ is the sigmoid function defined as $\sigma (x) = 1 /(1+ e^{-x})$, $\mathbf{w}_{t_j}$ and $\mathbf{w}_{t_m}$ are the weight vectors associated with ${t_j}$ and ${t_m}$ symbols, respectively, $\nu(t)$ is the noise distribution from which negative example ${t_m}$ is sampled, and $M$ is the number of negative examples sampled for each positive example. In our experiments, we use unigram distribution as the noise distribution with $M = 12$.% in accordance to \cite{mikolov2013distributed}.
Since we ask the same segment-level vector to predict its symbols, the model captures the overall pattern of a segment. Note that except for \sampletovec, the model learns embeddings for both segments and symbols. %{With \sampletovec, in the absence of any higher-level segment, the model boils down to the skip-gram \wordtovec\ model \cite{mikolov2013distributed} that learns embeddings for the symbols using a window-based approach.
A segment-based approach is commonly used in the time-series analysis, though among the representational models only models like SAX-VSM \cite{senin2013sax} look at the co-occurrence statistics, with a \textit{bag-of-words} assumption.
\subsubsection{\textbf{Ordinal Regression Loss}} When predicting an activity symbol, the segment-specific loss above treats each symbol independently. However, since the symbols represent activity levels, there is a natural ordering in their values (\eg\ `5' $>$ `1'), which should be preserved in representations.
%Since the activity values are ordered (\ie\ they represent activity levels), the representations of the time-series segments, as well as symbols, should take into account the ordinal relation. The segment-specific loss above does not take that into account.
In order to embed this ordinal relation, we use ordinal regression loss while learning the representation for each activity value:
%\small
\begin{equation}\label{eq:ordloss}
%\vspace{-0.5em}
\begin{split}
\Ls_o(\ph,\theta,\mathbf{w}_o|t_j) &= - \sum_{c=1}^{V} \mathbb{I}(t_j=c) \log \Big[\sigma(\mathbf{\theta_c}- \mathbf{w}_o^\top \Phi(c))\\
&\quad- \sigma(\mathbf{\theta_{c-1}}- \mathbf{w}_o^\top \Phi(c))\Big]
\end{split}
\end{equation}
%\normalsize
\noindent where $\sigma(x)$ is the sigmoid function as defined before, $\mathbb{I}$ is the indicator function, and $V$ is the number of distinct discrete values that time-series can take (0-5000 in our case). Here, $\sigma(\mathbf{\theta_c}-\mathbf{w}_o^\top \Phi(c)) = p(t_j\leq c | \Phi(c))$ is the cumulative probability of $t_j$ being at most $c$ with $\theta_c$ being the ordered threshold for the regression, such that $\theta_j > \theta_i$, $\forall j>i$.
\noindent \textbf{\emph{Remark:}} In principle, we can integrate the ordinal relation in Equation~\ref{eq:granloss} with the NCE loss. However, owing to the hierarchical nature of our algorithm, the segment ID is also predicted while learning the symbols and segments representations. Since these segment-level IDs do not have an ordinal relation with the symbol IDs, we resort to using an ordinal loss applicable only to time-series symbols.
%(day ID vs. symbol ID `5')
%\footnote{Interested readers can look into the implementation from \citeauthor{le2014distributed} (2014).}
%\textcolor{blue}{\emph{Note:} In principle, we can integrate the ordinal relation with Equation~\ref{eq:granloss} by replacing the first term in $\Ls_s$ with ordinal loss. However, owing to the hierarchical nature of our algorithm, the representations for time-segments are learned using Eq.~\ref{eq:granloss}. Since these time-segments don't have an ordering criterion, we resort to using negative sampling loss for both time-series values and time-segments, while the ordinal regression loss applies only to the time-series values. }
%\begin{equation}\label{eq:ordcum}
%\begin{split}
%P(t_j\leq c | \Phi(c)) &= \sigma(\mathbf{\theta_c}-\mathbf{w_o}^\top \Phi(c))
%\end{split}
%\end{equation}
%\noindent where $\sigma$ is the sigmoid function defined as $\sigma (x) = 1 /(1+ e^{-x})$, $\mathbf{\Phi}$ is the embedding function, $\mathbf{I}$ is the indicator function, with ${t_j}$ being the central value in the time-series segment, $T_k$'s (constructed from time-windows), $V$ are the number of distinct discrete values that time-series can take, and $\theta_i$ are the ordered threshold for the regression, such that $\theta_i < \theta_j$, $\forall j>i$.
%\Ls_s(T_k,t_j) = - \log\sigma(\mathbf{w}_{t_j}^T \ph (T_k))
% - \sum_{m=1}^{M} \mathbb{E}_{t_m \sim \nu(t)} \log\sigma(-\mathbf{w}_{t_m}^T \ph (T_k))
%except \sampletovec, for all the other methods, the window $w \in T$. For \sampletovec, $w$ takes together multiple $T$'s \aka samples for window formation.
%The first term is the loss of the samples in the window $w$, with time-unit representation $T_i$. The second term is the loss that maps how dissimilar is the $T_i$ with random samples from noise distribution $P(t)$.
%and $\mathbf{w}$'s and $\phi(\mathbf{v}_i)$ are similarly defined as before. Negative sampling thus reduces the number of computations needed from $|\Os|$ to $S+1$, where $S$ is a small number ($5$ -- $10$) compared to the vocabulary size $|\Os|$ ($26$K -- $139$K).
%where, $t_j \in w$, the window; $t_e$ is sampled from noise
%distribution $P(t)$; and $\mathbf{w}$ the embedding weights
%of the DBoW.
% With DBoW, we capture the local sample distribution in $\ph(T_i)$.
%By asking the same sentence vector (underestimation) to predict its words, the content model captures the overall semantics of the sentence. The model has $O(d \times (|V| + |\Ds|))$ parameters.
%To create embeddings for each time-granularity unit, we consider a window of size $w$, with the measurement (time-series sample) at the center of the window. We use Distributed Bag-of-Words (DBoW) model~\cite{le2014distributed} for modeling the time-series units at sample, hour, day, and week's level. The DBoW's task is to predict the elements of the window/context of the time-series sample using a single-layered hidden unit network with hierarchical softmax activation, that is approximated using negative-sampling~\cite{mikolov2013distributed}.
%Let $\Ds = \{S_1, S_2, \cdots, S_N\}$ denote a time-series dataset containing activity sequences for $N$ subject, where each sequence $S_n$ contains $n$ activity samples $(t_1,t_2,\dots,t_n)$. We first break each sequence $S_n$ into multiple segments of equal length based on a specified time granularity $g$,
%Recall that $m = \lfloor \frac{n}{g} \rfloor$ and $d$ is the dimensions of the representation, where $g \in \{$30 seconds, 1 hour, 1 day, 1 week$\}$ specifies the time span.
%
%To model the local properties of the time-series, we incorporate a time-window loss that looks into the local co-occurrence statistics of the time-series measurements.
%Let's first define the time-granular-unit as $T$. The \sampletovec~takes the time-series of all the subjects in the dataset as one single time-series, with the unit $T$ being each sample, creating windows of size $w$ composing of time-units $T$ without making a distinction between the subjects. The \hourtovec~on the other hand considers $T$ as a 120-sample-sized unit $T$, with windows being created out of these distinct $T$ sized units. Similarly \daytovec~and \weektovec~creates 2880 sample-sized and 20,160 sample-sized $T$, respectively.
%Getting embedding $\ph(\cdot)$ at sample level is straightforward. At the higher levels of granularity, a placeholder for each granular unit is placed at its beginning which gets trained along-with the embeddings for the samples $\ph(\cdot)$. The embedding for the time-unit level $T_i$ is then obtained from the embedding of the placeholder. We define the DBoW time-granularity loss (NEG objective) for getting the representation of time-unit $T_i$ as:
%where, $t_j \in w$, the window; $t_e$ is sampled from noise distribution $P(t)$; and $\mathbf{w}$ the embedding weights of the DBoW. The first term is the prediction loss of the samples in the window $w$, with time-unit representation $T_i$. The second term is the loss that maps how dissimilar is the $T_i$ with random samples from noise distribution $P(t)$. With DBoW, we capture the local sample distribution in $\ph(T_i)$. Please note that except \sampletovec, for all the other methods, the window $w \in T$. For \sampletovec, $w$ takes together multiple $T$'s \aka samples for window formation.
%\subsection{Modeling Time-Unit Activity Context}
%The discriminator loss (softmax) is reversed in order to make the encoding subject invariant.
%\subsection{Segment context or Intra-segment based loss}
\subsection{Modeling Segment Context in \acttovec}
%We use two kinds of losses in \acttovec\
Loss functions presented above capture local patterns in a segment. However, since the segments are contiguous and describe activities of a person, they are likely to be related. For example, after a strenuous activity, there might be lighter activity periods. Likewise, one can expect a smooth transition from one segment to the next. The algorithm should capture relations between proximal segments. With this motivation, we use two loss functions to model this relationship.
%\subsubsection{Sequence-Neighbor Specific Loss}
\subsubsection{\textbf{Neighbor Context Loss}}
Similar to activity symbols, each segment in the dataset is assigned a unique identifier that we can use to look up its corresponding vector in the embedding matrix or to predict the segment ID. We first formulate the relation between neighboring segments by asking the current segment vector $\ph(T_k)$ (\ie\ looked-up vector for segment $T_k$) to predict its neighboring segments in the time-series: $T_{k-1}$ and $T_{k+1}$. If $T_i$ is a neighbor to $T_k$, the neighbor context loss is the neighbor prediction task using NCE as before:
%\small
\begin{eqnarray}\label{eq:conloss}
%\vspace{-0.25em}
\Ls_{nc}(\ph,\mathbf{W_{nc}}|T_k,T_i) = - \log\sigma(\mathbf{w}_{T_i}^\top \ph (T_k)) \\ \nonumber
\hspace{-0.5em} - \hspace{-0.5em} \sum_{m=1}^{M} \mathbb{E}_{T_m\sim \nu(T)} \log\sigma(-\mathbf{w}_{T_m}^\top \ph (T_k))
%\vspace{-0.25em}
\end{eqnarray}
%\normalsize
\noindent where, $\mathbf{w}_{T_i}$ and $\mathbf{w}_{T_m}$ are the weight vectors associated with $T_i$ and $T_m$ segments, respectively. The noise distribution $\nu(T)$ is as described before over segment IDs.
% $P(T)$ for negative sampling is defined as a unigram distribution of sequences
%The unigram distribution is computed based on the occurrences of the nodes in the neighborhood sets, $\{\Ns(\mathbf{v}_i)\}_{i=1}^{|V|}$. This model has $O(d \times (|V|+|V|))$ parameters.
%$T_j \in W$; $T_e$ is sampled from noise distribution $P(T)$; and $\mathbf{w}$ the embedding weights
%of the model. The first term is the task of prediction of the context of $T_i$ by predicting the context, $T_j \in W$. The second term captures dissimilarity of $T_i$ with randomly sampled $T_e$'s from noise distribution.
%\subsection{Modeling Subject's Activity Level through Regularization Loss}
\subsubsection{\textbf{Smoothing Loss}}
While the previous objective attempts to capture neighborhood information, we also hypothesize that there is a ``continuity" between neighboring segments. %\red{It can also be viewed as a way to capture the periodicity of human activity at time-segment granularity level}.
The learning algorithm should discourage any abrupt changes in the representation of proximal segments. We apply \emph{smoothing between the neighboring segments} by minimizing the $l_2$-distance between the representations of the neighbors:
\small
\begin{equation}\label{eq:regloss}
\begin{split}
\Ls_r(\ph|T_k,\Ns(T_k)) &= \frac{\eta}{\mid \Ns(T_k) \mid} \sum_{T_c \in \Ns(T_k)} \norm{\ph(T_k) - \ph(T_c)}^2
\end{split}
\end{equation}
\normalsize
\noindent where $\Ns(T_k)$ is the set of time-segments in proximity to $T_k$ and $\eta$ is the smoothing strength parameter. Note that the smoothing loss is not applicable to \weektovec.
%\subsection{Domain-invariance loss}
\subsection{Modeling Subject Invariance in \acttovec}
One challenge in dealing with human activity data is that it heavily depends on the subject's environment. To promote subject invariance, we use an \emph{adversary} loss~\cite{Ganin:2016}. Let $P$ be the number of unique subjects. We use a multi-class classifier as a
%TD-6
\emph{discriminator} to predict the {time-segment's source (subject) $s \in \{1,\dots,P\}$
%to predict
%an auxiliary variable, $s \in \{1,\dots,P\}$,
from the encoded segment representation $\ph(T_k)$. In other words, the discriminator tries to identify the subject from whose activity time-series the \emph{encoder} (the embedding matrix) has derived the segment's representation. Note that we want to emphasize the invariance from the source subject of the time-segment and not from the particular sequence from which the segment is derived. Hence, if we have multiple sequences for the same subject, the sequences will share the same subject $s$ in our model.} Formally, the discriminator is defined by a soft-max:
%\vspace{-0.25em}
\begin{eqnarray}
p(s=p|\Phi(T_k),\mathbf{U}) = \frac{\exp (\mathbf{u}_{p}^T \mathbf{\Phi(T_k)} )} {\sum_{p'} \exp (\mathbf{u}_{p'}^T \mathbf{\Phi(T_k)} )} \label{eq:softmax}
\end{eqnarray}
% %\vspace{-0.25em}
\noindent where $\mathbf{u}_{p}$ is the weight vector associated with subject $p$, and $\mathbf{U}$ defines all the parameters of the discriminator. We use a cross-entropy loss to optimize the subject discriminator:
\small
%\vspace{-0.5em}
\begin{eqnarray}
%\Ls_d(\mathbf{U}|\ph,T_k,y_i=p) = {\frac{1}{|S_p|} \sum_{i=1}^{S_p} \mathbb{I} (y_i=p) \log \hat{y}_{ip}}\label{eq:domainloss}
%\Ls_d(\mathbf{U}|\ph,T_k,s=p) = {\frac{1}{|S|}} \sum_{i=1}^{|S|} \log p(s_i=p|\Phi(T_k),\mathbf{U}) \label{eq:domainloss}
\Ls_d(\mathbf{U}|\ph,T_k,s=p) = - \sum_{s=1}^{P} \mathbb{I} (s=p) \log p(s=p|\Phi(T_k),\mathbf{U})
\label{eq:domainloss}
\end{eqnarray}
\normalsize
\noindent where $p$ is a subject from whom the segment $T_k$ is encoded. %The above loss predicts the subject from the representation of each of time-series segment.
With a goal to promote subject invariance, we put the encoder (the embedding matrix) in adversary with the discriminator. The encoder attempts to encode features that are indistinguishable to the subject discriminator by minimizing (negative of discriminator loss):
\small
%\vspace{-0.5em}
\begin{eqnarray}
\Ls_a(\ph|\mathbf{U},T_k,s=p) = \sum_{s=1}^{P} \mathbb{I} (s=p) \log p(s=p|\Phi(T_k),\mathbf{U}) \label{eq:domainloss2}
\end{eqnarray}
%\vspace{-0.5em}
\normalsize
%This is achieved by flipping the gradients when back-propagating to the encoder~\cite{ganin2015unsupervised}. %\noindent The adversary loss improves generalization. We show an empirical analysis of its impact in Section \ref{sec:results}. % we need to decouple the representations from the subject (domain), we do a negative back-propagation of the error on the above loss~\cite{ganin2015unsupervised}. This makes our representations learn the task of "not" being able to predict the subject (domain) they were originated from, improving generalization.%The previous two objective functions captured the properties of the activity signal at sample-context and time-unit context. % the neighboring activity time-units should have similar representation, $\ph(\cdot)$. %The intuition being to incorporate the subject's "global" activity level information into the representations, rather than focusing entirely on sample-sized windows or time-unit contextual windows.
%Given the time-unit granularity, this information can be only be encoded at the sample, day, and hour level. The regularization loss is defined as:
%\vspace{-0.5em}
\subsection{Combined Loss for \acttovec\ }
We define our \acttovec\ model as the combination of the losses described in Equations~\ref{eq:granloss}, ~\ref{eq:ordloss},~\ref{eq:conloss}, ~\ref{eq:regloss}, and ~\ref{eq:domainloss2}:
\small
%\vspace{-1em}
\begin{equation}\label{eq:totalloss}
\begin{split}
\Ls(\ph) &= \sum_{n=1}^{N} \sum_{\substack{T_k \in S_n}} \hspace{-0.5em} \sum_{\substack{t_j \in T_k\\ T_i \in \Ns(T_k)}} \hspace{-0.6em} \Big[\underbrace{\Ls_s(\ph,\mathbf{W}|T_k,t_j) + \mathbf{\beta} \Ls_o(\ph,\theta,\mathbf{w}_o|t_j)}_{\text{\normalsize Segment Content\small}} + \\ &\quad \underbrace{\Ls_{nc}(\ph,\mathbf{W}|T_k,T_i) + \Ls_r(\ph|T_k,\Ns(T_k))}_{\text{\normalsize Segment Context\small}} + \underbrace{\mathbf{\lambda} \Ls_a(\ph|\mathbf{U},T_k,s)}_{\text{\normalsize Adversarial\small }}\Big]
\end{split}
%\vspace{-1em}
\end{equation}
\normalsize
\noindent where $\beta > 0$ and $\lambda > 0$ are the relative weights for the ordinal regression loss and the subject invariance loss, respectively. Concurrently, we also minimize the discriminator loss in Equation \ref{eq:domainloss}. {As shown at the right in Figure \ref{fig:flowdiag}, the training of \acttovec\ involves an optimization game between three players: the encoder (E), the combined predictor (F), and the discriminator (D). E plays a cooperative game with F to allow it to induce the necessary information. E also plays an adversarial min-max game against D to prevent it from identifying the subject from the encoded vector to promote subject invariance.
Algorithm \ref{alg:jnt} presents our training procedure based on stochastic gradient descent (SGD).
{The main challenge in adversarial training is to balance the two components -- the combined loss in Eq. \ref{eq:totalloss} vs. the discriminator loss in Eq. \ref{eq:domainloss}, as shown (right) in Figure \ref{fig:flowdiag}. If one player becomes smarter, its loss to the shared encoder (embedding matrix) overwhelms, and the training fails to converge \cite{ArjovskyCB17}. In our experiments, the discriminator converges much faster. To stabilize the training, we update the discriminator once every five gradient steps of the algorithm, chosen randomly.} Also, we follow the weighting schedule proposed by \cite[p. 21]{Ganin:2016}, that initializes $\lambda$ to $0$, and then changes it gradually to $1$ as training progresses.}
{Through our experiments we demonstrate that the intuitions captured by the components are synergistic since they improve the performance incrementally as the components are added.}
% To balance the two components, we would need the error signals from the discriminator to be fairly weak initially, with full power unleashed only as the classification errors start to dominate.
%\red{While our approach appears complex with the five component loss functions, we demonstrate through our experiments presented in the
%Sec~\ref{sec:results} that the intuitions captured by these losses are synergistic by improving the performance incrementally over the other. }
%by having an inference step similar to .
%Our next step will be to develop an \emph{inductive} setting, where one can infer representation of segments that are unseen at training time. This can be easily achieved for our models
%\Niii \red{The LSTMs/CNNs require prior knowledge about the length of the sequences - generally taking maximum or mean per subject, while our method can \textbf{utilize variable length sequences} across subjects very easily for efficient training. }
%In this study, we restricted all models to a \emph{transductive} setting, where representations of test sentences are learned along with training sentences. Our next step will be to develop an \emph{inductive} setting, where one can infer representation of sentences that are unseen at training time. This can be easily achieved for our models by having an inference step similar to \cite{Le.Mikolov:14}.
%\textcolor{blue}{todo: Shafiq please add the description about the re-computation when new data arrives}
%{using LSTM based language model to learn the representations did not work out well possibly because of noise and very long length (20180) of our sequence since the task here is to summarize the time-series. Also, our method is linear in computation unlike sophisticated deep models that involve dense matrix operations.}
%Please note the negative loss, $\Ls_d$, denoting the objective of learning invariance to the source of the time-series segment.
%\begin{mdframed}[style=myframe]
%We propose an unsupervised scalable embedding model that can handle variable length sequences and complement other deep learning architectures as pre-trained vectors - projected vector space of the input time-series
%\end{mdframed}
\setlength{\textfloatsep}{0.1in}
%\scalebox{0.9}{
\begin{algorithm}[t!]
\footnotesize
%\SetKwInOut{Input}{Input}\SetKwInOut{Output}{Output}
\SetAlgoLined
%\SetAlgoNoLine
%\SetNlSkip{0.1em}
%\Input{set of sentences $V$, graph $G=(V,E)$, window size, $k$}
\KwIn{set of time-series $S = \{S_1, S_2, \cdots, S_N\}$ with $S_p=(t_1,t_2,\dots,t_l)$, granularity level $g$}
\KwOut{learned time-series representation $\mathbf{\Phi}(S_n)$}
\SetKwBlock{Begin}{}{end}
Segment time-series $S_p$ based on the granularity $g$;\\
Initialize parameters: $\mathbf{\ph}$, $\mathbf{W_s}$, $\mathbf{W_{nc}}$, $\mathbf{U}$, $\mathbf{w_o}$, $\theta$; \\
Compute noise distributions: $\nu(t)$ and $\nu(T)$ \\
% \hspace{0.5cm} a. $\psi_c$ for $\Lb_c (\mathbf{v}_i)$ \tcp*{over words}
% \hspace{0.5cm} b. $\psi_g$ for $\Lb_g (\mathbf{v}_i, \Ns(\mathbf{v}_i))$ \tcp*{over nodes}
\Repeat {convergence}{
Permute $S$;\\
\For{each time-series sequence $S_n \in S$}{
\For{each time-segment $T_k \in S_n$}{
\hspace{-0.0cm}\For{each time-series sample $t_j \in T_k$}{
%\tcp{for word vectors}
%\For{each word $v$ around $v_i^j$ for window $k$}{
%\hspace{-0.3cm}\Na Generate a positive pair $({v}, v_i^j)$ and $S$ negative pairs $\{({v}, {v_i^{j}}^s)\}_{s=1}^{S}$ using $\psi_c$; \\
%\hspace{-0.3cm}\Nb Take a gradient step for $\Lb_c ({v}, v_i^j)$
%}
%\tcp{for sentence vectors}
\hspace{-0.3cm} - Take $(T_k, t_j)$ as a +ve pair and sample $M$ -ve pairs $\{({T_k}, t_m)\}_{m=1}^{M}$ from $\nu(t)$; \\
\hspace{-0.3cm} - Perform updates, $\nabla \Ls_s$, $\mathbf{\beta} \nabla \Ls_o$; \\
\hspace{-0.3cm} - Sample a neighboring time-segment $T_i$ from sequence $S_n$; \\
\hspace{-0.3cm} - Take $(T_k, T_i)$ as a +ve pair and sample $M$ -ve pairs $\{({T_k}, T_m)\}_{m=1}^{M}$ from $\nu(T)$;
% Sample a positive pair $(T_i, T_k)$ and $M$ negative pairs $\{(T_m, T_k)\}_{m=1}^{M}$ using $\nu(T)$; \\
\hspace{-0.3cm} - Perform updates, $\nabla\Ls_{nc}$, $\nabla\Ls_r$;\\
%\hspace{-0.3cm}- Perform updates for \emph{discriminator}, $ \nabla \Ls_d(\mathbf{U} | \ph, T_k,s)$; \\
\hspace{-0.3cm} - Perform update $\lambda \nabla \Ls_a$;
}
}
}
}
\caption{Training \acttovec\ with SGD}
\label{alg:jnt}
\end{algorithm}
%
%\red{We first initialize the model parameters $\ph$ and $\mathbf{w}$ with small random numbers sampled from uniform distribution $\Us(-0.5/d, 0.5/d)$, and compute the noise distributions $\nu(t)$ and $\nu(T)$ for $\Ls_s(\ph,\mathbf{W}|T_k,t_j)$ and $\Ls_c(\ph,\mathbf{W}|T_k,T_i)$ losses, respectively.}
%To estimate the representation of a segment, for each symbol sampled randomly from the segment, we take four successive gradient steps to account for the first four-loss components in Equation \ref{eq:totalloss}. By making the same number of gradient updates, the algorithm weights equally the contributions from the symbols in a segment and the neighbors. Note that for \sampletovec~and \weektovec~ only $\Ls_c$ loss is calculated since the other two objectives do not apply.
%\input{supervised.tex}
%\begin{figure}[t!b!]
% \centering
%\includegraphics[width=0.45\textwidth]{freq.eps}
%\vspace{-1em}
%\caption{log-log plot of activity count and its frequency of occurrence in the time-series across our two data-sets }
%\label{fig:loglog}
%\end{figure}
{In this section, we describe experimental settings --- datasets, the prediction tasks on which we evaluate the embeddings, the baselines models, and parameter selection.}
\subsection{Datasets}
We use Study of Latinos (SOL)~\cite{sorlie2010design} and Multi-Ethnic Study of Atherosclerosis (MESA)~\cite{bild2002multi}
datasets. SOL has physical activity and clinical data for 1887 subjects, while MESA only has activity data for 2237 subjects. This simulates the scenario where disorder condition labels are available only for a portion of users. These datasets contain activity data (actigraphy) from each subject for a minimum of 7 days measured with wrist-worn Philip's Actiwatch Spectrum. %Essentially, we get 28,868 days of actigraphy data across subjects to train our model on.
The time-series for each subject is sampled at a rate of 30 seconds. %Figure~\ref{fig:activity} presents a sample activity signal for a subject.
Actigraphy records the mean activity count per 30 seconds, providing us with a signal that can only take integer values. Mean activity count is reported in ZCM (Zero Crossing Mode) that counts the number of times the waveform crosses zero. This can be generalized to steps since they calculate the intensity. This makes embedding the input symbols straightforward, without a dedicated discretization step for our proposed \acttovec\ method.
The datasets are not skewed with respect to the class distribution of different prediction tasks described in the next section.
%In case of floating point value signals, a preprocessing step of waveform extraction can be added, as done by speech recognition community~\cite{greenberg1997modulation}.
%A total of 1757 discrete values of the signal were observed for our combined dataset.
A very few missing values {($<1\%$)} observed in the dataset were replaced by unknown (UNK) token. Any future unseen or out-of-vocabulary (OOV) signal value can be handled by a procedure that assigns representation from averaging out neighboring ordinal signal values rather than a generic unknown symbol assignment.
%We only considered 7 days of data for each subject, since missing values increased enormously for subjects with more than 7 days of data.
%\emph{Note}: all the disorder prediction tasks were taken only from the SOL dataset since MESA does not make the disorder labels public. We use actigraphy time-series from MESA and SOL for creating our
%\acttovec\ embeddings.
\subsection{Prediction Tasks} \label{subsec:predtasks}
We evaluate the effectiveness of the learned embeddings on the following health disorder prediction tasks:
\begin{noindlist}
\item \textbf{Sleep Apnea:} Sleep apnea syndrome is a sleep disorder characterized by reduced respiration during the sleep time. We use the Apnea-Hypopnea Index (AHI) at 3\% desaturation level with AHI$<$5 being characterized as \emph{non-apneaic}, while AHI $>5$ indicating a \emph{mild-to-severe-apnea}.
\item \textbf{Diabetes:} Diabetes (type 2) is the body's insensitivity to insulin, leading to elevated levels of blood sugar. Task is defined as a three-class classification problem, to decide whether a subject is a \emph{non-diabetic}, \emph{pre-diabetic}, or \emph{diabetic}.
\item \textbf{Hypertension:} Hypertension refers to abnormally high levels of blood pressure, an indicator of stress. Hypertension prediction characterizes a binary classification problem for increased blood pressure.% (BP). BP $>$ 140/90 is considered as having \emph{hypertension}.
\item \textbf{Insomnia:} Insomnia is a sleep disorder characterized by an inability to fall asleep easily, leading to low energy levels during the day. We use a 3-class prediction problem for classifying subjects into \emph{non-}, \emph{pre-} and \emph{insomniac} groups. %We merged subjects suffering from moderate and severe insomnia into one class owing to very few subjects suffering from severe insomnia.
\end{noindlist}
\subsection{Baseline Models}
We compare our method with a number of naive baselines and existing systems that use time-series representations:
%\noindent \textit{Supervised learning baselines}
%\begin{enumerate}[(a)]
\noindent \textbf{(a) Majority Class:} This baseline always predicts the class that is most frequent in a dataset.
\noindent\textbf{(b) Random:} This baseline randomly picks a class label.
\noindent\textbf{(c) SAX VSM:} SAX-VSM ~\cite{senin2013sax} uses SAX, one of the most widely used time-series representation technique.
\noindent\textbf{(d) BOSS:} BOSS~\cite{schafer2015boss}
is a symbolic representational learning technique that uses Discrete Fourier
Transform (DFT) of time-series windows. %instead of %unlike the Gaussian
%piecewise approximation (PAA) on each window.
BOSS creates equal sized bins from histograms of
DFT coefficients, which are then assigned representational symbols. Labels are assigned based on the class that gets the highest similarity score using nearest neighbor approach.
\noindent\textbf{(e) BOSSVS:} BOSS in Vector Space~\cite{schafer2016scalable} is similar to SAX-VSM and creates vector space representation of the time-series from BOSS. BOSS is known to be one of the most accurate methods
on standard time-series classification tasks, with BOSS-VS performing marginally lower.
\noindent\textbf{(g) CNN:} We use a Convolutional Neural Network (CNN) with Conv-ReLU-AvgPool-BatchNorm-Dropout layers for supervised prediction. We add layers until we get no performance improvement on held-out set.
%\noindent \textit{Unsupervised learning baseline}
\noindent\textbf{(h) HCTSA:} Highly Comparative Time-Series Analysis~\cite{fulcher2014highly} is a time-series feature extraction engine with over 7800 features extracted with frequency and time domain analysis like Kurtosis. Unlike the time-series baselines above, this is an unsupervised method --- most relevant baseline to our method.
{\noindent\textbf{(i) LSTM:} We train an LSTM based unsupervised model similar to~\cite{sundermeyer2012lstm} that learns to encode sequences by predicting next time-series value (as a language model in NLP). Next, we use this pre-trained network to initialize the LSTM network that is further trained on the supervised learning tasks.
%We did not use other neural architectures to keep the baseline simple and strong.
%\end{enumerate}
%\paragraph{\Ni Majority Class} This baseline always predicts the class that is most frequent in a dataset.
%\paragraph{\Nii Random} This baseline randomly picks a class label.
%\paragraph{\Niii SAX VSM:} Symbolic Aggregate Representation Vector Space or SAX-VSM ~\cite{senin2013sax} combines SAX~\cite{lin2007experiencing}, one of the most widely used symbolic representation technique for time-series data with Vector Space Modeling using tf-idf (term frequency inverse document frequency) measure.
%Each time-series is segmented into multiple windows, which are further used to calculate the tf-idf of the dynamic words made from SAX representation of the time-series.
%Labels are assigned to unlabeled time-series by calculating the similarity of a sequence's windows to tf-idf score with class labels, and the label corresponding to maximum similarity is selected.
%\paragraph{\Niv BOSS:} Bag-of-Symbolic-Fourier-Approximation or BOSS~\cite{schafer2015boss}
%is a symbolic representational learning technique that uses Discrete Fourier
%Transform (DFT) on sliding windows of time-series. %instead of %unlike the Gaussian
%piecewise approximation (PAA) on each window.
%BOSS creates histograms of
%Fourier coefficients to create equal sized bins of the Fourier coefficients
%over the time-series, which are then assigned representational symbols. The
%classification method involves nearest neighbor approach, with labels assigned
%based on the class that gets the highest similarity score.
%\paragraph{\Nv BOSSVS:} BOSS in Vector Space or
%BOSSVS~\cite{schafer2016scalable} is a vector space model similar to SAX-VSM
%except that it uses tf-idf vector space of the symbolic representation of the
%time-series obtained through BOSS. BOSS is known to be one of the most accurate methods
%on standard time-series classification tasks, with BOSS-VS performing
%marginally lower. % The classification labels are assigned
%based on the similarity of the BOSS transformed windows of test time-series in the
%tf-idf vector space to the class labels. %The class which has the highest average similarity across the time-series windows is assigned to the time-series.
\subsubsection{Variants of \acttovec}
%We experiment with the following variants of our unsupervised learning model.
%\vspace{-1em}
%\begin{enumerate}[(a)]
\noindent\textbf{(a) Unregularized models:} This group of models contain only two NCE loss components from Equation \ref{eq:totalloss}: $\Ls_s$ and $\Ls_{nc}$. In the Results section, we refer to these models as \sampletovec, \hourtovec, \daytovec, and \weektovec.
\noindent\textbf{(b) Regularized models:} We add smoothing loss $\Ls_r$ to models in (a). This group includes \hourtovecreg~and \daytovecreg. We omit \sampletovecreg~since it performed extremely poorly on all the tasks. Recall that smoothing is not applicable to \weektovec.
\noindent\textbf{(c) Ordinal loss model:} We use ordinal loss $\Ls_o$ with these models. We add this loss to \daytovecreg~model in (b), our best performing model as discussed in the next section. We omit other time-unit models for brevity.
\noindent\textbf{(d) Adversarial model:} These models use the \emph{adversary} loss $\Ls_a$ for our \daytovecreg~with ordinal loss.
%\end{enumerate}
%Once the latent space transformation is performed, we use a linear classification model like Logistic Regression for classification purpose.
%\vspace{-1em}
%\item Regularized models: We perform the regularization step for these models, referred to as \hourtovecreg~and \daytovecreg. We omit \sampletovecreg~since the embeddings produced performed extremely poorly on all the tasks, with no power to discriminate between the classes. No regularization step was possible at week's level; hence we compare at two levels of an hour and day. We run all our experiments 10 times, owing to the small size of the dataset.
%\end{itemize}
%\subsubsection{Supervised Learning Variants}
%\paragraph{\Ni Task-specific models:} As described earlier, these models are trained end-to-end for the disorder task at hand.
%\paragraph{\Nii Multi-task Learning models:} These models are trained jointly with all the disorder prediction tasks learned jointly.
%\paragraph{\Niii Pre-trained models:} These models are initialized with embeddings from best performing \daytovecreg\ .
\begin{table*}[t]
\renewcommand{\arraystretch}{1.1}
%\vspace*{-1\baselineskip}
\caption{ $\mathbf{F_1}$ and \textbf{Speed} relative to \textbf{wall clock time} of our \texttt{\daytovecreg+O}+\texttt{A}. O refers to \textbf{O}rdinal and A to \textbf{A}dversarial.}
\label{ApneaResults}
\centering
%\vspace*{-0.3\baselineskip}
\resizebox{1.5\columnwidth}{!}{%
\begin{tabular}%{C{0.8cm}|C{2cm}|C{1.35cm}|C{1.31cm}|C{1cm}|C{1.51cm}|C{0.8cm}|}
{|c|l|l|c|cc|cc|c|c|}
\cmidrule[\heavyrulewidth]{2-10}
\multicolumn{1}{c|}{} & Method & Clf. & Sleep Apnea & \multicolumn{2}{c|}{Diabetes} & \multicolumn{2}{c|}{Insomnia} & Hypertension & Speed\\
\cmidrule{2-10}
\multicolumn{1}{c|}{} & & & $F_{1}$ & $F_{1}$-macro & $F_{1}$-micro & $F_{1}$-macro & $F_{1}$-micro & $F_{1}$ & \\
\midrule
\parbox[t]{0.25cm}{\multirow{6}{*}{\rotatebox[origin=c]{90}{\textbf{Supervised}}}} & \texttt{Majority} & 0-R & 00.0 & 21.7 & 31.9 & 47.4 & 25.5 & 00.0 & -\\
& \texttt{Random} & & 33.9 & 34.3 & 31.3 & 36.2 & 30.0 & 33.4 & - \\
\cline{2-10}
% \hline
& \texttt{SAX-VSM} & & 00.0 & 38.6 & 24.3 & 47.4 & 25.5 & 00.0&-\\
%\texttt{CBoW} & 0.50 & 1.00 & 1.00 & 0.66\\
& \texttt{BOSS} & & 17.6 & 38.9 & 31.5 & 49.8 & 34.9 & 29.6&-\\
& \texttt{BOSSVS} & & 11.7 & 40.1 & 32.7 & 47.5 & 33.1 & 31.3&-\\
& \texttt{Task-specific} & {CNN} & 41.5 & 45.2 & 41.0 & 50.7 & 40.1 & 36.6 & 2.0x \\
\midrule
\parbox[t]{0.25cm}{\multirow{10}{*}{\rotatebox[origin=c]{90}{\textbf{Unsupervised}}}}
& \sampletovec & LR & 36.7 & 40.0 & 36.7 & 42.4 & 35.3 & 39.4& -\\
&\hourtovec & LR & 30.0 & 41.4 & 33.3 & 44.6 & 28.5 & 24.4& -\\
&\hourtovecreg & LR & 20.5 & 42.1 & 32.0 & 43.5 & 28.7&23.1& -\\
&\daytovec & {LR} & 36.8 & 40.9 & 38.0 & 45.2 & 35.8& 40.3& 0.3x\\
&\daytovecreg & {LR} & \textbf{38.9} & 41.8 & \textbf{39.5} & 46.6 & \textbf{39.7} &\textbf{43.4} & 0.3x\\
%\daytovecreg & {NB} & 61.3 & 38.3 & \emph{57.4} & 62.9 & \textbf{45.9}\\
&\weektovec & {LR} & 14.5 & 40.6 & 34.1 & 44.2 & 31.5 & 18.7& -\\
\cline{2-10}
%\texttt{Task-spec} & {CNN} & 55.3 & 31.0 & 62.8 & 52.7 & 41.5\\
%\texttt{Task-spec+Pre} & {CNN} & 68.2 & 39.6 & 47.5 & 75.4 & 43.2\\
& \texttt{HCTSA} & LR & 20.3 & 40.0 & 35.0 & 46.7 & 33.7 & 22.0 & 8.2x\\
& \texttt{LSTM} & LSTM & 32.2 & 41.4 & 33.3 & 46.1 & 30.4 & 37.8 & 10.5x \\
& \pbox{20cm}{\texttt{\daytovecreg+O}} & {LR} & 40.5 & 45.3 & 40.2 & 50.9 & 40.3 & 43.6 & 0.4x\\
& \pbox{20cm}{\texttt{\daytovecreg+O}+\texttt{A}} & {LR} & \blue{\textbf{43.6}} & 45.8 & \blue{\textbf{42.5}} & 55.7 & \blue{\textbf{41.4}} & \blue{\textbf{44.1}} & \textbf{1.0x}\\\bottomrule
\end{tabular}
}
%\vspace{-0.75em}
\end{table*}
\vspace{-0.25em}
\subsection{Hyper-Parameter Selection}
We use 80\%,10\%,10\% split for train, validation, and test sets repeated 10 times, and we report the mean scores. As mentioned earlier, we only have the disorder task labels for the SOL dataset. For the supervised models we only use the SOL dataset, while for the unsupervised models we use the combined SOL and MESA data. The embedding size of $d$=$100$ was fixed for all the models. The weighting parameters $\lambda$ and $\beta$ were chosen to be 0.05 and 0.5, respectively. The remaining hyper-parameters in \acttovec\ are: window size ($w$) for segment-specific loss, number of neighboring segments ($|\Ns(T_k)|$) and regularization strength ($\eta$) for \daytovec\ and \hourtovec. We tuned for $w \in \{12,20,30,50,100,120,500\}$, $\eta \in \{0,0.25,0.5,0.75,1\}$, and $|\Ns(T_k)| \in \{2,4\}$ on the development set. We chose $w$ of size 20, 20, 30, and 50 for \sampletovec, \hourtovec, \daytovec, and \weektovec, respectively. The $\eta$ of 0.25 and 0.5 were chosen for \daytovec\ and \hourtovec, respectively. The neighbor set size of 2 was chosen. For the CNN baseline, 3, 4, 3, and 3-layered network were used for sleep-apnea, diabetes, insomnia, and hypertension, with a dropout of 0.5 trained with Adam Optimizer. We tuned all the parameters for maximizing the $F_1$ scores.% on the classification tasks over the validation set.
%Next, we describe our results.
%Dropout rate of 0.5 was selected for all the supervised tasks with CNN. We used
%Adam Optimizer for all our supervised learning tasks. We tuned $\lambda_1, \lambda_2 \in \{0,0.25,0.5,1\}$ for our tasks.
%We optimize multi-task weights,
%$\alpha$, such that sum of weights is always one. For the multi-task learning
%without initialization, we used $\alpha = \{0.2,0.2,0.4,0.2\}$, respectively, while
%with pre-trained embeddings with multitask learning,
%we settled for $\alpha = \{0.3,0.25,0.35,0.15\}$, respectively for sleep-apnea, diabetes, insomnia, and hypertension.
%We used a 3, 4,3,3, and 3 layered CNN for sleep-apnea, diabetes, insomnia,
%hypertension, and multi-task learning tasks, respectively. In the next section, we describe our findings on the test dataset.
%and regularization strength parameter, $\eta \in \{0,0.25,0.5,0.75,1\}$ for \daytovec~and \hourtovec. We used window sizes $w \in \{8,12,20,30,50,120, 500\}$, and time-unit windows of neighbor set, $|V(T)|\in \{2,4\}$. Hyper-parameters were tuned on a dev set of 10\% of data-set size. We chose $w$ of size 20, 20, 500, and 50 for \sampletovec, \hourtovec, \daytovec,and \weektovec, respectively. The $\eta$ of 0.25 and 0.5 was chosen for \daytovec~and \hourtovec, respectively. The neighbor set size of 2 was selected for all the models. We selected an embedding size, $d$=$100$ for all our models.
In this section, we present our results for the four prediction tasks described in the previous section. The results are presented in Table~\ref{ApneaResults} in four groups: \Ni baselines, \Nii existing time-series representation methods and CNN, \Niii our unregularized and regularized \acttovec\ variants, and \Niv our ordinal and adversarial \acttovec\ models. We show classification performance in terms of $\mathbf{F}_1$ scores.
%We first discuss the results obtained with unsupervised representational learning models.
%We run all our experiments 10 times, owing to the small size of the dataset.
%%%%%%%%%%%TABLES%%%%%%%%%%%%%%%%%%%%%%%%%
%Diabetes is a 3-class classification problem with $C \in$ $\{$ Not-diabetic, Pre-diabetic, Diabetic$\}$
\begin{noindlist}
\item \textbf{\emph{Performance on disorder classification tasks:}}
Since our goal is to evaluate the effectiveness of the learned vectors, we use simple \textbf{linear classifier} Logistic Regression (LR) with our \acttovec\ models. For the multi-class classification problems like Diabetes and Insomnia, we use One-vs-All classifiers, tuning for micro-$F_{1}$ score. We run each experiment 10 times and take the average of the evaluation measures to avoid any randomness in results.
We can notice that \daytovec\ consistently gives absolute 2-4\% improvements over the other \acttovec\ variants, and 6-20\% over the baseline time-series representation models and LSTM on $F_1$ scores on all tasks. The adversarial-ordinal-regularized variant of \daytovec\ gives the best results among all the variants. Adversarial variant performs at par or better than task-specific supervised CNN on all the tasks. Due to inherent noisy nature of activity time-series and long sequence length, the LSTM-based model did not work well.
\item \textbf{\emph{Selecting time granularity:}} Across the tasks, the adversarial ordinal \daytovecreg~outperforms
all the models. Models with day level granularity perform better than all the other granularities as well as baseline methods. Among the \acttovec\ variants, the \weektovec~models perform the worst, while \hourtovec\ models perform just a bit better on an average. Hour and week-level models perform similarly to the baseline time-series methods. The high-dimensional
models based on samples (\sampletovec) perform better than hour-level, week-level,
and baselines. \daytovec\ produces marginally better results than the \sampletovec\ despite much lower dimensional space (2880x). The level of granularity makes a lot of difference in the performance of our models. From the above results, we can conclude that
while the low granularity level (\sampletovec) suffered from coarse
embeddings, the high granularity
(\weektovec) level embeddings lost the ability to discriminate.
\begin{figure*}[t!]
%\vspace{-1em}
\centering
\begin{subfigure}{.245\textwidth}
\centering
\includegraphics[width=\linewidth]{images/sleep_apnea.pdf}
\end{subfigure}%
\begin{subfigure}{.245\textwidth}
\centering
\includegraphics[width=\linewidth]{images/diabetes.pdf}
\end{subfigure}
\begin{subfigure}{.245\textwidth}
\centering
\includegraphics[width=\linewidth]{images/insomnia.pdf}
\end{subfigure}
\begin{subfigure}{.245\textwidth}
\centering
\includegraphics[width=\linewidth]{images/hypertension.pdf}
\end{subfigure}
%\vspace{-0.7em}
\caption{Comparison of our unsupervised \texttt{\daytovecreg+O}+\texttt{A} with LR vs. supervised CNN as a function of labeled data.}
\label{figure:UnVsS}
\end{figure*}
\begin{figure}[b!]
\centering
\includegraphics[width=0.45\textwidth]{images/tsne.png}
\caption{t-SNE visualization of subjects with regularized \daytovec\ on the left and adversarial \daytovec\ on the right, for all the subjects with respect to their level of activity. }
%\vspace{1em}
\label{fig:tsne}
\end{figure}
\item \textbf{\emph{Effect of smoothing:}}
{Intuition behind adding the temporal smoothing loss (Eq.~\ref{eq:regloss}) to our model was to test the hypothesis that human activities happen in continuity and follow a macro-routine. This should be reflected in neighboring time-segments making them similar in structure.
As results suggest, the continuity hypothesis was misguided at the sample- and hour-level. Regularization at the sample level made them lose the discriminative power for classification--- considering the noise in activity levels at such a fine granularity.
{\hourtovecreg~exhibits a significant drop (sleep apnea) or at par performance compared to \hourtovec. Since humans tend to switch between different activity types at the order of hours or less, the hypothesis of continuity was inappropriate at hour level as well.} %We omitted
%the \sampletovecreg~results for it only predicted the majority class on all the
% tasks.
However, adding smoothing helps produce gains for \daytovec, our best model. We argue that smoothing regularization helps capture a higher level global context since humans structure \emph{routines} at the level of the day, while we switch between activities on the order of hours or lower.} This is \textbf{supported by the periodogram analysis}, where day level frequencies dominate.
\item \textbf{\emph{Effect of ordinal loss:}} Addition of ordinal loss improves the accuracy of our models, albeit marginally. While the other loss functions work on co-occurrence of activity values at local and global contexts, ordinal loss explicitly models the relationship between the magnitude of the activity values, \eg `25' $>$ `5'. While it can be argued that similar ordinal values would co-occur, hence reflected in the $\Ls_s$, adding an explicit ordinal constraint helps, though marginally.
\item \textbf{\emph{Effect of adversarial training:}}
Adding the adversarial loss to the ordinal-regularized models improves the $F_1$ scores across the tasks by 0.5\%-3.1\% in absolute numbers and 2\%-7.5\% in relative terms. The difference in performance is more than the 95\% confidence intervals around the repeated experimental means reported here. It can thus be concluded that making the representations invariant to the source (subjects) helps in removing the noise introduced by the subjects and their environments, owing to how they wear their device and their routines, making the embeddings more generalized. With an adversarial setting, we can create a representation space more relevant to the health condition of the subjects by removing the subject source domain.
Figure~\ref{fig:tsne} shows the t-SNE~\cite{maaten2008visualizing} plot of regularized \daytovec~(left) vs adversarial \daytovec~embeddings (right) for SOL dataset subjects. For each subject, we concatenate the embeddings from constituent day level time-segments to get the representation. We plot the lifestyles of the subjects as determined by the study questionnaire, identifying each subject as \emph{highly-active}, \emph{moderately-active}, and \emph{sedentary} person. We can notice that we get clusters or subject \emph{phenotypes} with nice separation within the cluster for each of the lifestyle type with non-adversarial \daytovec. Unsurprisingly, the clusters get very compact in the adversarial setting. The lifestyle classes get clustered markedly separately rather than forming in-cluster separations, observed in the non-adversarial setting. Hence, the adversary helps \acttovec\ with removing the subject-wide variance in the learned embeddings, while still capturing the properties of subject phenotypes. Also, adversary loss improved results on the disorder prediction tasks. Hence, by reducing subject level variance, the adversary loss helps encode a better global representation.
\item \textbf{Scalability:} As reflected in Table~\ref{ApneaResults}, our model takes much less training time compared to the deep unsupervised model like LSTM. In fact, our model takes much less time compared to the supervised CNN that only runs on the labeled data.
Since our model has only one hidden layer (\ie\ embedding layer) and uses NCE for training, it is \textbf{scalable} in practical settings compared to the deep neural models. Additionally, our model offers more \textbf{flexibility} to incorporate the alternative intuitions including human knowledge (\eg\ the day/hour level representational hierarchy) that would be difficult to do with other deep methods. \textit{Clearly, using more sophisticated deep neural models like deep auto-encoders or variational auto-encoders that are susceptible to noisy data like ours for a semi-supervised setting would pose scalability challenges.}
% like LSTM-based language model \cite{sundermeyer2012lstm}
%One important property of our model is that it encodes a segment directly using the look-up operation, and treats neighboring segments as atomic units. This has a number of advantages over the deep sophisticated models like LSTMs that compose a segment vector from the symbol vectors.
%\red{This flexibility allows the model to \emph{incorporate longer range dependencies} in a scalable fashion compared to hierarchical LSTM models for example. The aim of this method is not to compete against the deep networks, but to complement them as pre-trained initialization.}
\textbf{\emph{Note:}} We restrict our models to a \emph{transductive} setting, where representations of test segments are learned along with training segments. However, it can be easily applied to a \emph{inductive} setting, where representations for unseen segments can be derived by a single backprop step~\cite{le2014distributed}.
\item \textbf{Supervised vs Unsupervised:} {To show the utility of unsupervised schema, we demonstrate the performance of supervised CNN vs. our adversarial \daytovec\ method as a function of the percentage of labeled data in Figure~\ref{figure:UnVsS}. Clearly, our model outperforms CNN across the board. The gap is drastic when the proportion of labeled data is \textbf{low}, which is usually the case in practice.}
%\textcolor{blue}{ adding the and getting compact global level clusters with respect to active lifestyle.
% }
\end{noindlist}
%Another important aspect to note is the increase in generalization across classes on the prediction task of \hourtovec\ and \hourtovecreg\ . Our datasets are
%imbalanced with majority class being the subjects not suffering from the disorders
%under consideration, with classification task being to predict the disorder-positive
%subjects. Most of our models and baselines are highly biased towards predicting
%the majority class. \hourtovec~has lower accuracy but higher precision and recall
%than most of the models, owing to its lower bias. Regularized \hourtovecreg~does
%better on $F_1$ scores while increasing the specificity/micro-$F_1$ scores along
%with accuracy on all the prediction tasks than \hourtovec, thus making it more
%generalized.
%
%Insomnia prediction task is a three class prediction problem with class $C \in$ $\{$no-insomnia, prethreshold-insomnia, moderate/severe insomnia$\}$
%
%\begin{table*}[tp]
% \renewcommand{\arraystretch}{1.00}
% \caption{\textbf{Acc}uracy, \textbf{Pre}cision, \textbf{Rec}all, \textbf{Spec}ificity, and $\mathbf{F_1}$ values for \textbf{Sleep-Apnea} prediction for each method}
% \label{SupResults}
% \centering
% \resizebox{\linewidth}{!}{%
% \begin{tabular}%{|C{1.6cm}|C{1.35cm}|C{1.31cm}|C{1cm}|C{1.51cm}|C{0.8cm}|}
%{l|l|cc|cc|cc|cc}
% \toprule
% Method & Clf. & Acc. & $F_{1}$ & $F_{1}$-macro & $F_{1}$-micro & $F_{1}$-macro & $F_{1}$-micro & Acc. & $F_{1}$ \\
% \midrule
% \texttt{Task-specific} & LR & 63.5 & 18.4 & 35.3 & 29.5 & 7.5 & 14.2 & 64.1 & 22.7\\
% \texttt{\acttovec (day)} & LR & 65.1 & 38.9 & 41.8 & 39.5 & 46.6 & 39.7 & 68.2 & 43.4\\
% \texttt{Task-specific} & CNN & 55.3 & 41.5 & 45.2 & 41.0 & 50.7 & 40.1 & 69.4 & 36.6\\
%\midrule
% \hline
% \texttt{Task-specific + Pre} & CNN & 58.2 & 43.2 & 44.6 & 41.7 & 55.6 & 41.2 & 63.5 & 38.0 \\
%\texttt{CBoW} & 0.50 & 1.00 & 1.00 & 0.66\\
% \midrule
% \texttt{Multi-Task} & CNN & 54.7 & 43.8 & 45.6 & 43.7 & 56.3 & 41.2 & 57.7 & 43.8\\
% \texttt{Multi-Task + Pre} & CNN & \emph{75.1} & \emph{57.1} & 46.6 & 44.4& 14.5 \\ \bottomrule
%\end{tabular}
%}
%\end{table*}
%\subsection{Supervised Learning}
%Results obtained on supervised learning models are shown in
%Tables~\ref{ApneaResults},~\ref{diabResults},~\ref{insomniaResults}, and~\ref{hyperResults}; see the last group of results. Barring the exception of hypertension, all the task-specific end-to-end convolution neural networks (CNNs) perform better than \acttovec~'s logistic classifier. This is not surprising since the CNNs are directly trained on the task. Using pre-trained embeddings from the \acttovec\ boosts the $F1$
%scores of task-specific CNNs across the board by ~1\%-2\% (absolute).
%Using joint multi-task learning improves the performance
%for the downstream tasks by 1\%-5\% (absolute) in $F1$ scores, notable
%being hypertension task, compared to its counterpart with task-specific
%classification. As observed with task-specific learning, using pre-trained embeddings improves the performance of multi-task learning further by ~1\%-2\% (absolute).
%Using pre-trained embeddings improves the
%performance of our methods as has been observed in a number of other
%domains. This is especially significant for our problem since the
%disorder diagnosis data is available only for a small fraction of
%wearables users. Please note that we demonstrate it in a scenario
%where the labeled dataset to total dataset size was ~46\%.
%However, in realistic scenarios, it might be a much smaller proportion.
%Hence, it is pertinent to use an unsupervised method like
%\acttovec\ to harness human activity data from all the users, to improve
%the performance as well as the generalization of downstream supervised
%tasks.
%The multi-task learning framework boosts the performance across the
%board, exploiting the co-morbidity structure of these multiple disorders,
%underpinning the root cause --- common lifestyle choices as captured
%partially by the wearable activity signals.
%Take home message {\color{red} to be written with introduction}:
In this work, we present a novel unsupervised representational learning technique, \acttovec\ that encodes human activity time-series by modeling local and global activity patterns. %Given the remarkable popularity of wearable devices for human activity tracking, there is a significant potential for personalized automated health-care that can not only reduce health-care costs but also help patients avoid long waiting times. The additional real-time data from the wearable devices can complement the existing clinical data, which is available at irregular time intervals. Owing to the absence of a parallel clinical data, a substantial portion of valuable activity data might become ineffectual. Disorder detection also involves serious generalization issues like skewed distribution and ethnic differences. In such scenarios, an unsupervised representational learning approach can effectively encode common human activity patterns in comparison to task-specific supervised learning approaches that by itself may not generalize well across multiple prediction tasks. %local (symbol/measurement) and global (\eg day) levels, while
We train our model on two datasets and test on prediction tasks (four commonly occurring disorders). We find that day-level granularity preserves the best representations, which is not surprising since a day is a natural timescale for a full cycle of human activities. Our task-agnostic representational learning model using simple linear classifiers beats baseline time-series representation models on all the disorder prediction tasks. It even performs at par or better than supervised convolutional neural network baseline. Our model learns the representational features using a combination of non-linear loss functions, giving better performance on multiple tasks using simple linear classifiers. We further demonstrate that using adversarial loss along with our embedding encoder model helps increase the performance and generalizability of the embeddings. Additionally, our method is capable of complementing the supervised learning by initialization, unlike existing representation approaches. %\textcolor{blue}{Our model is general enough to be applied to other activity data sources like smartphone accelerometers or other sensor data from other domains like traffic monitoring.}
%\vspace{-0.5em}
%\paragraph{\red{DO WE NEED THIS?} Future Work} Our current \acttovec\ model is not compositional in the sense that it does not combine the representations of lower-level (\eg\ device-generated symbols) units to get representations for the higher-level units (\eg\ hour segments). In future, we would like to investigate compositional structures like convolutional neural network or recurrent neural networks for \acttovec. We would also like to investigate other loss types such as ranking loss and reconstruction loss in variational auto-encoders. We would also like to show semi-supervised performance using pre-trained embeddings from our model.
%\begin{itemize}
%\item using our approach it is easier to leverage the human activity data which will be more popular in future with the enormous popularity of wearable devices
%\item this provides a massive opportunity for unsupervised learning techniques to utilize the human activity data for personalized-automated-inexpensive health-care in the absence of the labeled diagnosis data
%\item day level embedding works the best;
%\item adding regularization captures a notion of the periodicity of human activity level, which is a flawed assumption at hour level since humans activities vary a lot across sequential hours
%\item our methods outperform the time-series symbolic representation methods that are highly computationally expensive and hard to scale with increased data points. In comparison, day level embeddings work better and are computationally easy to be fed into classifiers directly or finding similarity between time-series for clustering and classification tasks
%\item our embeddings can be used directly for initializing the "deeper" neural network architectures, to possibly get better results, while we only used linear classifiers to test the quality of our embeddings
%\end{itemize}
\begin{thebibliography}{}
\bibitem[\protect\citeauthoryear{Alsheikh \bgroup et al\mbox.\egroup
}{2016}]{alsheikh2016deep}
Alsheikh, M.~A.; Selim, A.; Niyato, D.; Doyle, L.; Lin, S.; and Tan, H.-P.
\newblock 2016.
\newblock Deep activity recognition models with triaxial accelerometers.
\newblock In {\em AAAI Workshops}.
\bibitem[\protect\citeauthoryear{Althoff \bgroup et al\mbox.\egroup
}{2017}]{althoff2017harnessing}
Althoff, T.; Horvitz, E.; White, R.~W.; and Zeitzer, J.
\newblock 2017.
\newblock Harnessing the web for population-scale physiological sensing: A case
study of sleep and performance.
\newblock In {\em WWW}, 113--122.
\bibitem[\protect\citeauthoryear{Arjovsky, Chintala, and
Bottou}{2017}]{ArjovskyCB17}
Arjovsky, M.; Chintala, S.; and Bottou, L.
\newblock 2017.
\newblock Wasserstein {GAN}.
\newblock {\em CoRR} abs/1701.07875.
\bibitem[\protect\citeauthoryear{Bagnall \bgroup et al\mbox.\egroup
}{2017}]{bagnall2017great}
Bagnall, A.; Lines, J.; Bostrom, A.; Large, J.; and Keogh, E.
\newblock 2017.
\newblock The great time series classification bake off: a review and
experimental evaluation of recent algorithmic advances.
\newblock {\em DMKD} 31(3):606--660.
\bibitem[\protect\citeauthoryear{Bengio, Courville, and
Vincent}{2013}]{bengio2013representation}
Bengio, Y.; Courville, A.; and Vincent, P.
\newblock 2013.
\newblock Representation learning: A review and new perspectives.
\newblock {\em TPAMI} 35(8):1798--1828.
\bibitem[\protect\citeauthoryear{Berndt and Clifford}{1994}]{berndt1994using}
Berndt, D.~J., and Clifford, J.
\newblock 1994.
\newblock Using dynamic time warping to find patterns in time series.
\newblock In {\em KDD workshop}, volume~10, 359--370.
\newblock Seattle, WA.
\bibitem[\protect\citeauthoryear{Bild \bgroup et al\mbox.\egroup
}{2002}]{bild2002multi}
Bild, D.~E.; Bluemke, D.~A.; Burke, G.~L.; Detrano, R.; Diez~Roux, A.~V.;
Folsom, A.~R.; Greenland, P.; JacobsJr, D.~R.; Kronmal, R.; Liu, K.; et~al.
\newblock 2002.
\newblock Multi-ethnic study of atherosclerosis: objectives and design.
\newblock {\em American journal of epidemiology} 156(9):871--881.
\bibitem[\protect\citeauthoryear{Bulling, Blanke, and
Schiele}{2014}]{bulling2014tutorial}
Bulling, A.; Blanke, U.; and Schiele, B.
\newblock 2014.
\newblock A tutorial on human activity recognition using body-worn inertial
sensors.
\newblock {\em ACM CSUR} 46(3):33.
\bibitem[\protect\citeauthoryear{Collobert \bgroup et al\mbox.\egroup
}{2011}]{collobert2011natural}
Collobert, R.; Weston, J.; Bottou, L.; Karlen, M.; Kavukcuoglu, K.; and Kuksa,
P.
\newblock 2011.
\newblock Natural language processing (almost) from scratch.
\newblock {\em JMLR} 12(Aug):2493--2537.
\bibitem[\protect\citeauthoryear{Fulcher and Jones}{2014}]{fulcher2014highly}
Fulcher, B.~D., and Jones, N.~S.
\newblock 2014.
\newblock Highly comparative feature-based time-series classification.
\newblock {\em TKDE} 26(12):3026--3037.
\bibitem[\protect\citeauthoryear{Ganin \bgroup et al\mbox.\egroup
}{2016}]{Ganin:2016}
Ganin, Y.; Ustinova, E.; Ajakan, H.; Germain, P.; Larochelle, H.; Laviolette,
F.; Marchand, M.; and Lempitsky, V.
\newblock 2016.
\newblock Domain-adversarial training of neural networks.
\newblock {\em JMLR} 17(1):2096--2030.
\bibitem[\protect\citeauthoryear{Goodfellow, Bengio, and
Courville}{2016}]{goodfellow2016}
Goodfellow, I.; Bengio, Y.; and Courville, A.
\newblock 2016.
\newblock {\em Deep Learning}.
\newblock MIT Press.
\bibitem[\protect\citeauthoryear{Grover and
Leskovec}{2016}]{Grover.Leskovec:16}
Grover, A., and Leskovec, J.
\newblock 2016.
\newblock node2vec: Scalable feature learning for networks.
\newblock In {\em ACM SIGKDD}, 855--864.
\bibitem[\protect\citeauthoryear{Gutmann and
Hyv{\"a}rinen}{2012}]{gutmann2012noise}
Gutmann, M.~U., and Hyv{\"a}rinen, A.
\newblock 2012.
\newblock Noise-contrastive estimation of unnormalized statistical models, with
applications to natural image statistics.
\newblock {\em JMLR 2012} 13(Feb):307--361.
\bibitem[\protect\citeauthoryear{Hinton \bgroup et al\mbox.\egroup
}{2012}]{hinton2012deep}
Hinton, G.; Deng, L.; Yu, D.; Dahl, G.~E.; Mohamed, A.-r.; Jaitly, N.; Senior,
A.; Vanhoucke, V.; Nguyen, P.; Sainath, T.~N.; et~al.
\newblock 2012.
\newblock Deep neural networks for acoustic modeling in speech recognition: The
shared views of four research groups.
\newblock {\em IEEE Signal Processing Magazine} 29(6):82--97.
\bibitem[\protect\citeauthoryear{Le and Mikolov}{2014}]{le2014distributed}
Le, Q., and Mikolov, T.
\newblock 2014.
\newblock Distributed representations of sentences and documents.
\newblock In {\em ICML}, 1188--1196.
\bibitem[\protect\citeauthoryear{Lin \bgroup et al\mbox.\egroup
}{2007}]{lin2007experiencing}
Lin, J.; Keogh, E.; Wei, L.; and Lonardi, S.
\newblock 2007.
\newblock Experiencing sax: a novel symbolic representation of time series.
\newblock {\em DMKD} 15(2):107--144.
\bibitem[\protect\citeauthoryear{Maaten and
Hinton}{2008}]{maaten2008visualizing}
Maaten, L. v.~d., and Hinton, G.
\newblock 2008.
\newblock Visualizing data using t-sne.
\newblock {\em JMLR} 9(Nov):2579--2605.
\bibitem[\protect\citeauthoryear{Mikolov \bgroup et al\mbox.\egroup
}{2013}]{mikolov2013distributed}
Mikolov, T.; Sutskever, I.; Chen, K.; Corrado, G.~S.; and Dean, J.
\newblock 2013.
\newblock Distributed representations of words and phrases and their
compositionality.
\newblock In {\em NIPS}, 3111--3119.
\bibitem[\protect\citeauthoryear{Sadeh}{2011}]{sadeh2011role}
Sadeh, A.
\newblock 2011.
\newblock The role and validity of actigraphy in sleep medicine: an update.
\newblock {\em Sleep medicine reviews} 15(4):259--267.
\bibitem[\protect\citeauthoryear{Saha \bgroup et al\mbox.\egroup
}{2017}]{saha2017regularized}
Saha, T.~K.; Joty, S.; Hassan, N.; and Hasan, M.~A.
\newblock 2017.
\newblock Regularized and retrofitted models for learning sentence
representation with context.
\newblock In {\em CIKM}, 547--556.
\newblock ACM.
\bibitem[\protect\citeauthoryear{Sathyanarayana \bgroup et al\mbox.\egroup
}{2016}]{sathyanarayana2016impact}
Sathyanarayana, A.; Joty, S.; Fernandez-Luque, L.; Ofli, F.; Srivastava, J.;
Elmagarmid, A.; Taheri, S.; and Arora, T.
\newblock 2016.
\newblock Impact of physical activity on sleep: A deep learning based
exploration.
\newblock {\em arXiv preprint arXiv:1607.07034}.
\bibitem[\protect\citeauthoryear{Sch{\"a}fer}{2015}]{schafer2015boss}
Sch{\"a}fer, P.
\newblock 2015.
\newblock The boss is concerned with time series classification in the presence
of noise.
\newblock {\em DMKD} 29(6):1505--1530.
\bibitem[\protect\citeauthoryear{Sch{\"a}fer}{2016}]{schafer2016scalable}
Sch{\"a}fer, P.
\newblock 2016.
\newblock Scalable time series classification.
\newblock {\em DMKD} 30(5):1273--1298.
\bibitem[\protect\citeauthoryear{Senin and Malinchik}{2013}]{senin2013sax}
Senin, P., and Malinchik, S.
\newblock 2013.
\newblock Sax-vsm: Interpretable time series classification using sax and
vector space model.
\newblock In {\em ICDM}, 1175--1180.
\newblock IEEE.
\bibitem[\protect\citeauthoryear{Sorlie \bgroup et al\mbox.\egroup
}{2010}]{sorlie2010design}
Sorlie, P.~D.; Avil{\'e}s-Santa, L.~M.; Wassertheil-Smoller, S.; Kaplan, R.~C.;
Daviglus, M.~L.; Giachello, A.~L.; Schneiderman, N.; Raij, L.; Talavera, G.;
Allison, M.; et~al.
\newblock 2010.
\newblock Design and implementation of the hispanic community health
study/study of latinos.
\newblock {\em Annals of epidemiology} 20(8):629--641.
\bibitem[\protect\citeauthoryear{Storm, Heller, and
Mazz{\`a}}{2015}]{storm2015step}
Storm, F.~A.; Heller, B.~W.; and Mazz{\`a}, C.
\newblock 2015.
\newblock Step detection and activity recognition accuracy of seven physical
activity monitors.
\newblock {\em PloS one} 10(3):e0118723.
\bibitem[\protect\citeauthoryear{Sundermeyer, Schl{\"u}ter, and
Ney}{2012}]{sundermeyer2012lstm}
Sundermeyer, M.; Schl{\"u}ter, R.; and Ney, H.
\newblock 2012.
\newblock Lstm neural networks for language modeling.
\newblock In {\em INTERSPEECH}.
\bibitem[\protect\citeauthoryear{Warburton, Nicol, and
Bredin}{2006}]{warburton2006health}
Warburton, D.~E.; Nicol, C.~W.; and Bredin, S.~S.
\newblock 2006.
\newblock Health benefits of physical activity: the evidence.
\newblock {\em Canadian medical association journal} 174(6):801--809.
\end{thebibliography}