#  A modified limited memory Nesterov’s accelerated quasi-Newton

S. Indrapriyadarsini2, Shahrzad Mahboubi3, Hiroshi Ninomiya3, Takeshi Kamio4
and Hideki Asai2  Shizuoka University 2, Shonan Institute of Technology3,
Hiroshima City University4
<EMAIL_ADDRESS>
##  I Introduction

The Nesterov’s accelerated quasi-Newton (L)NAQ [1] method has shown to
accelerate the conventional (L)BFGS quasi-Newton method using the Nesterov’s
accelerated gradient in several neural network (NN) applications. However, the
calculation of two gradients per iteration increases the computational cost.
An approximation to the Nesterov’s accelerated gradient was proposed in [2].
This paper extends the study in [2] by applying the approximation to limited
memory NAQ.

##  II Proposed Algorithm (L-MoQ)

The weight update in NAQ is given as ${\bf w}_{k+1}={\bf w}_{k}+\mu_{k}{\bf
v}_{k}+\alpha_{k}{\bf g}_{k},$ where ${\bf g}_{k}$ is the search direction as
in (1).

${\bf g}_{k}={\bf H}_{k}{\bf\nabla E(w}_{k}+\mu_{k}{\bf v}_{k}).\vspace{-1mm}$
(1)

MoQ [2] showed that (1) can be approximated as

${\boldsymbol{\bf g}}_{k}={\bf H}_{k}[(1+\mu_{k})\nabla{\bf
E(w}_{k})-\mu_{k}\nabla{\bf E(w}_{k-1})].\vspace{-1.5mm}$ (2)

The $\mu_{k}$ value is updated using (3) where $\theta_{k+1}$ is obtained by
solving (4) with $\theta_{0}=1$ and $\gamma=10^{-5}$.

$\mu_{k}=\theta_{k}(1-\theta_{k})/({\theta_{k}}^{2}+\theta_{k+1}),\vspace{-1.5mm}$
(3)
${\theta_{k+1}}^{2}=(1+\theta_{k+1}){\theta_{k}}^{2}+\gamma\theta_{k+1}.\vspace{-1.5mm}$
(4)

In this paper, we propose limited-memory MoQ (L-MoQ) in which (2) is evaluated
by the two-loop recursion using the last $m$ curvature pairs $({\bf s},{\bf
y})$ given by,

$~{}~{}~{}~{}~{}~{}~{}~{}{\bf s}_{k}={\bf w}_{k+1}-({\bf w}_{k}+\mu_{k}{\bf
v}_{k})~{}~{}~{}{\rm and}~{}~{}\vspace{-1.5mm}$ ${\bf y}_{k}=\nabla{\bf
E(w}_{k+1})-[(1+\mu_{k})\nabla{\bf E(w}_{k})-\mu_{k}\nabla{\bf
E(w}_{k-1})]).\vspace{-1.5mm}$ (5)

##  III Simulation Results

$f(x_{1}\ldots
x_{n})=\frac{\pi}{n}\Bigr{\\{}\sum_{i=1}^{n-1}[(x_{i}-1)^{2}(1+10~{}{\rm
sin}^{2}(\pi x_{i+1}))]~{}~{}~{}~{}$ $~{}~{}~{}~{}~{}~{}~{}~{}~{}~{}+10~{}{\rm
sin}^{2}(\pi x_{1})+(x_{n}-1)^{2}\Bigl{\\}},x_{i}\in[-4,4],\forall i.$ (6)

The performance of L-MoQ is evaluated on Levy function (6) using a $5-50-1$ NN
with $k_{\rm max}=10000$, $\epsilon=10^{-6}$ and $m=16$. The number of
parameters is $d=351$. Fig. 1 and Table 1 show the average results of 50
trials. The number of function and gradient evaluations are denoted as $fev$
and $gev$, respectively. The results confirm that the proposed L-MoQ is a good
approximation to L-NAQ while having fewer $gev$ and maintaining the same
computational cost of L-BFGS i.e., $nd+4md+2d+\zeta nd$ and storage cost of
$(2m+1)d$.

TABLE I: Summary of results averaged over 50 trials. Method | $E{\bf(w)}$ | iters ($k$) | $fev$ | $gev$ | time(s)
---|---|---|---|---|---
L-BFGS | 0.000091 | 10000 | 28398 | 10001 | 81.95
L-NAQ | 0.000025 | 9927 | 20848 | 19854 | 95.21
L-MoQ | 0.000022 | 9961 | 20918 | 9962 | 73.73
Figure 1: Average training error over 50 trials.

## References

  * [1] S. Mahboubi et. al., “A novel training algorithm based on limited-memory quasi-Newton method with Nesterov’s accelerated gradient in neural networks and its application to highly-nonlinear modeling of microwave circuit.” IARIA Intl’ Journal on Adv. in Software, 11(3-4), pp. 323-334 (2018)
  * [2] S. Mahboubi, et. al., “Momentum Acceleration of Quasi-Newton Training for Neural Networks.” Proc. of PRICAI, Springer, pp. 268-281 (2019).


2010 Mathematics Subject Classification: 35J66, 49Q10.
Key words and phrases: $p$-Laplacian, Robin boundary conditions.

In this paper we consider a minimization problem of the type

$$	I_{\beta,p}(D;\Omega)=\inf\biggl\{\int_\Omega \abs{D\phi}^pdx+\beta \int_{\partial^* \Omega}\abs{\phi}^pd\mathcal{H}^{n-1},\; \phi \in W^{1,p}(\Omega),\;\phi \geq 1 \;\textrm{in}\;D\biggl\},$$

where $\Omega$ is a bounded connected open set in $\R^n$, $D\subset \bar{\Omega}$ is a compact set and $\beta$ is a positive constant.

We let the set $D$ vary under prescribed geometrical constraints and $\Omega \setminus D$ of fixed thickness, in order to look for the best (or worst) geometry in terms of  minimization (or maximization) of $I_{\beta,p}$. In the planar case, we show that under perimeter constraint the disk maximize $I_{\beta,p}$.
In the $n$-dimensional case we restrict our analysis to convex sets showing that the same is true for the ball but under different geometrical constraints.

§ INTRODUCTION

Insulation problems have interested many researchers and it's a very active field of research as it is related to environmental improvement. In fact, thermal insulation may be applied to save energy and even if it may seem counterintuitive, having too much insulation can have a negative impact on the energy efficiency; furthermore, adding too much insulation is expensive and unsustainable.

In this paper we consider a problem of this type: let $\Omega$ be a bounded connected open set of $\R^n$,  $D\subset \overline{\Omega}$ a compact set, $\beta>0$ a fixed constant.

\begin{equation}
\label{prob}
I_{\beta,p}(D;\Omega)=\inf\biggl\{\int_\Omega \abs{D\phi}^pdx+\beta \int_{\partial \Omega}\abs{\phi}^pd\mathcal{H}^{n-1},\; \phi \in W^{1,p}(\Omega),\;\phi \geq 1 \;\textrm{in}\;D\biggl\}.
\end{equation}

Our aim is to study maximization and minimization problems of $I_{\beta,p}(D,\Omega)$, among domains with given geometrical constraints.
If $\Omega$ has Lipschitz boundary, then there exists a minimizer $u$ of (<ref>) that satisfies

\begin{cases}
\Delta_p u=0\qquad &\textrm{in}\; \Omega \setminus \overline{D}\\
u=1 \qquad & \textrm{in}\; D\\
{\abs{Du}}^{p-2}\dfrac{\partial u}{\partial \nu}+\beta {\abs{u}}^{p-2}u=0 \qquad & \textrm{on}\; \partial \Omega
\end{cases}

$$\Delta_p u= \div(\abs{Du}^{p-2}Du)$$
is the $p$-Laplace operator, and the functional $I_{\beta, p}(\Omega, D)$ assumes the following form
$$I_{\beta,p}(\Omega, D)=\beta\int_{\partial\Omega}{\abs{u}}^{p-2}u\; d\mathcal{H}^{n-1}.$$

In this order of ideas, the case $p=2$ has been treated in [8]. In this case the minimization problem arises from a thermal insulation problem. Related results are also contained in [1, 2, 3, 6, 4, 5, 8, 9, 10, 11].
In the present paper we consider the general case $1<p< +\infty$.
The plan of the paper is the following: after recalling some well-known fact on convex domains in section <ref>, we prove some basic properties of $I_{\beta,p}(\Omega,D)$ in Section <ref>.

In section <ref>-<ref> we discuss our main results. First, we consider the domains $\Omega=D+\delta B$, with $\delta>0$; in the planar case studied in section <ref>, we found that if $D$ is an open, bounded, connected set of $\R^n$ with piecewise $C^1$ boundary, the maximum of $I_{\beta,p}(D, D+\delta B)$ is achieved at the disk having the same perimeter of $D$. In section <ref> we consider the $n$-dimensional case for convex sets and we obtain that among the convex sets $\Omega=D+\delta B$, with fixed $\delta$ and of given $W_{n-1}$ quermassintegral of $D$, the maximum is attained when $D$ is a ball.

Finally in section <ref>, we show a counterintuitive behaviour of the functional $I_{\beta,p}(D, \Omega)$; indeed we prove that for suitable values of $\beta$, there exists a positive constant $\delta_0$ such that for any bounded domain $\Omega$, with $D\subset \Omega$ and $\abs{\Omega}-\abs{D}<\delta_0$, then $I_{\beta,p}(B_R,\Omega)>I_{\beta,p}(B_R,B_R)$.

§ PRELIMINARIES

Here we list some basic facts on convex sets (see, for example [7, 12]). Let $K$ be a nonempty, bounded, convex set in $\R^n$ and let $\delta>0$. Then the Steiner formulas for the volume and the perimeter read as

\begin{aligned}
\abs{K+\delta B}&=\sum_{j=0}^{n}\binom{n}{j} W_j(K)\delta^j\\
&=\abs{K}+nW_1(K)\delta+\dfrac{n(n-1)}{2}W_2(K)\delta^2+\cdots+\omega_n \delta^n
\end{aligned}

\begin{equation}
\label{steinerconvex}
\begin{aligned}
P(K+\delta B)&=n \sum_{j=0}^{n-1}\binom{n-1}{j}W_{j+1}(K)\delta^j\\[5pt]
&=P(K)+n(n-1)W_2(K)\delta +\cdots +n\omega_n \delta^{n-1},
\end{aligned}
\end{equation}

where $B$ is the unit ball in $\R^n$ centered at the origin, whose measure is denoted by $\omega_n$  and $K+\delta B$ stands for the Minkowski sum.
The coefficients $W_j(K)$ are the so-called quermassintegrals of $K$. In particular $W_0$ is the volume of $K$, $W_1=\frac{P}{n}$ and $W_n=\omega_n$.

It immediately follows that

\begin{equation}
\label{12}
\lim\limits_{\delta \rightarrow 0^+}\dfrac{P(K+\delta B)-P(K)}{\delta}=n(n-1)W_2(K).
\end{equation}

If $K$ has $C^2$ boundary, with nonzero Gaussian curvature, the quermassintegrals are related to the principal curvatures of $\partial K$. Indeed, in such a case

\begin{equation}
\label{13}
W_i(K)=\frac{1}{n}\int_{\partial K} H_{i-1}(x)d\mathcal{H}^{n-1}, \qquad i=1,\cdots ,n.
\end{equation}

Here $H_j$ denotes the $j$-th normalized elementary symmetric function of the principal curvatures of $\partial K$, that is $H_0=1$, and

$$H_j(x)={\binom{n-1}{j} }^{-1}\sum_{1\leq i_1 \leq \cdots \leq i_j\leq n-1}{k_{i_1}(x)\cdots k_{i_j}(x)}, \qquad j=1, \cdots, n-1,$$

where $k_{1}(x)\cdots k_{n-1}(x)$ are the principal curvatures at a point $x \in \partial K$. In particular, by (<ref>) and (<ref>) we get also that

$$\lim\limits_{\delta \rightarrow 0^+}\dfrac{P(K+\delta B)-P(K)}{\delta}=(n-1)\int_{\partial K}H_1(x)d\mathcal{H}^{n-1},$$
where $H_1(x)$ is the mean curvature of $\partial K$ at a point $x$.
The Alexandrov-Fenchel inequalities state that

\begin{equation}
\label{14}
\biggl(\dfrac{W_j(K)}{\omega_n}\biggl)^{\frac{1}{n-j}}\geq \biggl(\dfrac{W_i(K)}{\omega_n}\biggl)^{\frac{1}{n-i}}, \qquad0\leq i < j \leq n-1,
\end{equation}

where the inequality is replaced by an equality if and only if $K$ is a ball.
In what follows, the Alexandrov-Fenchel inequalities will be used for particular values of $i$ and $j$. When $i=0$ and $j=1$, we have the classical isoperimetric inequality:

$$P(K)\geq n {\omega_n}^{\frac{1}{n}}{\abs{K}}^{1-\frac{1}{n}}.$$

Moreover, if $i=k-1,$ and $j=k$, we have

$$W_k(K)\geq {\omega_n}^{\frac{1}{n-k+1}} W_{k-1}(K)^{\frac{n-k}{n-k+1}}.$$

Let us denote by $K^*$ a ball such that $W_{n-1}(K)=W_{n-1}(K^*).$ Then by the Alexandrov-Fenchel inequalities (<ref>), for $0 \leq i < n-1$ it holds that

$$\biggl(\dfrac{W_i(K^*)}{\omega_n}\biggl)^{\frac{1}{n-i}}=\dfrac{W_{n-1}(K^*)}{\omega_n}=\dfrac{W_{n-1}(K)}{\omega_n}\geq \biggl(\dfrac{W_i(K)}{\omega_n}\biggl)^{\frac{1}{n-i}}, $$

\begin{equation}
\label{quer}
W_i(K)\leq W_i(K^*), \qquad 0\leq i\leq n-1.
\end{equation}

Now consider the the two dimensional case. For an open, bounded, connected set $D \subset \R^2$ we denote by $D^*$ the disk having the same perimeter of $D$. If $\Omega=D+\delta B$ and $\Omega_*=D^*+\delta_* B$, where $B$ is the disk centered at the origin, the Steiner formulae become
$$\abs{\Omega}=\abs{D}+P(D)\delta + \pi \delta ^2, \qquad P(\Omega)=P(D)+2\pi \delta$$

$$\abs{\Omega_*}=\abs{D^*}+P(D^*)\delta_* + \pi \delta_* ^2, \qquad P(\Omega_*)=P(D^*)+2\pi \delta_*.$$

Let us observe that, in our context, if we ask that the area of the insulating material $\Omega \setminus \overline{D}$ remains constant, then

$$\abs{\Omega}-\abs{D}=P(D)\delta +\pi \delta ^2=\abs{\Omega_*}-\abs{D^*}=P(D^*)\delta_*+\pi \delta_*^2.$$

Since $P(D)=P(D^*)$, then $\delta=\delta_*$ and, as byproduct, $P(\Omega)=P(\Omega_*)$. On the contrary, if $\delta=\delta_*$, then $\abs{\Omega}-\abs{D}=\abs{\Omega_*}-\abs{D^*}$.

For a general bounded domain with piecewise $C^1$ boundary, it holds that

\begin{equation}
\label{steiner}
\abs{\Omega}\leq\abs{D}+P(D)\delta + \pi \delta ^2, \qquad P(\Omega) \leq P(D)+2\pi \delta,
\end{equation}

hence $\delta = \delta_*$ implies

$$\abs{\Omega}-\abs{D}\leq \abs{\Omega_*}-\abs{D^*},$$

which means that the area of the insulating material increases keeping fixed the perimeter $P(D)$ and the thickness $\delta$.

§ THE VARIATIONAL PROBLEM

Given a compact set $D$ in $\R^n$ and a bounded connected open set $\Omega$ of $\R^n$ with $D \subset \bar{\Omega}$, we are interested to study

\begin{equation}
\label{funzionale}
I_{\beta,p}(\Omega, D)=\inf\left\{\int_\Omega \abs{D\phi}^{p}dx+\beta\int_{\partial^{*}\Omega}\abs{\phi}^{p}d\mathcal{H}^{n-1},\; \phi\in W^{1,p}(\Omega),\; \phi \geq 1 \;\text{in}\; \overline{D}\right\},
\end{equation}

with $\beta>0$. The following result holds.

If $\Omega$ is bounded connected open set of $\R^n$ with Lipschitz boundary, and $D$ is a compact set with $D\subset \Omega$, then there exists a unique positive minimizer $u \in W^{1,p}(\Omega)$ of (<ref>) such that satisfies

\begin{equation}
\label{theproblem}
\begin{cases}
\Delta_p u=0\qquad &\textrm{in}\; \Omega \setminus \overline{D}\\
u=1 \qquad & \textrm{in}\; D\\
{\abs{Du}}^{p-2}\dfrac{\partial u}{\partial \nu}+\beta {\abs{u}}^{p-2}u=0 \qquad & \textrm{on}\; \partial \Omega
\end{cases}
\end{equation}

Moreover the functional can be written as

\begin{equation}
\label{8bis}
I_{\beta,p}(\Omega, D)=\beta\int_{\partial\Omega}{u}^{p-1}\; d\mathcal{H}^{n-1},
\end{equation}

where $u$ is the solution to (<ref>).

The proof follows by a standard application of a calculus of variation's argument. We sketch the proof for completeness.

Let $u_n$ be a minimizing sequence for $I_{\beta,p}(\Omega, D)$. Then $u_n$ is bounded in $W^{1,p}$, $\exists u_{n_k} \rightarrow u$ weakly in $W^{1,p}(\Omega)$, strongly in $L^p$ and a.e in $\Omega$. Then by semicontinuity, $u$ is a minimizer of $I_{\beta,p}(\Omega, D)$. Moreover, being $\abs{u}$ still a minimizer, we can assume $u \geq 0$. By Harnack, $u>0$ in $\Omega$. Furthermore, by convexity, $u$ is the unique minimizer and it satisfies

\begin{cases}
\Delta_p u=0\qquad &\textrm{in}\; \Omega\\
u=1 \qquad & \textrm{in}\; \bar{D}\\
{\abs{Du}}^{p-2}\dfrac{\partial u}{\partial \nu}+\beta {u}^{p-1}=0 \qquad & \textrm{on}\; \partial \Omega
\end{cases}

If we denote with $W^{1,p}_{\overline{D}}(\Omega)$ the closure in $W^{1,p}(\Omega)$ of $\{\phi|_{\Omega}: \phi \in C^{\infty}(\R^n) \;\textrm{with}\; \bar{D} \cap \supp\phi=\emptyset\}$, this is true, by definition, if and only if

$$\int_{\Omega\setminus \overline{D}}\abs{Du}^{p-2}Du D\phi\;dx+\beta\int_{\partial \Omega}u^{p-1}\phi\;d\mathcal{H}^{n-1}=0$$

for any $\phi \in W^{1,p}_{\overline{D}}(\Omega)$.

So, if we take $\phi=u-1\in W^{1,p}_{\overline{D}}(\Omega)$,

$$\int_\Omega {\abs{Du}}^{p-2}Du(Du)\;dx+\beta \int_{\partial\Omega}u^{p-1}u(u-1)\;d\mathcal{H}^{n-1}=0$$

that is

$$\int_\Omega (Du)^{p}\;dx+\beta \int_{\partial\Omega}({u}^{p}-{u}^{p-1})\;d\mathcal{H}^{n-1}=0$$

and this implies (<ref>).

§ THE PLANAR CASE

In this section we consider the case where $\Omega$ is the Minkowski sum
$$\Omega=D+\delta B,$$
$B$ is the unit ball centered at the origin and $\delta$ is a positive constant, representing the thickness of $\Omega\setminus D$. Then we set
$$I_{\beta,p,\delta}(D)=I_{\beta,p}(D,D+\delta B).$$

Let $D$ be an open, bounded connected set of $\R^{2}$ with piecewise $C^{1}$ boundary. Then
$$I_{\beta,p,\delta}(D)\leq I_{\beta,p,\delta}(D^*),$$

where $D^*$ is the disk having the same perimeter of $D$.

Let $v$ be the radial minimizer of $I_{\beta, p,\delta}(D^*)$ and $\Omega_*=D^*+\delta B$. Given $R$, the radius of $D^*$, then denote by

Being $v$ radial, the modulus of the gradient of $v$ is constant on the level lines of $v$.
Let us consider the function
$$g(t)=\abs{Dv}_{v=t},\qquad v_m<t\leq1$$

$$w(x)=G(R+d(x)),\;\; x\in\Omega,\qquad \textrm{where}\;\; G^{-1}(t)=R+\int_{t}^{1}\dfrac{1}{g(s)}ds$$

and $d(x)$ is the distance of a point $x$ from $D$. In particular, $v$ is decreasing and the function $g$ can be zero only for $v=1$. This means that $G^{-1}$ is decreasing, therefore so is $G$ and then $w\in W^{1,p}(\Omega)$. It results:

\begin{aligned}
& \max_{\Omega}w=w\rvert_{\partial D}=1=G(R),\\
& w_m=\min_{\Omega}w=w\rvert_{\partial\Omega}=G(R+\delta)=v_m,\\
&\abs{Dw}_{w=t}=\abs{Dv}_{v=t}=g(t),\;\;w_m\leq t\leq1.
\end{aligned}

Hence $w$ is a test function. Then
$$I_{\beta,p,\delta}(D)\leq\int_{\Omega\setminus D}{\abs{Dw}}^p \;dx+\beta \int_{\partial\Omega}{\abs{w}}^p\;d\mathcal{H}^{1}.$$

$$E_t=\{x\in \Omega:w(x)>t\}=\{x\in \Omega:d(x)<G^{-1}(t)\}=D+G^{-1}(t)B$$

and let

By Steiner formula (<ref>) we get

$$P(\Omega)\leq P(D)+2\pi\delta,$$

$$P(E_t)\leq P(D)+2\pi G^{-1}(t)=P(D^*)+2\pi G^{-1}(t)=2\pi (R+G^{-1}(t))=P(B_t)$$

for every $t \in\; ]w_m,1]$.

$$\int_{w=t} \abs{Dw}d\mathcal{H}^1=\int_{w=t}g(t)d\mathcal{H}^1
=g(t)P(E_t)\leq g(t)P(B_t)=\int_{v=t}\abs{Dv}d\mathcal{H}^1,\qquad w_m<t\leq1.$$

Then, by co-area formula

\begin{equation}
\label{eq1}
\begin{aligned}
\int_{\Omega\setminus \overline{D}}{\abs{Dw}}^{p}dx&=\int_{w_m}^{1}dt\int_{w=t}{\abs{Dw}}^{p-1}d\mathcal{H}^1\\
&=\int_{\Omega\setminus \overline{D}_*}{\abs{Dv}}^p dx.
\end{aligned}
\end{equation}

Since by construction $w=w_m=v_m$ on $\partial \Omega$ and $P(\Omega)=P(\Omega_*)$, we have

\begin{equation}
\label{eq2}
\int_{\partial\Omega} {\abs{w}}^p d\mathcal{H}^1={\abs{w_m}}^{p}P(\Omega)={\abs{v_m}}^pP(\Omega_*)=\int_{\partial \Omega_*}{\abs{v}}^p d\mathcal{H}^1.
\end{equation}

Hence, by (<ref>) and (<ref>) it holds that

\begin{aligned}
I_{\beta,p, \delta}(D)\leq\int_{\Omega\setminus D}{\abs{Dw}}^pdx+\beta\int_{\partial \Omega} {\abs{w}}^pd\mathcal{H}^1
&\leq \int_{\Omega_*\setminus D^*}{\abs{Dv}}^pdx+\beta\int_{\partial \Omega_*}{\abs{v}}^pd\mathcal{H}^1=I_{\beta,p, \delta}(D^*).
\end{aligned}

§ THE $N$-DIMENSIONAL CASE

Now we prove that in higher dimension ($n \geq 3$) balls still maximize $I_{\beta, p, \delta}$, but our result finds its natural generalization in the class of convex domains $D$.

Let $D$ be an open, bounded, convex set of $\R^n$. Then
$$I_{\beta,p,\delta}(D)\leq I_{\beta,p,\delta}(D^*),$$

where $D^*$ is the ball having the same $W_{n-1}$ quermassintegral of $D$, that is $W_{n-1}(D)=W_{n-1}(D^*)$.

Let be $\Omega_*=D^*+\delta B$, and $v$ the radial minimizer of $I_{\beta,p,\delta}(D^*)$. Since $\Omega=D+\delta B$, Steiner formula for the perimeter (<ref>) and Aleksandrov-Fenchel inequalities (<ref>) imply $P(\Omega)\leq P(\Omega^*)$.

We denote by $v_m=v(R+\delta)=\min_{\Omega^*}v$ and by $\max_{\Omega_*}v=v(R)=1$. Being $v$ radial, the modulus of the gradient of $v$ is constant on the level lines of $v$.
Let us consider the function
$$g(t)=\abs{Dv}_{v=t},\qquad v_m<t\leq1$$

$$w(x)=G(R+d(x)),\;\; x\in\Omega,\qquad \textrm{where}\;\; G^{-1}(t)=R+\int_{t}^{1}\dfrac{1}{g(s)}ds,$$

and $d(x)$ is the distance of a point $x$ from $D$.
By construction $w\in 	W^{1,p}(\Omega)$ and being $G$ decreasing it results:

\begin{aligned}
& \max_{\Omega}w=w\rvert_{\partial D}=1=G(R),\\
& w_m=\min_{\Omega}w=w\rvert_{\partial\Omega}=G(R+\delta)=v_m,\\
&\abs{Dw}_{w=t}=\abs{Dv}_{v=t}=g(t),\;\;w_m\leq t\leq1.
\end{aligned}

$$I_{\beta,p,\delta}(D)\leq\int_{\Omega\setminus D}{\abs{Dw}}^p \;dx+\beta \int_{\partial\Omega}{\abs{w}}^p\;d\mathcal{H}^{n-1}.$$

$$E_t=\{x\in \Omega:w(x)>t\}=\{x\in \Omega:d(x)<G^{-1}(t)\}=D+G^{-1}(t)B$$

Being $W_{n-1}(D)=W_{n-1}(D^*)$, using the Steiner formula and (<ref>), we get for $w_m<t\leq 1$ and $\rho=G^{-1}(t)$ that

P(E_t)=P(D+\rho B)&=n \sum_{n=0}^{n-1}\binom{n-1}{k}W_{k+1}(D)\rho^k\\
& \leq \sum_{n=0}^{n-1}\binom{n-1}{k}W_{k+1}(D^*)\rho^k=P(D^*+\rho B)=P(B_t).\\
\end{aligned}

$$\int_{w=t} \abs{Dw}d\mathcal{H}^{n-1}=g(t)P(E_t)\leq g(t)P(B_t)=\int_{v=t}\abs{Dv}d\mathcal{H}^{n-1}, \qquad w_m<t\leq 1$$

then, by co-area formula

\int_{\Omega\setminus D}{\abs{Dw}}^{p}dx
&=\int_{\Omega\setminus D_*}{\abs{Dv}}^p dx.
\end{aligned}

Since by construction $w=w_m=v_m$ on $\partial \Omega$ and $P(\Omega)\leq P(\Omega_*)$, we have

$$ \int_{\partial\Omega} {\abs{w}}^p d\mathcal{H}^ {n-1}={\abs{w_m}}^{p}P(\Omega)={\abs{v_m}}^pP(\Omega_*)=\int_{\partial \Omega_*}{\abs{v}}^p d\mathcal{H}^{n-1}.$$

\begin{aligned}
I_{\beta,p, \delta}(D)&\leq\int_{\Omega\setminus D}{\abs{Dw}}^pdx+\beta\int_{\partial \Omega} {\abs{w}}^pd\mathcal{H}^{n-1}\\
&\leq \int_{\Omega_*\setminus D^*}{\abs{Dv}}^pdx+\beta\int_{\partial \Omega_*}{\abs{v}}^pd\mathcal{H}^{n-1}=I_{\beta,p, \delta}(D^*).
\end{aligned}

§ REMARKS

There is a counterintuitive behaviour of the functional $I_{\beta,p,\delta}(D,\Omega)$ when $\Omega$ and $D$ are concentric balls, which is very peculiar and that can be summarized in next two propositions.

Let $B_R$ be a ball of radius $R$. If $\beta\geq\biggl[\dfrac{n-1}{R(p-1)}\biggl]^{p-1}$ then $I_{\beta,p, \delta}(B_R)$ is decreasing in $\delta$. When $\beta<\biggl[\dfrac{n-1}{R(p-1)}\biggl]^{p-1}$, then $I_{\beta,p,\delta}(B_R)$ is increasing for $\delta<\biggl(\dfrac{n-1}{p-1}\biggl)\dfrac{1}{{\beta}^{\frac{1}{p-1}}}-R$ and decreasing for $\delta>\biggl(\dfrac{n-1}{p-1}\biggl)\dfrac{1}{{\beta}^{\frac{1}{p-1}}}-R$.

If $D=B_R$ is a ball with radius $R$, then obviously $\Omega=B_R+\delta B=B_{R+\delta}$ and the minimum of (<ref>), $u(x)=u(r)$, is

\begin{equation}
\label{sol}
\begin{cases}
1-{\gamma_1}^{\frac{1}{p-1}}\biggl(\dfrac{p-1}{p-n}\biggl)R^{\frac{p-n}{p-1}}\biggl[\biggl(\dfrac{r}{R}\biggl)^{\frac{p-n}{p-1}}-1\biggr] \qquad & p\not =n\\
1-{\gamma_1}^{\frac{1}{n-1}}\log {\frac{r}{R}} \qquad &p=n
\end{cases}
\end{equation}

for a suitable constant $\gamma_1$. This follows from the fact that

$$r^{n-1}\Delta_p u= \frac{d}{dr}(r^{n-1}\abs{u'(r)}^{p-2}u'(r))=0,$$

but $u$ is decreasing and positive, then

$$u'(r)=-\dfrac{{\gamma_1}^{\frac{1}{p-1}}}{{r}^{\frac{n-1}{p-1}}}, \qquad r \in [R,R+\delta]$$

If $p \not = n$, then integrating by parts and keeping in mind that $u(R)=1$ it holds

If $p=n$,

$$u(r)=-{\gamma_1}^{\frac{1}{n-1}}\log \dfrac{r}{R} + 1.$$

Now, we can find $\gamma_1$ using the boundary conditions.

If $p\not =n$,then using Robin condition on $\partial\Omega$ it holds that

By using the explicit expression of $u$,

$${\gamma_1}^{\frac{1}{p-1}}(R+\delta)^{-\frac{n-1}{p-1}}=\beta^{\frac{1}{p-1}}\biggl(-{\gamma_1}^{\frac{1}{p-1}}\biggl(\dfrac{p-1}{p-n}\biggl) R^{\frac{p-n}{p-1}}\biggl(1-\biggl(\dfrac{R+\delta}{R}\biggl)^{\frac{p-n}{p-1}}\biggl)+1\biggl)$$

and we have that

In particular,

$$\int_{\partial (\Omega\setminus D)}  ({\abs{Du}}^{p-2}Du \cdot \nu)\;d\mathcal{H}^{n-1}=0$$

and using the divergence theorem

$$-\int_{\Omega\setminus D}{\abs{Du}}^{p}+\int_{\partial (\Omega \setminus D)}u({\abs{Du}}^{p-2}Du \cdot \nu)=0$$

$$-\int_{\Omega\setminus D}{\abs{Du}}^{p}-\int_{\partial \Omega} \beta u^p+\int_{\partial D} u({\abs{Du}}^{p-2}Du \cdot \nu)=0.$$

This implies that

$$I_{\beta,p,\delta}(B_R)=\int_{\partial B_R} {\abs{Du}}^{p-2}\dfrac{\partial u}{\partial \nu}\;d\mathcal{H}^{n-1}.$$

Let us observe that

and we have

$$\partial_\delta \biggl[(R+\delta)^{\frac{1-n}{p-1}}+\beta^{\frac{1}{p-1}}\biggl(\dfrac{p-1}{p-n}\biggl)R^{\frac{p-n}{p-1}}\biggl(\biggl(\dfrac{R+\delta}{R}\biggl)^{\frac{p-n}{p-1}}-1\biggl)\biggl]>0$$

and this is true if

On the other hand, when $p=n$ we have

$$\partial_\delta [I_{\beta,p,\delta}(B_R)]<0$$

and this is true if and only if

$$\delta > \dfrac{1}{\beta^{\frac{1}{n-1}}}-R,$$

and the proposition is proved.

To show next result, we first need the following Lemma, using the following notation.
Let $D=B_R \subset \Omega$, and denote by

\begin{aligned}
&=\omega_nR^n,\;\Delta P=P(\Omega)-P(B_R),\;\Delta V=\abs{\Omega}-\abs{B_R}.
\end{aligned}

Let $D=B_R$ and $B_R \subset \Omega$. For any $\delta_0>0$, there exists a constant
$$C=\dfrac{n\omega_n R^{n-1}}{\delta_0}\biggl[\biggl(1+\dfrac{\delta_0}{\omega_n R^n}\biggl)^{1-\frac{1}{n}}-1\biggl]$$

such that if $\Delta V\leq \delta_0$ it holds that
$$\Delta P \geq C\Delta V.$$

We refer to [8] for the proof.
Now, we want to prove that, in the regime $\beta$ "small", if the thickness $\delta$ is below a certain threshold value, $I_{\beta,p}(B_R,\Omega)$ is greater then $I_{\beta,p}(B_R,B_R)$.

Let $D=B_R(0)$ and $\beta<\biggl[\dfrac{n-1}{R(p-1)}\biggl]^{p-1}$. Then there exists a positive constant $\delta_0$ such that for any bounded domain $\Omega$, with $D\subset \Omega$ and $\abs{\Omega}-\abs{D}<\delta_0$, then

Let $u$ be the minimizer of $I_{\beta,p}(B_R,\Omega)$. Consider

$$\Sigma=\Omega \setminus B_R, \qquad\Gamma_m=\partial \Omega \setminus \partial B_R, \qquad \Gamma_t=\partial \{u>t\}\setminus\partial B_R, \qquad \Gamma_1=\partial B_R \cap \Omega$$

$$p(t)=P(\{u>t\}\cap \Sigma), \qquad \textrm{for a.e.}\;t>0.$$

We want to show that

$$I_{\beta,p}(B_R;B_R)=\beta P(B_R)< I_{\beta,p}(B_R;\Omega)=\int_\Omega {\abs{Du}}^p dx+\beta \int_{\partial\Omega} {\abs{u}}^p d\mathcal{H}^{n-1}$$

or equivalently
$$\mathcal{H}^{n-1}(\Gamma_1)<\frac{1}{\beta}\int_{\Omega}{\abs{Du}}^p dx+\int_{\Gamma_0} {\abs{u}}^p d\mathcal{H}^{n-1}$$

then using coarea formula and Fubini theorem we have

\begin{equation}
\label{eq1}
\begin{aligned}
\int_{0}^{1} t^{p-1}p(t)dt&=\int_{0}^{1}       t^{p-1}P(\{u>t\}\cap \Sigma)dt\\\\
&= \int_{0}^{1}\biggl(\int_{\Gamma_1} t^{p-1} d\mathcal{H}^{n-1}\biggl)dt+\int_{0}^{1}\biggl(\int_{\Gamma_t \cap \Omega} t^{p-1} d\mathcal{H}^{n-1}\biggl)dt+ \int_{0}^{1}\biggl(\int_{\Gamma_t \cap \partial \Omega} t^{p-1} d\mathcal{H}^{n-1}\biggl)dt\\\\
&=\dfrac{\mathcal{H}^{n-1}(\Gamma_1)}{p}+ \dfrac{1}{p} \int_{\Gamma_0}u^p d\mathcal{H}^{n-1}+ \int_{\Omega} u^{p-1}\abs{Du}dx.
\end{aligned}
\end{equation}

From the Lemma <ref> we know that for $\abs{\Sigma}<\delta_0$, with $\delta_0$ fixed,

$$p(t)-2\mathcal{H}^{n-1}(\Gamma_1)\geq C \mu (t)$$

and then

$$ \int_{0}^{1}t^{p-1}p(t)dt \geq 2 \int_{0}^{1}t^{p-1}\mathcal{H}^{n-1}(\Gamma_1)dt+ C \int_{0}^{1}t^{p-1}\mu(t)dt=\dfrac{2}{p}\mathcal{H}^{n-1}(\Gamma_1)+\dfrac{C}{p}\int_{\Omega} u^p dx,$$

where $C$ is the constant of the Lemma <ref>.
Hence, substituing in (<ref>)

$$\dfrac{2}{p}\mathcal{H}^{n-1}(\Gamma_1)+\dfrac{C}{p}\int_{\Omega}u^p dx \leq \dfrac{\mathcal{H}^{n-1}(\Gamma_1)}{p}+ \dfrac{1}{p}\int_{\Gamma_0}u^p d\mathcal{H}^{n-1}+\int_{\Omega}u^{p-1}\abs{Du}dx.$$

On the other hand, by the Young inequality

$$\int_{\Omega} u^{p-1}\abs{Du}dx \leq \dfrac{p-1}{p\epsilon^{\frac{1}{p-1}}}\int_{\Omega}u^pdx+\dfrac{\epsilon}{p}\int_{\Omega} {\abs{Du}}^pdx$$

$$\mathcal{H}^{n-1}(\Gamma_1)+ C\int_{\Omega}{\abs{u}}^pdx \leq \int_{\Gamma_0}u^p d\mathcal{H}^{n-1}+\dfrac{p-1}{\epsilon^{\frac{1}{p-1}}}\int_{\Omega} u^pdx+ \epsilon \int_{\Omega}{\abs{Du}}^pdx=$$

$$=\int_{\Gamma_0} u^p d\mathcal{H}^{n-1}+\dfrac{p}{\epsilon^{\frac{1}{p-1}}}\int_{\Omega}u^pdx-\dfrac{1}{\epsilon^{\frac{1}{p-1}}}\int_{\Omega} u^pdx+\epsilon \int_{\Omega} {\abs{Du}}^pdx$$

and choosing $\epsilon=\dfrac{1}{\beta}$ it holds that

$$\mathcal{H}^{n-1}(\Gamma_1)+[C-\beta^{\frac{1}{p-1}}(p-1)]\int_{\Omega}u^pdx \leq \int_{\Gamma_0} u^p d\mathcal{H}^{n-1}+\dfrac{1}{\beta}\int_{\Omega} {\abs{Du}}^pdx.$$

Then, being $R<\dfrac{n-1}{(p-1)\beta^{\frac{1}{p-1}}}$, for $\delta_0$ sufficiently small the constant $C$ is larger then $\beta^{\frac{1}{p-1}}(p-1)$ and thesis follows.

§ ACKNOWLEDGMENTS

This work has been partially supported by GNAMPA of INdAM.
tocchapter Bibliografia

[1]
E. Acerbi and G. Buttazzo.
Reinforcement problems in the calculus of variations.
Ann. Inst. H. Poincaré Anal. Non Linéaire,
3(4):273–284, 1986.

[2]
H. Brézis, L. A. Caffarelli, and A. Friedman.
Reinforcement problems for elliptic equations and variational
Ann. Mat. Pura Appl. (4), 123:219–246, 1980.

[3]
D. Bucur and G. Buttazzo.
Variational methods in shape optimization problems, volume 65
of Progress in Nonlinear Differential Equations and their Applications.
Birkhäuser Boston, Inc., Boston, MA, 2005.

[4]
D. Bucur, G. Buttazzo, and C. Nitsch.
Symmetry breaking for a problem in optimal insulation.
J. Math. Pures Appl. (9), 107(4):451–463, 2017.

[5]
D. Bucur, G. Buttazzo, and C. Nitsch.
Two optimization problems in thermal insulation.
Notices Amer. Math. Soc., 64(8):830–835, 2017.

[6]
D. Bucur, M. Nahon, C. Nitsch, and C. Trombetti.
Shape optimization of a thermal insulation problem, 2021.

[7]
Y. D. Burago and V. A. Zalgaller.
Geometric inequalities, volume 285 of Grundlehren der
mathematischen Wissenschaften [Fundamental Principles of Mathematical
Springer-Verlag, Berlin, 1988.
Translated from the Russian by A. B. Sosinskiĭ, Springer Series
in Soviet Mathematics.

[8]
F. Della Pietra, C. Nitsch, and C. Trombetti.
An optimal insulation problem.
Math. Ann., 382(1-2):745–759, 2022.

[9]
J. Denzler.
Windows of given area with minimal heat diffusion.
Trans. Amer. Math. Soc., 351(2):569–580, 1999.

[10]
P. Esposito and G. Riey.
Asymptotic behaviour of a thin insulation problem.
J. Convex Anal., 10(2):379–388, 2003.

[11]
A. Friedman.
Reinforcement of the principal eigenvalue of an elliptic operator.
Arch. Rational Mech. Anal., 73(1):1–17, 1980.

[12]
R. Schneider.
Convex bodies: the Brunn-Minkowski theory, volume 151 of
Encyclopedia of Mathematics and its Applications.
Cambridge University Press, Cambridge, expanded edition, 2014.


# Learning-to-Learn Personalised Human Activity Recognition Models

Anjana Wijekoon, Nirmalie Wiratunga
School of Computing and Digital Media
Robert Gordon University
Aberdeen, UK
<EMAIL_ADDRESS>
This work is part funded by selfBACK which has received funding from the
European Union’s Horizon 2020 research and innovation programme under grant
agreement No 689043.

###### Abstract

Human Activity Recognition (HAR) is the classification of human movement,
captured using one or more sensors either as wearables or embedded in the
environment (e.g. depth cameras, pressure mats). State-of-the-art methods of
HAR rely on having access to a considerable amount of labelled data to train
deep architectures with many train-able parameters. This becomes prohibitive
when tasked with creating models that are sensitive to personal nuances in
human movement, explicitly present when performing exercises. In addition, it
is not possible to collect training data to cover all possible subjects in the
target population. Accordingly, learning personalised models with few data
remains an interesting challenge for HAR research. We present a meta-learning
methodology for learning to learn personalised HAR models for HAR; with the
expectation that the end-user need only provides a few labelled data but can
benefit from the rapid adaptation of a generic meta-model. We introduce two
algorithms, Personalised MAML and Personalised Relation Networks inspired by
existing Meta-Learning algorithms but optimised for learning HAR models that
are adaptable to any person in health and well-being applications. A
comparative study shows significant performance improvements against the
state-of-the-art Deep Learning algorithms and the Few-shot Meta-Learning
algorithms in multiple HAR domains.

##  1 Introduction

Machine Learning research in Human Activity Recognition (HAR) has a wide range
of high impact applications in gait recognition, fall detection, orthopaedic
rehabilitation and general fitness monitoring. HAR involves the task of
learning reasoning models to recognise activities from human movements
inferred from streams of sensor data. A data instance, in a HAR dataset,
contains sensor data streams collected from individuals (i.e. person data).
Unavoidably, sensor streams capture personal traits and nuances in some
activity domains more than others. Typically with activities that involve
greater degrees of freedom. Learning a single reasoning model to recognise the
set of activity classes in a HAR task can be challenging because of the need
for personalisation.

We propose it is more intuitive to treat a “person-activity” pair as the class
label. This means for example if two people were to perform the same movement
activity, they should be treated as separate classes because they are executed
by 2 different people. Accordingly, each person’s data can be viewed as a
dataset in its own right, and the HAR task involves learning a reasoning model
for the person. Learning from only specific persons’ data has shown
significant performance improvements in early research with both supervised
learning and active learning methods Tapia et al. (2007); Longstaff et al.
(2010). But these methods require considerable amounts of data obtained from
the end-user, periodical end-user involvement and model re-training. In
addition, current state-of-the-art Deep Learning algorithms require a large
number of labelled data instances to avoid under-fitting.

Here we adopt the “person-activity” classes idea but attempt to learn with a
limited number of data instances per class. This can be viewed as a Few-shot
classification scenario Vinyals et al. (2016); Snell et al. (2017) where the
aim is to learn with one or few data instances and is commonly evaluated with
datasets such as Omniglot (1623 classes) and MiniImagenet (100 classes), but
only limited by the number of data instances available for each class. Meta-
Learning is arguably the state-of-the-art in Few-shot classification for image
recognition Finn et al. (2017); Nichol et al. (2018). In a nutshell, Meta-
Learning is described as learning-to-learn, where a wide range of tasks
abstract their learning to a meta-model, such that, it is transferable to any
unseen task. Meta-Learning algorithms such as MAML Finn et al. (2017),
Relation Networks (RN) Sung et al. (2018) are grounded in theories of Metric
Learning and parametric optimisation, and capable of learning generalised
models, rapidly adaptable to new tasks with only a few instances of data.

The concept of learning-to-learn aligns well with personalisation where
modelling a person can be viewed as a single task; whereby the meta-model must
help learn a model that is rapidly adaptable to a new person. We propose
Personalised Meta-Learning to create personalised models, by leveraging a
small amount of sensing data (i.e. calibration data) extracted from a person.
Accordingly, in this paper we make the following contributions,

  1. 1.

formalise Personalised Meta-Learning and propose two Personalised Meta-
Learning Algorithms, Personalised MAML and Personalised RN;

  2. 2.

perform a comparative evaluation with 9 HAR datasets representing a wide range
of activity domains to evidence the utility of Personalised Meta-Learning
algorithms over conventional Deep Learning and Few-shot Meta-Learning
algorithms;

  3. 3.

analyse train and test results of personalised vs. conventional meta-learners
to understand how personalisation enhanced meta-learners that are able to
adapt a generalised model at deployment; and

  4. 4.

present an exploratory study to explore hyper-parameter selection of
personalised meta-learners.

Overall, we observe that the performance improvements achieved by Personalised
Meta-Learning is possible using simple parametric models with limited number
of trainable parameters that only require a limited amount of labelled data
compared to conventional DL models. The rest of the paper is organised as
follows: Section 2 explore past research, challenges in the areas of
Personalised HAR. Section 3 introduces the state-of-the art in Meta-Learning
and our proposed approach and algorithms for Personalised Meta-Learning is
presented in Section 4. Next we present our comparative study, including
datasets and evaluation methodology in Section 5. In Section 6 we compare how
personalisation improve the performance of Meta-Learners and in Section 7 we
explore a number of hyper-parameters for optimal performance of Personalised
Meta-Learners. Finally a discussion on practical implication, limitations and
planned future work are presented in Section 8 and we present our conclusions
in Section 9.

##  2 Related Work

Human Activity Recognition (HAR) is an active research challenge, where Deep
Learning (DL) methods claim the state-of-the-art in many application domains
Wijekoon et al. (2019); Wang et al. (2019); Ordóñez & Roggen (2016); Yao et
al. (2017). Learning a generalised reasoning model adaptable to many user
groups is a unique transfer learning challenge in the HAR domain. Sensors
capture many personal nuances, that are most prominent in application domains
such as Exercises or Activities of Daily Living (ADL), leading to poor
performance. Given access to large quantities of end-user data, early research
has achieved improved performance by learning personal models Tapia et al.
(2007); Berchtold et al. (2010). Follow on work attempts to reduce the burden
on end-user, by adopting semi-supervised Longstaff et al. (2010); Miu et al.
(2015), active learning Longstaff et al. (2010) and multi-task Sun et al.
(2012) methods that rely on periodical model re-training and continuous user
involvement post-deployment.

Recent advancements in Few-shot Learning are adopted as an approach to
personalisation in Personalised Matching Networks ($MN^{p}$) Wijekoon et al.
(2020); Vinyals et al. (2016). $MN^{p}$ learns a parametric model, that is
learning to match, leveraging a few data instances from the same user. At
deployment, the network successfully transfers the learning to new users given
only a few labelled data instances for matching, obtained through one-time
micro-interactions. This approach avoids post-deployment re-training and only
require a few data instances from the end-user. While this method achieves
significant performance improvement over conventional methods in HAR, we
believe moderated post-deployment re-training can be beneficial for improving
personalisation.

Meta-Learning is an interesting approach that will facilitate Few-shot
Learning and post-deployment re-training for adaptation. Meta-Learning or
“Learning-to-learn” is the learning of a generalised classification model that
is transferable to new learning tasks with only a few instances of labelled
data. In recent research it is interpreted and implemented mainly in three
approaches; firstly, “learning to match” approach implemented by Relation
Networks (RN) Sung et al. (2018); secondly, model-specific approach like SNAIL
Mishra et al. (2017); and finally, optimisation based algorithms such as MAML
Finn et al. (2017) and Reptile Nichol et al. (2018).

MAML, including its variants such as First-Order MAML Finn et al. (2017) and
Reptile Nichol et al. (2018), is an optimisation based Meta-Learning
algorithm, learns a generalised model rapidly adaptable to any new task.
Notably, these models are model-agnostic, which increases the adaptability in
new domains where different feature-representation are preferred. In contrast,
there exist, model-specific Meta-Learning algorithms, such as SNAIL Mishra et
al. (2017) and MANN Santoro et al. (2016), where Meta-Learning is achieved
using specific neural network constructs such as LSTM and Neural Turing
Machine Graves et al. (2014). Model-agnostic methods are preferred in a HAR
setting, where heterogeneous sensor modalities or modality combinations may
require specific feature representation learning methods. Relation Networks
(RN) Sung et al. (2018) are “learning to match” by learning similarity
relationships. While there are significant commonalities between the Few-shot
Learning algorithm MN Vinyals et al. (2016) and RN, it is not limited by a
distance metric for similarity calculation. The parametric model for
similarity learning in RN, enhances the learning from a Few-shot classifier to
a generalised meta-model.

In comparison to model-agnostic and model specific methods, RN is also model-
agnostic where the architecture is modularised Sung et al. (2018) such that
the feature representation learning can be adapted to suit the HAR task. In
contrast to model-agnostic and model-specific methods, RN has the potential to
perform Open-ended HAR, by modelling the classification task as a matching
task (i.e. no softmax layer with fixed class length) similar to Open-ended
Matching Networks Wijekoon et al. (2020). In this paper we explore
personalisation of Meta-Learning for HAR with two algorithms, MAML and RN.
Personalised Meta-Learners will only require limited interaction with the end-
user to obtain few data instances and facilitate optional post-deployment re-
training, which are both essential features for personalised HAR.

##  3 Meta-Learning

Figure 1: Meta-Learning Tasks with Omniglot Dataset

Meta-Learning learns a meta-model, $\theta$, trained over many tasks, where a
task is equivalent to a “data instance” or ”labelled example” in conventional
Machine Learning (ML). In practice, meta-learning is implemented as an
optimisation over the set of tasks to learn a generalised model (i.e. meta-
model $\theta$) that can be rapidly transferred to new, seen or unseen tasks.
The concept of Meta-Learning is implemented in many branches of Machine
Learning (ML), such as Few-shot learning, Reinforcement Learning and
Regression, and here our focus is Few-shot Learning.

In Few-shot classification, Meta-Learning can be seen as optimisation of a
parametric model over many few-shot tasks (i.e. meta-train). More formally, a
task, $\mathcal{T}$ is a few-shot learning problem with a set of train and
test data instances, referred to as the “support set”, $\mathcal{D}^{s}$, and
the “query set”, $\mathcal{D}^{q}$. The number of instances in a support set
is ,$K^{s}\times|\mathcal{C}|$, where $\mathcal{C}$ is the set of classes and
$K^{s}$ is the number of representatives from each class in the support
set(often also referred to as a the shots in k-shot learning). For example, in
Figure 1, a task support set contains distinct digits each of which forms a
class (here $\mathcal{C}$ = 5 with $K^{s}$ = 1). Each task contains an equal
number of classes but not necessarily the same sub set of classes. Typically
the query set, $\mathcal{D}^{q}$, has no overlap with the support set,
$\mathcal{D}^{s}$ similar to a train/test split in supervised learning; and
unlike the support set, composition of the query set need not be constrained
to represent all $\mathcal{C}$.

Once the meta-model is trained using the meta-train tasks, it is tested using
the meta-test tasks. A meta-test task, $\hat{\mathcal{T}}$, has a similar
composition to a meta-train task, in that it also has a support set and a
query set. Unlike traditional classifier testing; with meta-testing, we use
the support set in conjunction with the trained meta-model to classify
instances in the query sets. For few shot learning there are two common meta-
learning approaches: the adaptation optimised algorithms such as MAML Finn et
al. (2017) and Reptile Nichol et al. (2018); and the similarity optimised
learning of Relation Networks Sung et al. (2018).

Figure 2: Model-Agnostic Meta-Learning

MAML Finn et al. (2017) is a versatile Meta-Learning algorithm applicable to
any neural network model optimised with Gradient Descent (GD). Adaptation
optimised Meta-Learner MAML is illustrated in Figure 2. In each training
iteration, a set of tasks are sampled and each task, $\mathcal{T}_{i}$
optimises its task-model, $\theta_{i}$ with the $\mathcal{D}^{s}$ using one or
few steps of GD referred to as gradient steps ($gs$). The meta-modal $\theta$
is then optimised using GD with the losses computed by the optimised task-
models $\theta_{i}^{\prime}$s against their respective $\mathcal{D}^{q}$s,
referred to as the Meta-update. This process is repeated with many task
samples, to learn a generic model prototype $\theta$ that can be rapidly
adapted to a new task. A task, $\hat{\mathcal{T}}$, not seen during training,
uses its support set, $\mathcal{D}^{s}$ to train a parametric model
$\hat{\theta}$, initialised by the meta-model $\theta$, for few gradient steps
referred to as, meta-gradient-steps, $meta\\_gs$. Thereafter, the adapted,
$\hat{\theta}$ is used to classify instances in its query set,
$\mathcal{D}^{q}$.

Figure 3: Relation Network

Relation Network (RN) Sung et al. (2018) is a Few-shot Meta-Learning algorithm
that “learns-to-match” or learns a non-linear similarity function for
matching. RN has a similar goal to other Meta-Learners, of generalising over
many tasks. The meta-task design for RN is as described in Figure 1. However
with RN, each train-task consists of a number of meta-training instances,
created by combining each $x_{i}^{q}$ from, $\mathcal{D}^{q}$ with the support
set $\mathcal{D}^{s}$. During training, RN learns to match each instance,
$x_{i}^{q}$ to a matching instance in $\mathcal{D}^{s}$. As illustrated in
Figure 3, the $\theta_{f}$ learns a feature representation for each instance;
next each $x_{i}^{s}$, in $\mathcal{D}^{s}$ is paired with the $x_{i}^{q}$.
The relation network then learns to estimate the similarity of the paired
instances. The network is optimised end to end such that we learn a feature
representation model, $\theta_{f}$, and a relation model, $\theta_{r}$, that
collectively maximises the similarity between pairs that belong to the same
class. A meta-test task, $\hat{\mathcal{T}}$, not seen during training, can
use the RN to match a query instance in $\mathcal{D}^{q}$ to an instance in
it’s support set $\mathcal{D}^{s}$, and therein use the class of the matched
support instance as the predicted class label.

##  4 Methods

Given a dataset, $\mathcal{D}$, Human Activity Recognition (HAR), like any
other supervised learning problem, is the learning of the feature mapping
$\theta$ between data instances, $x$, and activity classes, $y$, where $y$ is
from the set of activity classes, $\mathcal{C}$.

$y=\theta(x)\text{ where }y\in\mathcal{C}$ (1)

In comparison to image or text classification, with HAR, each data instance in
$\mathcal{D}$ belongs to a person, $p$. Given the set of data instances
obtained from person $p$ is $\mathcal{D}^{p}$, $\mathcal{D}$ is the collection
of data instances from the population $\mathcal{P}$ (Equation 2). As before,
all data instances in $\mathcal{D}^{p}$ will belong to a class in
$\mathcal{C}$, except for special tasks such as open-ended HAR where
$\mathcal{C}$ is not fully specified at training time.

$\mathcal{D}=\\{\mathcal{D}^{p}\mid p\in\mathcal{P}\\}\text{ where
}\mathcal{D}^{p}=\\{(x,y)\mid y\in\mathcal{C}\\}\\\ $ (2)

###  4.1 Personalised Meta-Learning for HAR

Figure 4: Personalised Meta-Learning Tasks design for HAR

Personalised Meta-Learning for Human Activity Recognition (HAR) can be seen as
the learning of a meta-model $\theta$ from a population $\mathcal{P}$ while
treating activity recognition for a person as an independent task. We propose
the task design in Figure 4 for Personalised Meta-Learning. Given a dataset
$\mathcal{D}$, of population $\mathcal{P}$, we create tasks such that, each
“person-task”, $\mathcal{P}_{i}$, only contain data from a specific person,
$p$. We randomly select a $K^{s}\times|\mathcal{C}|$ number of labelled data
instances from person $p$ stratified across activity classes, $\mathcal{C}$,
such that there are $K^{s}$ amount of representatives for each class. We
follow a similar approach when selecting a query set, $\mathcal{D}^{q}$, for
$\mathcal{P}_{i}$. Given that existing HAR dataset are not strictly Few-shot
Learning datasets, there can be a few to many data instances available to be
sampled for the query set, $\mathcal{D}^{q}$. In comparison to Meta-Learning
task design (Section 3), each “person-task” is learning to classify the set of
”person-activity” class labels.

A dataset is split for training and testing using a person-aware evaluation
methodology, such as Leave-One-Person-Out or Persons Hold-out where 1 or few
persons form the meta-test person-tasks and the rest form the meta-train
person-tasks. At test time, the test person, $\hat{p}$, provides a few seconds
of data for each activity class while being recorded by recommended sensor
modalities, which forms the support set, $\mathcal{D}^{s}$, of the person-
task, $\hat{\mathcal{P}}$. Thereafter, the meta-model, in conjunction with the
support set, predicts the class label for each query data instance,
$x^{q}_{i}$, in $\mathcal{D}^{q}$.

It is noteworthy that, contrary to conventional Meta-Learning, all personal
models and the meta-model are learning to classify the same set of activity
classes $\mathcal{C}$, but of different persons (i.e. “person-activity”).
Therefore, it is seen as a Few-shot Meta-Learning classification problem with
a $|\mathcal{C}|\times|\mathcal{P}|$ number of classes. Personalised Meta-
Learning is a methodology adaptable with any Meta-Learning algorithm to
perform personalised HAR, and next we show how with two Meta-Learning
algorithms, MAML and RN.

###  4.2 Personalised MAML

Personalised MAML ($MAML^{p}$) for HAR is adaptation optimised to learn the
generic model prototype (i.e. meta-model), $\theta$, such that it is adaptable
to any new person encountered at test time. Task design for $MAML^{p}$ follow
the similar process described in Section 4.1 where we select a support set,
$\mathcal{D}^{s}$, and a query set $\mathcal{D}^{q}$ for the person-task
$\mathcal{P}_{i}$. The number of instance in the support set
$|\mathcal{D}^{s}|$, determines the number of instances that need to be
requested from a new person, $\hat{p}$, during testing. Thus, we keep $K^{s}$
small, similar to a few-shot learning scenario. We use all remaining data
instances from each class, in $\mathcal{D}^{q}$. More formally, given there
are $K$ instances per “person-activity”, $K^{q}=(K-K^{s})$ and
$\mid\mathcal{D}^{q}\mid=K^{q}\times\mid\mathcal{C}\mid$. The meta-model
learning, is influenced by the loss generated by the $\mathcal{D}^{q}$ of each
person-task. Therefore we evaluate $MAML^{p}$ for a range of $K^{q}$ values in
an exploratory study. We present the training of Personalised MAML in
Algorithm 1.

A meta-test person $\hat{p}$ provide $K^{s}$ instances per class forming the
support set $\mathcal{D}^{s}$, that is used to train the personalised
classification model, $\hat{\theta}$, initialised by the meta-model $\theta$,
for $\hat{p}$. This process can be seen as the personalised model adaptation
from the meta-model $\theta$. Thereafter, the class label is predicted for
each incoming test data instances using $\hat{\theta}$ as in Algorithm 2.

Personalised MAML is model-agnostic, with the opportunity to use a diverse
range neural networks for feature representation learning. This is advantages
for HAR applications where heterogeneous sensor modalities or modality
combinations are used. We note that we refer to First-Order MAML Finn et al.
(2017) when implementing Personalised MAML, which is computationally less
intensive, yet achieves comparable performances in comparison to MAML Finn et
al. (2017).

Algorithm 1 Personalised MAML Training

0: $p(\mathcal{P})$: HAR dataset; distribution over persons

0: $\alpha$, $\beta$, $n$, $gs$, $meta\\_gs$: step sizes, batch size and
gradient-steps hyper-parameters

1: randomly initialise $\theta$

2: while not done do

3: Sample $n$ persons $\mathcal{P}_{i}\sim p(\mathcal{P})$

4: for all $\mathcal{P}_{i}$ do

5:
$\mathcal{D}^{s}=\\{(x,y)\in\mathcal{P}_{i}:|\mathcal{D}^{s}|=K^{s}\times|\mathcal{C}|$}

6: for $i=0$ to $gs$ do

7: Evaluate $\nabla_{\theta}\mathcal{L}_{\mathcal{P}_{i}}(f_{\theta})$ w.r.t.
$\mathcal{D}^{s}$

8: Compute adapted parameters with gradient descent:
$\theta_{i}^{\prime}=\theta-\alpha\nabla_{\theta}\mathcal{L}_{\mathcal{P}_{i}}(f_{\theta})$

9: end for

10:
$\mathcal{D}^{q}=\\{(x,y)\in\mathcal{P}_{i}:\mathcal{D}^{s}\cap\mathcal{D}^{q}=\emptyset,|\mathcal{D}^{q}|=K^{q}\times|\mathcal{C}|$}

11: Evaluate $\mathcal{L}_{\mathcal{P}_{i}}(f_{\theta_{i}^{\prime}})$ w.r.t
$\mathcal{D}^{q}$

12: end for

13: Meta-update:
$\theta\leftarrow\theta-\beta\nabla_{\theta}\sum_{\mathcal{P}_{i}\sim
p(\mathcal{P})}\mathcal{L}_{\mathcal{P}_{i}}(f_{\theta_{i}^{\prime}})$

14: end while

Algorithm 2 Personalised MAML Testing

0: $\mathcal{D}^{s}$ for test person $\hat{\mathcal{P}}$ obtained via micro-
interactions,

0: $\theta$; Meta-model

1: Initialise $\hat{\theta}=\theta$

2: for $i=0$ to $meta\\_gs$ do

3: Evaluate
$\nabla_{\hat{\theta}}\mathcal{L}_{\mathcal{P}_{i}}(f_{\hat{\theta}})$ w.r.t.
$\mathcal{D}^{s}$

4: Compute adapted parameters with gradient descent:
$\hat{\theta}^{\prime}=\hat{\theta}-\alpha\nabla_{\hat{\theta}}\mathcal{L}_{\mathcal{P}_{i}}(f_{\hat{\theta}})$

5: end for

6: for all $\mathcal{D}^{q}_{i}$ do

7: predict $y^{q}_{i}=f_{\hat{\theta}^{\prime}}(\mathcal{D}^{q}_{i})$

8: end for

###  4.3 Personalised RN

Personalised Relation Networks $RN^{p}$ learns a matching, generalisable to
new persons encountered at test time. Design of person-tasks
($\mathcal{P}_{i}$) follow the methodology in Section 4.1 where the the
support set, $\mathcal{D}^{s}$, and the query set $\mathcal{D}^{q}$, is
selected from the same person. Similar to $MAML^{p}$, we select $K^{s}$ amount
of data instances per class to create the support set, $\mathcal{D}^{s}$ and
we select all remaining data instances of the class to create the query set
$\mathcal{D}^{q}$. We create meta-training instance for $\mathcal{P}_{i}$ by
combining each data instance $x^{q}_{i}$, in $\mathcal{D}^{q}$, with the
support set, $\mathcal{D}^{s}$. Therefore, the matching is always performed
against their own data in the support set. This method is similar to
personalisation methods described for Personalised Matching Networks Wijekoon
et al. (2020). At test time, a meta-test person $\hat{p}$ provide a support
set, $\mathcal{D}^{s}$ with representatives for each class in $\mathcal{C}$.
This support set is thereafter combined with each test query instance
$x^{q}_{i}$ for predicting class label $y^{q}_{i}$ using the $RN^{p}$ model as
in Algorithm 4. We present the training of Personalised RN in Algorithm 3. A
$RN^{p}$ has two parametric modules, one for feature representation learning,
$\theta_{f}$ and one for similarity learning, $\theta_{r}$ (Figure 3), and
similar to $MAML^{p}$, feature representation learning module can be
configured to suit heterogeneous sensor modalities or modality combinations.

Algorithm 3 Personalised RN Training

0: $p(\mathcal{P})$: HAR dataset; distribution over persons

0: $\alpha$: step size hyper-parameter

1: randomly initialise $\theta_{f}$ and $\theta_{r}$

2: while not done do

3: Sample a person $\mathcal{P}_{i}\sim p(\mathcal{P})$

4:
$\mathcal{D}^{s}=\\{(x,y)\in\mathcal{P}_{i}:|\mathcal{D}^{s}|=K^{s}\times|\mathcal{C}|\\}$

5:
$\mathcal{D}^{q}=\\{(x,y)\in\mathcal{P}_{i}:|\mathcal{D}^{q}|=K^{q}\times|\mathcal{C}|,\mathcal{D}^{s}\cap\mathcal{D}^{q}=\emptyset\\}$

6: for all $\mathcal{D}^{q}_{i}$ do

7: Create train data instance ($\mathcal{D}^{q}_{i},\mathcal{D}^{s}$)

8: end for

9: Evaluate $\nabla\mathcal{L}_{\mathcal{P}_{i}}(f_{\theta_{f},\theta_{r}})$
w.r.t. $K^{q}\times|\mathcal{C}|$ number of train data instances

10: Update
$(\theta_{f},\theta_{r})\leftarrow(\theta_{f},\theta_{r})-\alpha\nabla_{\theta_{f}}\mathcal{L}_{\mathcal{P}_{i}}(f_{\theta_{f},\theta_{r}})$

11: end while

Algorithm 4 Personalised RN Testing

0: Support set $\mathcal{D}^{s}$ for test person $\hat{\mathcal{P}}$ obtained
via micro-interactions,

0: $\theta_{r},\theta_{f}$; Relation Network Model

1: for all $\mathcal{D}^{q}_{i}$ do

2: predict
$y^{q}_{i}=f_{\theta_{f},\theta_{r}}(\mathcal{D}^{q}_{i},\mathcal{D}^{s})$

3: end for

##  5 Comparative Study

We compare the performance of Personalised Meta-learning algorithms,
Personalised MAML ($MAML^{p}$) and Personalised RN ($RN^{p}$) against a number
of baselines and the state-of-the-art algorithms as listed below;

DL:

Best performing DL algorithm from benchmark performances published in Wijekoon
et al. (2019)

MN:

Matching Networks from Vinyals et al. (2016); Few-shot Learning classifier

MAML:

Model-Agnostic Meta-Learner Finn et al. (2017) (detailed in Section 3) The
state-of-the-art for Few-shot Image classification

RN:

Relation Networks Sung et al. (2018) (detailed in Section 3) State-of-the-art
for Few-shot Image classification

MNp:

Personalised Matching Networks from Wijekoon et al. (2020); Few-shot Learning
classifier, state-of-the-art for personalised HAR

MAMLp (Ours):

Personalised MAML introduced in Section 4.2

RNp (Ours):

Personalised Relation Networks introduced in Section 4.3

###  5.1 Datasets and Pre-processing

We use three data sources to create 9 datasets in single modality sensing.
Both $MAML^{p}$ and $RN^{p}$ are model agnostic, such that the feature
representation learning models are interchangeable to suit any modality
combination.

MEx 111https://archive.ics.uci.edu/ml/datasets/MEx is a Physiotherapy
Exercises dataset complied with 30 participants performing 7 exercises. A
participant performs one exercise for only 60 seconds. A depth camera (DC), a
pressure mat (PM) and two accelerometers on the wrist (ACW) and the thigh
(ACT) provide four sensor data streams creating four datasets. PAMAP2
222http://archive.ics.uci.edu/ml/datasets/pamap2+physical+activity+monitoring
dataset contains 8 Activities of Daily Living recorded with 8 participants.
Three accelerometers on the hand (H), the chest (C) and the ankle (A) provide
three sensor data streams creating three datasets. selfBACK
333https://github.com/rgu-selfback/Datasets is a HAR dataset with 6 ambulatory
and 3 stationary activities. These activities are recorded with 33
participants using two accelerometers on the wrist (W) and the thigh (T),
creating two datasets.

A sliding window method is applied on each sensor data stream to obtain data
instances. Window size of 5 seconds is applied for all 9 datasets and an
overlap of 3, 1 and 2.5 for data sources MEx, PAMAP2 and selfBACK, resulted in
30, 76 and 88 data instance per person-activity on average. A few pre-
processing steps are applied on data instances, specific to their sensor
modalities. DC and PM modalities use a reduced frame rate from $15Hz$ to $1Hz$
and DC frame size is reduced from $240\times 320$ to $12\times 16$.
Accelerometer data apply DCT feature transformation on every 1 second data
slice of each axis and select the 60 most prominent DCT coefficients.
Resulting input sizes for $\theta_{f}$ of RN and $\theta$ of MAML are
$(5\times 12\times 16)$, $(5\times 16\times 16)$ and $(5\times 3\times 60)$
for DC, PM and AC modalities respectively.

###  5.2 Implementation

Table 1: Best performing DL Network Architectures of the 9 datasets, $td$:TimeDistributedLayer, $conv(k)n$:ConvolutionalLayer with $n$ kernels of kernel size $k$, $maxpool(k)$:MaxPoolingLayer with pool size $k$, $dense(k)$:DenseLayer with $k$ units, $bn$:BatchNormalisation Datasets |  Architecture
---|---
MExDC |  $conv(3.3)32\rightarrow maxpool(2.2)\rightarrow bn\rightarrow conv(3.3)64\rightarrow maxpool(2.2)\rightarrow bn\rightarrow flatten\rightarrow dense(1200)\rightarrow bn\rightarrow dense(600)\rightarrow bn\rightarrow dense(100)\rightarrow bn$
MExACT, MExACW, MExPM, PMPA, PMPC, PMPH, SBT, SBW |  $td-conv(5)32\rightarrow maxpool(2)\rightarrow bn\rightarrow td-conv(5)64\rightarrow maxpool(2)\rightarrow bn\rightarrow td-flatten\rightarrow lstm(1200)\rightarrow bn\rightarrow dense(600)\rightarrow bn\rightarrow dense(100)\rightarrow bn$

(a) $\theta$

(b) $\theta_{f}$

(c) $\theta_{r}$

Figure 5: Network Architectures

DL benchmark results with the MEx datasets are published in Wijekoon et al.
(2019) and for comparability we implement the same network architectures and
evaluate with the best performing baselines for PAMAP2 and selfBACK datasets.
We detail the selected network architectures in Table 1.

We use the $\theta$ network in Figure 5(a) as the feature representation
learning model in $MN$, $MN^{p}$, $MAML$ and $MAML^{p}$ algorithms, where the
input sizes for modalities Accelerometer, Depth camera and Pressure mat are
reshaped to 900, 960 and 1280 respectively. $RN$ and $RN^{p}$ use the network
in Figure 5(b) to learn the feature representations, where the input sizes for
modalities Accelerometer, Depth camera and Pressure mat are ($5\times 180$),
($80\times 12$) and ($80\times 16$) respectively with 1 channel. Relation
module $\theta_{f}$ uses the network in Figure 5(c) where the input is twice
the size of the output of $\theta_{f}$ (See Figure 3 for complete network
architecture).

We use the best performing hyper-parameter settings for $MN$ and $MN^{p}$ from
Wijekoon et al. (2020) where the networks are 5-shot classifiers, trained for
20 epochs with early stopping using Categorical Cross-entropy as the
objective. We train $RN$ and $RN^{p}$ similar to $MN$, but using Mean Squared
Error as the objective function Sung et al. (2018) where $\alpha=0.001$,
$K^{s}=5$, trained for 300 epochs and apply early stopping. Our initial
empirical evaluations showed that using $RN$ and $RN^{p}$ trained using
Categorical Cross-entropy yields comparable results and achieves model
convergence faster, compared to using Mean Squared Error. $MAML$ and
$MAML^{p}$ are using Categorical Cross-entropy as the objective function and
use $K^{s}=5$, $gs=5$ and $meta\\_gs=10$ for training and testing. We use
$\alpha=0.4$ and $\beta=0.001$, $n=32$ and is trained for 100 epochs. All
models are trained with the Adam optimiser and the Meta-Learning models do not
use mini-batching.

###  5.3 Evaluation Methodology

We follow the person-aware evaluation methodology, Leave-One-Person-Out (LOPO)
in our experiments. We leave data from one person to create meta-test tasks
and use the rest to create meta-train tasks. We note that during testing, even
$MN$, $MAML$ and $RN$ preserve the personalisation aspect because of the LOPO
evaluation strategy where only one user is present in the meta-test tasks. The
meta-train and meta-test tasks are created while maintaining class balance;
accordingly we report the accuracy of each experiment averaged over the number
of person folds. LOPO evaluation methodology require a non-parametric
statistical significance test as they produce results that are not normally
distributed. We use the Wilcoxon signed-rank test for paired samples to
evaluate the statistical significance at 95% confidence and highlight the
significantly improved performances in bold text.

###  5.4 Results

Table 2: Personalised Meta-Learner performance comparison for Exercise Recognition Algorithm | MExACT | MExACW | MExDC | MExPM
---|---|---|---|---
DL | 0.9015 | 0.6335 | 0.8720 | 0.7408
$MN$ | 0.9073 | 0.4620 | 0.5065 | 0.6187
$MN^{p}$ | 0.9155 | 0.6663 | 0.9342 | 0.8205
$MAML$ | 0.8673 | 0.6525 | 0.9629 | 0.9283
$RN$ | 0.9327 | 0.7279 | 0.8189 | 0.8145
$MAML^{p}$(Ours) | 0.9106 | 0.6834 | 0.9795 | 0.9408
$RN^{p}$(Ours) | 0.9436 | 0.7719 | 0.9205 | 0.8520

Table 2 presents the comparison of performances obtained by the algorithms in
Section 5 for the Exercise Recognition (ExRec) task using the four datasets
derived from MEx. As expected personalised Meta-Learning models significantly
outperformed conventional DL and Meta-Learning models in all four experiments.
Notably the two datasets with accelerometer data recorded best performance
with $RN^{p}$ while datasets with visual data; MExDC and MExPM, recorded best
performance with $MAML^{p}$. It is noteworthy that the Personalised Few-shot
Learning algorithm $MN^{p}$, achieves comparable performance against
$MAML^{p}$ model of the MExACT dataset and outperform $RN^{p}$ model of the
MExDC dataset. When comparing conventional Meta-Learners (i.e. $RN$, $MAML$)
and Personalised Few-Shot Learner $MN^{p}$, we highlight that, $MN^{p}$ models
achieve comparable performances or significantly outperform at least one
conventional Meta-Learner with all four experiments. These results further
confirm the importance of personalisation for ExRec.

Table 3 presents results for Ambulatory, Stationary and ADL activities using 5
datasets for PAMAP2 and selfBACK. Similar to ExRec, Personalised Meta-Learning
models have significantly outperformed conventional DL models, with both
ambulatory and stationary activity data. Notably, two experiments with ADL
data, have significantly outperformed DL models with at least one of the
personalised Meta-Learner models (PMPH: $MAML^{p}$, and $RN^{p}$, PMPC:
$RN^{p}$). However Personalised Meta-Learner models fail to outperform DL
models using the PMPA dataset. All $MAML^{p}$ models significantly outperform
its original counterpart $MAML$, and $RN^{p}$ significantly outperform $RN$
with four experiments with the exception of PMPH where $RN^{p}$ performance is
comparable with $RN$. While two of the five experiments significantly
outperform Personalised $MN^{p}$, three experiments fail to outperform
$MN^{p}$. But all experiments achieve their best performance with a
personalised algorithms further confirming the significance of Personalisation
in different domains of HAR. $MN^{p}$’s use of the simpler similarity metric
(such as cosine) has proven to be sufficient for PAMAP2 in particular,
compared to the sophisticated similarity model learnt with $RN$.

Table 3: Personalised meta-Learner performance comparison for Ambulatory, Stationary and ADL Activity Recognition Algorithm | SBT | SBW | PMPH | PMPC | PMPA
---|---|---|---|---|---
Best | 0.7880 | 0.6997 | 0.7505 | 0.7878 | 0.8075
MN | 0.8392 | 0.7669 | 0.6625 | 0.7536 | 0.7361
$MN^{p}$ | 0.9124 | 0.8653 | 0.7484 | 0.8548 | 0.8330
MAML | 0.8398 | 0.7532 | 0.7593 | 0.7626 | 0.6830
RN | 0.9334 | 0.8276 | 0.7818 | 0.8170 | 0.7527
$MAML^{p}$(Ours) | 0.8625 | 0.8075 | 0.8037 | 0.7822 | 0.7256
$RN^{p}$(Ours) | 0.9487 | 0.8528 | 0.7868 | 0.8294 | 0.7761

Overall, considering all personalisation algorithms, we find that experiments
with visual data prefer the optimisation based meta-learning algorithm (i.e.
$MAML^{p}$) and experiments with time-series data prefer learning to compare
methods (i.e. $MN^{p}$ and $RN^{p}$). It is noteworthy that $MAML^{p}$ and
$MN^{p}$ use a 1-dense layer network (Figure 5) and $RN^{p}$ uses a
1-convolution layer network for feature representation learning while
achieving significant performance improvements. While meta-learning attributes
to this improvement, it is further enhanced by the personalised learning
strategies. These results highlight that Meta-Learners and Personalisation are
positively contributing towards eliminating the need for parametric models
with many deep layers that require a large labelled data collection for
training. This is highly significant in the domain of HAR, where even a
comprehensive data collection fails to cover all possible personal nuances and
traits that a reasoning model may encounter in the future.

Evidently, model adaptation by re-training using a few data instances at test
time, significantly improved meta-model performance for $MAML^{p}$, suggesting
that learnt meta-model was transferable and obtaining an activity label for a
given test query, is a simple inference task using the adapted model. While
$RN^{P}$ does not require model-retraining, obtaining the activity class label
for a given query involves a more complex inference process; each data
instance in the user provided support set and the query instance is converted
to feature vectors and later concatenated (as described in Section 4.3) to
obtain the relation scores and derive the activity class label. We calculate
the average time elapsed for obtaining an activity label on the MExACT query
data instance, using both algorithms in a computer with 8GB RAM and 3.1 GHz
Dual-Core processor. While $MAML^{p}$ takes 0.0156 milliseconds for a single
classification task, $RN^{P}$ takes 2.4982 milliseconds in a 1-shot setting
and 3.7218 milliseconds in a 5-shot setting. This is an important difference,
when selecting an algorithm to operate in an edge device with limited
resources, where a high response rate is necessary while maintaining
performance.

##  6 Conventional vs. Personalised Meta-Learners

Here we look closer at training aspects to understand how personalisation
improves performance of Meta-Learners using MExPM dataset. We select MExPM
because it is representative of a few-shot learning HAR dataset with only 30
data instances for each “person-activity” class.

###  6.1 MAML vs. MAMLp

We first investigate the performance improvements achieved by $MAML^{p}$ after
using the Personalised Meta-Learning methodology against $MAML$. Accordingly
we compare three algorithms, $MAML$ where meta-train and test tasks are
created disregarding any person identifiers; $MAML^{p}$, as described in
Section 4.2; and Person-aware $MAML$. Here Person-aware $MAML$ can be seen as
a lazy personalisation of MAML where a meta-train task is comprised of data
instances selected from a set of persons. The support set contains, $K^{s}$,
data instances for each activity class, where data for any given activity must
be obtained from a single person, but different activity classes may obtain
data from different persons. The query set will have data from a single person
who may not have been selected to form the support set. This method still
preserve the concept of “person-activity” only at the class label level, but
not over the entire support set level. We visualise the impact of model
adaptation at test time using these different algorithms in both, $K^{s}=1$,
and $K^{s}=5$, settings on the MExPM dataset.

Figure 6: MAML vs. Person-aware MAML vs. MAMLp with MExPM when $K^{s}=1$
Figure 7: MAML vs. Person-aware MAML vs. MAMLp with MExPM when $K^{s}=5$

Figures 6 and 7 compare $MAML$, $MAML^{p}$ and Person-aware $MAML$ using MExPM
in $K^{s}=1$ and $K^{s}=5$ settings respectively. Here we plot test-person
accuracy (y-axis) evaluated at every 10 meta-train epochs (2nd row of the
x-axis); at each of these evaluation points, the meta-test support set is used
to adapt the current meta-model for a further 10 meta-gradient steps (1st row
of the x-axis). During the adaptation steps we also record accuracy using the
meta-test query. Through this process we can observe the impact of the
partially optimised general meta-model when being adapted for personalisation
at test time (or at deployment) at different stages of optimisation.
$MAML^{p}$ and Person-aware $MAML$ significantly outperformed $MAML$ in both
settings. When comparing $MAML^{p}$ and Person-aware $MAML$, $MAML^{p}$
algorithm achieves a more generalised meta-model even without performing meta-
gradient steps for meta-model adaptation (0 on $1^{st}$ row of the x-axis);
this is most significant in the $K^{s}=1$ setting. These observations verify
the advantage of creating personalised tasks; that even with the Person-aware
$MAML$ algorithm, where each task contains data from multiple people, but each
“person-activity” class only contains data from one person has clear benefits.
Accordingly, personalised algorithms ensure that the task-models are trained
for a set of “person-activity” classes instead of “activity” classes.
$MAML^{p}$ where all “person-activity” data belongs to the same person,
provides further generalisation with rapid adaptation. Another indication of
the significance of personalisation is found when investigating $MAML$
performance over the training epochs. While $MAML$ improves overall
performance as the meta-model train, $MAML$ meta-test accuracy before
adaptation (every $0^{th}$ meta-gradient step), declines consistently. This is
most significant when $K^{s}=5$, which indicates that the meta-model learned
with $MAML$ is not generalised when an activity class in a meta-train task
support set contains data from multiple people. In comparison, meta-model
learned with $MAML^{p}$, performs well on meta-test tasks, even before
adaptation.

###  6.2 RN vs. RNp

Similarly we compare the performance between the two algorithms Relation
Networks (RN) and Personalised RN ($RN^{p}$) to understand the effect of
personalisation on network training and testing. For this purpose we train the
two algorithms, with the MExPM dataset in two setting $K^{s}=1$ and $K^{s}=5$
for 300 epochs, and evaluate the model at every 10 epochs using meta-test
tasks.

(a) $K^{s}=1$

(b) $K^{s}=5$

Figure 8: RN vs. RNp with MExPM meta-model tested at every 10 meta-train
epochs

In Figures 8(a) and 8(b) plot the test accuracy on meta-test tasks obtained at
every 10 meta-train epochs for the two algorithms RN and $RN^{p}$ in the two
settings $K^{s}=1$ and $K^{s}=5$. It is evident that personalisation has
stabilised the meta-training process, where meta-test model performs
consistently better with $RN^{p}$ models. In contrast meta-test evaluation on
the $RN$ models is erratic, especially evident when $K^{s}=5$. When training
$RN$ in the $K^{s}=5$ setting, a task is created by disregarding the person
parameter, as a result, an activity class contains data instances from more
than one person and learning similarities to many people has adversely
affected the learning of the $RN$ meta-model. Similarly, in the $K^{s}=1$
setting, when a task contains only one data instance per class, learning from
ones own data with $RN^{p}$ is advantages in comparison to $RN$ where the data
instance for a class is from one person but not strictly similar to query
person.

##  7 Personalised Meta-Learner Hyper-parameter selection

We explore three hyper-parameters of Personalised Meta-Learners using the 4
datasets from MEx for Exercise Recognition. The 4 MEx datasets give us the
opportunity to compare how different modalities recorded for the same set of
activities respond in different hyper-parameter settings when adapting to new
unseen persons.

###  7.1 Meta-train query set size comparison for MAMLp

First we explore the most effective $K^{q}$ value for training $MAML^{p}$.
Originally, $MAML$ experiments used $K^{q}=K^{s}$ for image classification
Finn et al. (2017). As shown in Algorithm 1 line 8, $K^{q}$ determine how many
data instances are considered in meta-update loss calculation, that later
affect the meta-model learning. Given each meta-train task for $MAML^{p}$, now
belong to a specific person, we expect to find the effect of using a fewer or
larger number of data instance in meta-task evaluation. Accordingly we explore
three $K^{q}$ values 5, 10 and $K-K^{s}$ where the $K$ is all available data
instances for an “person-activity” class (30 on average for all MEx datasets)

Both settings, $K^{s}=1$ and $K^{s}=5$ achieved comparable performances with
all three $K^{q}$ values. This suggests that meta-update is not affected
adversely by creating personalised tasks, where the meta-update uses the loss
computed from a batch of person-specific task models. We plot the meta-test
performance during the 10 meta-gradient steps of meta-model adaptation to
visualise the effect of learning a meta-model from different $K^{q}$ values in
Figure 9 (Here $K^{s}$ is set to 5). Both MExACT and MExPM achieve similar
performances with all three meta-models post-adaptation, but the most
generalised meta-model is learned when using $K^{q}=5$. This is more
significantly seen with the MExPM experiment where $K^{q}=5$ outperform other
variants before and during model adaptation (before: 6.55% difference with
MExPM, 4.8% difference with MExACT). These results suggest, limiting $K^{q}$
in each meta-train task improves generalisation of the meta-model for later
adaptation with persons not seen during model training.

(a) PM

(b) ACT

Figure 9: MAMLp: Meta-model adaptation with meta-models trained with different
$K^{q}$ sizes

###  7.2 Support set size comparison for MAMLp

Next we perform an exploratory study of $K^{s}$ using a range of $K^{s}$
values. Finding the the balance between $K^{s}$ and performance of $MAML^{p}$
is important because, at deployment, the test-person is expected to provide
$K^{s}$ amount of data instances per activity class, therefore its is
desirable to keep $K^{s}$ to a required minimum. We perform experiments with
all 4 datasets from MEx for $K^{s}$ values 1, 3, 5, 7 and 10.

(a) Results of different $K^{s}$ with each ExRec dataset

(b) Meta-model adaptation with meta-models trained with different $K^{s}$
values using MExPM dataset

Figure 10: MAMLp: Exploring meta-training with different $K^{s}$

Figure 10(a) plot meta-test performances obtained by datasets MExACT, MExACW,
MExDC and MExPM. Increasing $K^{s}$ consistently improve performance up to
$K^{s}=10$ and report decreased or similar performance when $K^{s}=13$ with
all datasets. A significant performance improvement is observed when
increasing $K^{s}$ from 1 to 3. While modalities ACT and ACW achieve highest
performance with $K^{s}=10$ modalities DC and PM gradually improve performance
even at $K^{s}=13$. The meta-test accuracy at every meta-gradient update with
increasing $K^{s}$ for MExPM and MExACT for a randomly selected person is
visualised in Figure 10(b). These figures indicate that meta-gradient
adaptation converge faster when $K^{s}$ is smaller. Overall they validate that
that increasing $K^{s}$ improve meta-test performance, before, during and
after adaptation, most significantly seen when increasing $K^{s}$ from 1 to 3.

###  7.3 Support set size comparison for RNp

Finally we explore different $K^{s}$ values to find the most optimal value for
$RN^{p}$. Similar to $MAML^{p}$, $K^{s}$ determine how many data instances are
required from a new person for the optimal personalisation of the model;
therefore, we try to find the balance between performance improvement and
$K^{s}$. Accordingly we create 10 experiments with each MEx dataset where
$K^{s}$ range from 1 to 10.

Figure 11: RNp: Exploring meta-training with different $K^{s}$ for each ExRec
dataset

We plot accuracy against different $K^{s}$ settings for each dataset in Figure
11. The figure clearly indicate that different sensor modalities prefer
different $K^{s}$ values. Both MExACT and MExDC exhibit dome shaped behaviour
in increasing $K^{s}$ settings where after $K^{s}=7$ it is detrimental to the
network to have many examples of the same activity class for comparison. In
contrast, MExPM dataset show continuous performance improvement with
increasing $K^{s}$ and at $K^{s}=10$ it starts to dome like MExACT and MExDC
modalities. We note that MExACW behave differently to others when increasing
$K^{s}$, while there is a domed behaviour for $K^{s}$ from 2 to 8,
performances when $K^{s}=1,9$ and $10$ are outliers that we will further
investigate in future.

As mentioned in Section 5.4, with the $RN^{p}$ algorithm, a larger $K^{s}$
value not only increase the amount of data instances requested from a test
person, but also increases the memory and computational requirements. Larger
$K^{s}$ settings increases the number of comparisons and takes longer to
perform a single classification task. Overall, we find $K^{s}=5$ exhibit a
proper balance between performance vs. memory requirements.

##  8 Discussion

The comparative results from Section 5.4 show that while $RN^{p}$ achieve best
performance with many HAR datasets, the response rate is 248 times slower
compared to $MAML^{p}$. An HAR algorithm should be able to recognise
activities as they are performed in real-time for the best user-experience,
and the processor and memory requirements along with the response time is
crucial considerations for edge device deployment. In comparison, $MAML^{p}$
require post-deployment model re-training, which require the algorithm to
perform in a development friendly environment using libraries like TensorFlow
Light or PyTorch Mobile.

A limitation of Personalised MAML and MAML in general is the inability to
perform open-ended HAR. Both $MAML$ and $RN$ perform Zero-shot Learning for
image classification Finn et al. (2017); Sung et al. (2018) for a fixed class
length. Specifically, $MAML$ is restricted to performing multi-class
classification with a conventional soft-max layer; for instance 5 outputs for
a 5-class (5-way) classification task. Open-ended HAR require dynamic
expansion of the decision layer as the person add new activities in addition
to the activities that are already included. Few-shot classifiers such as
Matching Networks (MN) Vinyals et al. (2016) does not have a strict decision
layer which inspired Open-ended MN Wijekoon et al. (2020) for Open-ended HAR.
Similarities of Relation Networks (RN) to MN presents the opportunity to
improve Open-ended HAR using RN, which we will explore in future.

When a Personalised Meta-Learning model is trained and embedded in the fitness
application, there is a initial configuration step that is required for
collecting the calibration data(i.e. support set) of the end-user. The end-
user will be instructed to record a few seconds of data for each activity
using the sensor modalities synchronised with the fitness application. This is
similar to demographic configurations users perform when installing new
fitness applications (on-boarding). Thereafter this support set will be used
by the algorithm either to re-train the model ($MAML^{p}$) or for comparison
($RN^{p}$). Both $MAML^{P}$ and $RN^{p}$ provides the opportunity to provide
new calibration data if the physiology of the user change to improve
performance. Such changes include a gait change, a disability or a dramatic
weight change that affect their personal activity rhythms.

##  9 Conclusion

In this paper, we presented Personalised Meta-Learning, a methodology for
learning to optimise for personalisation of Human Activity Recognition (HAR)
using only q few labelled data. This is achieved by treating the ”person-
activity” pair in a HAR dataset as a class label, where each class now only
has few instances of data for training. Accordingly, we implement Personalised
Meta-Learning with two Meta-Learning algorithms for few-shot classification
Personalised MAML ( $MAML^{p}$) and Personalised Relation Networks ($RN^{p}$)
where a meta-model is learned, such that it can be rapidly adapted to any
person not seen during training. Both algorithms require only a few instances
of calibration data from the end-user to personalised the meta-model, where at
deployment, $MAML^{p}$ uses calibration data for adaptation with model re-
training and $RN^{p}$ uses calibration data directly for matching (without re-
training). Our evaluation with 9 HAR datasets shows that both algorithms
achieve significant performance improvements in a range of HAR domains while
outperforming conventional Deep Learning, Few-shot Learning and Meta-Learning
algorithms. We highlight that personalisation achieves higher model
generalisation, compared to non-personalised Meta-Learners, which results is
faster model adaptation. Importantly we find, while $RN^{p}$ outperform
$MAML^{p}$ with a majority of HAR datasets, $MAML^{p}$ performs is
significantly faster than $RN^{p}$ due to the gains over paired matching.

## References

  * Berchtold et al. (2010) Martin Berchtold, Matthias Budde, Dawud Gordon, Hedda R Schmidtke, and Michael Beigl.  Actiserv: Activity recognition service for mobile phones.  In _International Symposium on Wearable Computers (ISWC) 2010_ , pp. 1–8. IEEE, 2010.
  * Finn et al. (2017) Chelsea Finn, Pieter Abbeel, and Sergey Levine.  Model-agnostic meta-learning for fast adaptation of deep networks.  In _Proceedings of the 34th International Conference on Machine Learning-Volume 70_ , pp. 1126–1135. JMLR. org, 2017.
  * Graves et al. (2014) Alex Graves, Greg Wayne, and Ivo Danihelka.  Neural turing machines.  _arXiv preprint arXiv:1410.5401_ , 2014.
  * Longstaff et al. (2010) Brent Longstaff, Sasank Reddy, and Deborah Estrin.  Improving activity classification for health applications on mobile devices using active and semi-supervised learning.  In _2010 4th International Conference on Pervasive Computing Technologies for Healthcare_ , pp. 1–7. IEEE, 2010.
  * Mishra et al. (2017) Nikhil Mishra, Mostafa Rohaninejad, Xi Chen, and Pieter Abbeel.  A simple neural attentive meta-learner.  _arXiv preprint arXiv:1707.03141_ , 2017.
  * Miu et al. (2015) Tudor Miu, Paolo Missier, and Thomas Plötz.  Bootstrapping personalised human activity recognition models using online active learning.  In _2015 IEEE International Conference on Computer and Information Technology; Ubiquitous Computing and Communications; Dependable, Autonomic and Secure Computing; Pervasive Intelligence and Computing_ , pp. 1138–1147. IEEE, 2015.
  * Nichol et al. (2018) Alex Nichol, Joshua Achiam, and John Schulman.  On first-order meta-learning algorithms.  _arXiv preprint arXiv:1803.02999_ , 2018.
  * Ordóñez & Roggen (2016) Francisco Javier Ordóñez and Daniel Roggen.  Deep convolutional and lstm recurrent neural networks for multimodal wearable activity recognition.  _Sensors_ , 16(1):115, 2016.
  * Santoro et al. (2016) Adam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy Lillicrap.  Meta-learning with memory-augmented neural networks.  In _International conference on machine learning_ , pp. 1842–1850, 2016.
  * Snell et al. (2017) Jake Snell, Kevin Swersky, and Richard Zemel.  Prototypical networks for few-shot learning.  In _Advances in neural information processing systems_ , pp. 4077–4087, 2017.
  * Sun et al. (2012) Xu Sun, Hisashi Kashima, and Naonori Ueda.  Large-scale personalized human activity recognition using online multitask learning.  _IEEE Transactions on Knowledge and Data Engineering_ , 25(11):2551–2563, 2012.
  * Sung et al. (2018) Flood Sung, Yongxin Yang, Li Zhang, Tao Xiang, Philip HS Torr, and Timothy M Hospedales.  Learning to compare: Relation network for few-shot learning.  In _Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition_ , pp. 1199–1208, 2018.
  * Tapia et al. (2007) Emmanuel Munguia Tapia, Stephen S Intille, William Haskell, Kent Larson, Julie Wright, Abby King, and Robert Friedman.  Real-time recognition of physical activities and their intensities using wireless accelerometers and a heart rate monitor.  In _2007 11th IEEE international symposium on wearable computers_ , pp. 37–40. IEEE, 2007.
  * Vinyals et al. (2016) Oriol Vinyals, Charles Blundell, Timothy Lillicrap, Daan Wierstra, et al.  Matching networks for one shot learning.  In _Advances in neural information processing systems_ , pp. 3630–3638, 2016.
  * Wang et al. (2019) Jindong Wang, Yiqiang Chen, Shuji Hao, Xiaohui Peng, and Lisha Hu.  Deep learning for sensor-based activity recognition: A survey.  _Pattern Recognition Letters_ , 119:3–11, 2019.
  * Wijekoon et al. (2019) Anjana Wijekoon, Nirmalie Wiratunga, and Kay Cooper.  Mex: Multi-modal exercises dataset for human activity recognition.  _arXiv preprint arXiv:1908.08992_ , 2019.
  * Wijekoon et al. (2020) Anjana Wijekoon, Nirmalie Wiratunga, Sadiq Sani, and Kay Cooper.  A knowledge-light approach to personalised and open-ended human activity recognition.  _Knowledge-based systems_ , 192:105651, 2020.
  * Yao et al. (2017) Shuochao Yao, Shaohan Hu, Yiran Zhao, Aston Zhang, and Tarek Abdelzaher.  Deepsense: A unified deep learning framework for time-series mobile sensing data processing.  In _Proceedings of the 26th International Conference on World Wide Web_ , pp. 351–360, 2017.