11institutetext:  ETRI11institutetext:  Electronics and Telecommunications
Research Institute (ETRI), 218 Gajeong-ro, Daejeon, Yuseong-gu, South Korea
22institutetext: Max-Planck Institute for Astronomy (MPIA), Königstuhl 17,
D-69117 Heidelberg, Germany

# Deep Transfer Learning for Classification of Variable Sources

Dae-Won Kim<EMAIL_ADDRESS>Doyeob Yeo<EMAIL_ADDRESS>Coryn A.L. Bailer-
Jones 22 Giyoung Lee 11

Ongoing or upcoming surveys such as Gaia, ZTF, or LSST will observe light-
curves of billons or more astronomical sources. This presents new challenges
for identifying interesting and important types of variability. Collecting a
sufficient number of labelled data for training is difficult, however,
especially in the early stages of a new survey. Here we develop a single-band
light-curve classifier based on deep neural networks, and use transfer
learning to address the training data paucity problem by conveying knowledge
from one dataset to another. First we train a neural network on 16 variability
features extracted from the light-curves of OGLE and EROS-2 variables. We then
optimize this model using a small set (e.g. 5%) of periodic variable light-
curves from the ASAS dataset in order to transfer knowledge inferred from
OGLE/EROS-2 to a new ASAS classifier. With this we achieve good classification
results on ASAS, thereby showing that knowledge can be successfully
transferred between datasets. We demonstrate similar transfer learning using
Hipparcos and ASAS-SN data. We therefore find that it is not necessary to
train a neural network from scratch for every new survey, but rather that
transfer learning can be used even when only a small set of labelled data is
available in the new survey.

###### Key Words.:

methods: data analysis - stars: variables: general - surveys - techniques:
miscellaneous

##  1 Introduction

In recent years, deep learning has achieved outstanding success in various
research areas and application domains. For instance, Convolutional Neural
Networks (CNNs) (Lecun et al., 2015) use convolutional layers to regularize
and build space-invariant neural networks to classify visual data (Krizhevsky
et al., 2012; Goodfellow et al., 2014; Szegedy et al., 2015). AlphaGo, which
is one of the most astonishing achievements of deep learning and is based on
reinforcement learning, defeated several world-class Go players (Silver et
al., 2016). In astronomy deep learning has become popular and has been used in
many studies such as star-galaxy classification (Kim & Brunner, 2017),
asteroseismology classification of red giants (Hon et al., 2017), photometric
redshift estimation (D’Isanto & Polsterer, 2018), galaxy-galaxy strong lens
detection (Lanusse et al., 2018), exoplanet finding (Pearson et al., 2018),
point source detection (Vafaei Sadr et al., 2019), and fast-moving object
identification (Duev et al., 2019), to name just a few examples.

Training a deep learning classification model requires a huge amount of
labeled data which are not always readily available. This can be addressed
using “transfer learning”, a method that preserves prior knowledge inferred
from one problem having sufficient samples (the “source”) and apply it to
another but related problem (the “target”) (Hinton et al., 2015; Yim et al.,
2017; Yeo et al., 2018). Transfer learning starts with a machine learning
model that has been trained on a lot of labeled samples from the source. It
then optimizes parameters in the model using a small number of labeled samples
from the target. The source and target samples can be different but need to be
related such that extracted features to train the model are general and
relevant in both samples. Period, amplitude, and variability indices could be
such features when the problem is one of classifying light-curves of variable
stars.

Transfer learning has been used to solve a variety of problems such as medical
image classification (Shin et al., 2016; Maqsood et al., 2019; Byra et al.,
2020), recommender-system applications (Pan et al., 2012; Hu et al., 2019),
bioinformatics applications (Xu et al., 2010; Petegrosso et al., 2016),
transportation applications (Di et al., 2018; Wang et al., 2018; Lu et al.,
2019), and energy saving applications (Li et al., 2014; Zhao & Grace, 2014).
Some studies in astronomy also used transfer learning such as Ackermann et al.
(2018); Domínguez Sánchez et al. (2019); Lieu et al. (2019); Tang et al.
(2019). These studies used transfer learning to analyze image datasets of
either galaxies or solar system objects, and confirmed that transfer learning
is successful even when using a small set of data.

The advantages of transfer learning are as follows:

  * •

Transfer learning uses accumulated knowledge from the source. Therefore it
works with a small set of samples from the target.

  * •

Transfer learning uses a pre-trained model, obviating the need to design a
deep neural network from scratch for every survey, which is a challenging and
time-consuming task. A pre-trained model furthermore contains better
initialization parameters than randomly initialized parameters. Thus it is
likely that transferring a pre-trained model shows faster convergence than
training from scratch.

  * •

It is possible to either add or remove certain output classes from the pre-
trained model during transfer-learning processes. This is particularly useful
because the classes in the target dataset are mostly different from the
classes of the source dataset.

Our previous work, UPSILoN: AUtomated Classification for Periodic Variable
Stars using MachIne LearNing (Kim & Bailer-Jones, 2016), we provided a
software package that automatically classifies light-curve into one of seven
periodic variable classes. Other groups have used UPSILoN to classify light-
curves of periodic variable stars (e.g. Jayasinghe et al. 2018; Kains et al.
2019; Hosenie et al. 2019).

In this paper, we introduce UPSILoN-T: UPSILoN using Transfer Learning.
UPSILoN-T is substantially different from UPSILoN in several respects:

  * •

UPSILoN-T can be transferred to other surveys whereas the UPSILoN’s Random
Forest model cannot be.

  * •

UPSILoN-T is not only able to classify periodic or semi-periodic variables but
also non-periodic variables such as QSOs or blue variables.

  * •

UPSILoN-T uses MCC (Matthews Correlation Coefficient; Matthews 1975) rather
than $F_{1}$ as a performance metric. MCC is known to give a relatively robust
performance measure for imbalanced samples (Boughorbel S, 2017). We use the
generalized MCC (Chicco, 2017) for multi-class classification.

  * •

UPSILoN-T uses deep learning whereas UPSLIoN used a Random Forest. The
UPSILoN-T model has three hidden layers with 64, 128, and 256 neurons,
respectively. This is a much smaller model ($\sim$200 KB) than UPSILoN’s
Random Forest model ($\sim$3 GB).

As far as we know, no previous work has applied transfer learning based on
deep learning to time-variability features extracted from light-curves. In
addition to developing the method, we provide a python library so that readers
can easily adapt our method to their datasets (see Appendix). The library
classifies a single-band light-curve into one of nine variable classes. If
multiple optical bands exist, the library can be applied to each of them
independently. Note that one of the goals of our method, as with its
predecessor UPSILoN, is not to be dependent on colours and so to be
independent of the availability or number of bands in the survey.

We give an introduction of a neural network in Section 2. In section 3.1 we
introduce the training set, and in section 3.2 we explain 16 time-variability
features that we use to train a classification model. From section 3.3 to 3.5,
we explain training processes and feature importance of the trained model.
Section 4 demonstrates the application of transfer learning to the other
light-curve datasets: ASAS, Hipparcos, and ASAS-SN. Section 5 gives the
classification performance of the transferred model as a function of light-
curve lengths and sampling. Section 6 gives a summary.

##  2 Artificial Neural Network

An artificial neural network (ANN) consists of multiple layers comprising an
input layer, hidden layer(s), and an output layer. ANN with at least two
hidden layers are usually called a deep neural network (DNN). Each layer
contains one or more nodes (neurons) that are connected to the nodes in the
next layer. Each connection has a particular weight that can be interpreted as
how much impact that node has on the connected node in the next layer. Data
are propagated through the network and the value on each node is computed
using an activation function (Agatonovic-Kustrin & Beresford, 2000). The
Heaviside function, hyperbolic tangent function, and rectified linear unit
(ReLU) (Nair & Hinton, 2010) are typical examples of nonlinear activation
functions that are often used between intermediate layers. The softmax
function is widely used in the output layer when solving a classification
problem (Nair & Hinton, 2010). Due to the nonlinearity, the function space
that can be expressed using ANN is diverse.

Figure 1: DNN architecture with one hidden layer.

An example of an ANN architecture is shown in Fig. 1. We define input nodes,
hidden nodes and output nodes as $\bm{x}$, $\bm{h}$ and $\bm{y}$,
respectively, that are vectors. Let the weights and biases between $\bm{x}$
and $\bm{h}$, and weights between $\bm{h}$ and $\bm{y}$ be $W_{1},\bm{b}_{1}$
and $W_{2},\bm{b}_{2}$, respectively. Then, $W_{1},W_{2}$ are matrices and
$\bm{b}_{1},\bm{b}_{2}$ are vectors. We can then express $\bm{x}$, $\bm{h}$,
and $\bm{y}$ as follows:

$\begin{array}[]{l}\bm{h}=\sigma_{1}\left(\bm{x}^{T}W_{1}+\bm{b}_{1}\right)\\\
\bm{y}=\sigma_{2}\left(\bm{h}^{T}W_{2}+\bm{b}_{2}\right)\end{array}$ (1)

where $\sigma_{1}(\cdot)$ and $\sigma_{2}(\cdot)$ denote the activation
function between $\bm{x}$ and $\bm{h}$, and between $\bm{h}$ and $\bm{y}$,
respectively. In classification problems, $\sigma_{1}$ and $\sigma_{2}$ are
typically the ReLU function and the softmax function, respectively. The values
of the output nodes give the probabilities that input (i.e. $\bm{x}$) belongs
to each of the output classes. The goal of a classification problem is
learning the weights so that the true classes receive the highest
probabilities. Given an input
$X=\left\\{\bm{x}_{1},\bm{x}_{2},\cdots,\bm{x}_{m}\right\\}$, this learning
process is done by minimizing a loss function such as cross entropy defined as
follows:

$\begin{array}[]{rcl}L(X;\bm{W})&\equiv&\displaystyle-\frac{1}{m}\sum_{i=1}^{m}\log
P(\bm{l}_{i}|\bm{y_{i}})\\\
&=&\displaystyle-\frac{1}{m}\sum_{i=1}^{m}\bm{l}_{i}\cdot\log(\bm{y_{i}})\end{array}$
(2)

where $\bm{l}_{i}$ the true label for each $\bm{x}_{i}$ and a one-hot encoded
vector, which is a vector representation of categorical data such as class
labels. That is, $\bm{l}_{k}=[l_{k,1},l_{k,2},\cdots,l_{k,c}]$ and
$l_{k,j}\in\\{0,1\\}$ for $k=\\{1,2,\cdots,m\\}$ and $j=\\{1,2,\cdots,c\\}$.
$c$ is the number of classes.
$\bm{W}=\left\\{W_{1},\bm{b}_{1},W_{2},\bm{b}_{2}\right\\}$ and $\cdot$
denotes an inner product. In the cases of imbalanced dataset classification, a
weighted cross entropy is often used, which is defined as follows:

$\begin{array}[]{ccl}L(X;\bm{W})&\equiv&\displaystyle-\frac{1}{m}\sum_{i=1}^{m}\bm{\alpha}\cdot(\bm{l}_{i}\circ\log(\bm{y_{i}}))\\\
&=&\displaystyle-\frac{1}{m}\sum_{i=1}^{m}\begin{bmatrix}\alpha_{1}\\\
\alpha_{2}\\\ \vdots\\\
\alpha_{c}\end{bmatrix}\cdot\begin{bmatrix}l_{i,1}\log(y_{i,1})\\\
l_{i,2}\log(y_{i,2})\\\ \vdots\\\ l_{i,c}\log(y_{i,c})\\\
\end{bmatrix}\end{array}$ (3)

where $\bm{\alpha}=[\alpha_{1},\alpha_{2},\cdots,\alpha_{c}]$ and $\circ$
denotes an element-wise product. $\alpha_{i}$ is a weight for a given class
which is a nonnegative real number, where $\sum_{i=1}^{c}{\alpha_{i}}=1$.

Inferring the weights (i.e. learning) is done by minimizing a loss function
such as that in Equation (2) or (3) using a gradient descent method:

$\bm{W}_{\textrm{new}}\leftarrow\bm{W}_{\textrm{old}}-\lambda\nabla_{\bm{W}}L(X;\mathbf{W}_{\textrm{old}})$
(4)

where $\lambda$ is a learning rate for the gradient descent optimization which
is a positive constant. The minimization is often done by using a stochastic
gradient descent optimization (SGD) (Hinton et al., 2012; Graves et al., 2013)
or a modified stochastic gradient descent optimization (Kingma & Ba 2014). In
the case of SGD, the input data are split into several batches (i.e. mini-
batch) and then SGD is applied to each mini-batch as the pseudo-code shown in
Algorithm 1.

Algorithm 1 ANN learning procedure

Input:
Initialized weights of ANN to be learned:
$\bm{W}=\left\\{W_{1},\bm{b}_{1},W_{2},\bm{b}_{2}\right\\}$
Output:
Learned weights of ANN: $\bm{W}$

1:

2:while $\bm{W}$ does not converge do

3: Choose a mini-batch $X_{\mathcal{B}}$ of size $n$
$X_{\mathcal{B}}=\left\\{\bm{x}_{\mathcal{B},1},\cdots,\bm{x}_{\mathcal{B},n}\right\\}\subset
X$

4:
$\bm{W}_{\textrm{new}}\leftarrow\displaystyle\bm{W}_{\textrm{old}}-\lambda\nabla_{\bm{W}}L_{\textrm{CE}}(X_{\mathcal{B}};\mathbf{W}_{\textrm{old}})$
$\triangleright$ Update $\bm{W}$ using SGD

5:end while

##  3 UPSILoN-T Classifier

###  3.1 Training Set

Table 1: The number of sources per true class in the OGLE and EROS-2 training set Superclass (Acronym) | Subclass | Number | Note
---|---|---|---
QSO |  | 165 |
$\delta$ Scuti (DSCT) |  | 3209 |
Type II Cepheid (T2CEPH) |  | 300 |
Blue Variable (BV) |  | 735 |
Non-variable (NonVar) |  | 8050 |
RR Lyrae (RRL) |  |  |
| ab | 19 921 |
| c | 4974 |
| d | 1077 |
| e | 1327 |
Cepheid (CEPH) |  |  |
| F | 2981 | fundamental
| 1O | 2043 | first overtone
| Other | 443 |
Eclipsing Binary (EB) |  |  |
| EC | 1398 | contact
| ED | 19 075 | detached
| ESD | 7339 | semi-detached
Long Period Variable (LPV) |  |  |
| Mira AGB C | 1361 | carbon-rich
| Mira AGB O | 783 | oxygen-rich
| OSARG AGB | 25 284 |
| OSARG RGB | 29 516 |
| SRV AGB C | 6062 | carbon-rich
| SRV AGB O | 8780 | oxygen-rich
Total |  | 144 823 |

The training set consists of single-band light-curves of variable sources from
two independent surveys, OGLE (Udalski et al., 1997) and EROS-2 (Tisserand et
al., 2007). We mix variable sources from the two surveys in order to build a
rich training set. The training set comprises non-variables and seven classes
of periodic variables: $\delta$ Scuti stars, RR Lyraes, Cepheids, Type II
Cepheids, eclipsing binaries, and long period variables. We also use
subclasses (e.g. Cepheid F, 1O, and Other) of each class if these exist. These
seven classes of variable sources are from Kim & Bailer-Jones (2016) who
originally compiled and cleaned the list of periodic variable stars from
several sources including Soszynski et al. (2008); Soszyński et al. (2008,
2009); Soszyñski et al. (2009); Poleski et al. (2010); Graczyk et al. (2011);
Kim et al. (2014). As described in these papers, light-curves are visually
examined and cleaned in order to remove light-curves that do not show
variability. In the present work we also add to the training set QSOs and blue
variables from Kim et al. (2014). These two types of variables generally show
non-periodic and irregular variability. Note that the training set is not
exhaustive since it does not contain all types of variable sources in the real
sky. Thus a model trained on the training set will classify a light-curve that
does not belong to the training classes into a most similar training class
based on variability.

The observation duration is about eight years for the OGLE light-curves, and
about seven years for the EROS-2 light-curves. We use OGLE I-band light-curves
and EROS-2 blue-band, $B_{E}$, light-curves because these generally have more
data points and better photometric accuracy than OGLE V-band and EROS-2 red-
band, $R_{E}$, respectively. The average number of data points in the light-
curves is about 500. Table 1 shows the number of objects per class in the
training set. There is a total of 21 variable classes.

###  3.2 Variability Features

We extract 16 variability features from each light-curve in the training set.
These features, listed in Table 2, are taken from von Neumann (1941); Shapiro
& Wilk (1965); Lomb (1976); Ellaway (1978); Grison (1994); Stetson (1996);
Long et al. (2012); Kim et al. (2014); Kim & Bailer-Jones (2016). These
features have proven to be useful for classifying both periodic and non-
periodic variables (e.g. QSOs) in our previous works (Kim et al., 2011, 2012,
2014; Kim & Bailer-Jones, 2016). They are generic and can be extracted from
any single-band light-curves. Four of the features ($\psi^{\eta}$,
$\psi^{CS}$, $m_{p90}$, and $m_{p10}$) are based on a phase-folded light-
curve. We excluded survey-dependent features, such as colours, because we want
to transfer accumulated knowledge from one survey to another.

Table 2: 16 Variability features  Feature | Description | Reference
---|---|---
Period | Period derived by the Lomb-Scargle algorithm | Lomb (1976)
$\gamma_{1}$ | Skewness |
$\gamma_{2}$ | Kurtosis |
$\psi^{\eta}$ |  $\eta$ (von Neumann, 1941) of a phase-folded light-curve | Kim et al. (2014)
$\psi^{CS}$ |  Cumulative sum (Ellaway, 1978) index of a phase-folded light-curve | Kim et al. (2014)
$Q_{3-1}$ |  3rd quartile (75%) - 1st quartile (25%) | Kim et al. (2014)
$A$ | Ratio of magnitudes brighter or fainter than the average magnitude | Kim & Bailer-Jones (2016)
$H_{1}$ | Amplitude derived using the Fourier decomposition | Grison (1994)
$m_{p90}$ | 90% percentile of slopes of a phase-folded light-curve | Long et al. (2012)
$m_{p10}$ | 10% percentile of slopes of a phase-folded light-curve | Long et al. (2012)
$R_{21}$ |  2nd to 1st amplitude ratio derived using the Fourier decomposition | Grison (1994)
$R_{31}$ |  3rd to 1st amplitude ratio derived using the Fourier decomposition | Grison (1994)
$\phi_{21}$ |  Difference between 2nd and 1st phase derived using the Fourier decomposition | Grison (1994)
$\phi_{31}$ |  Difference between 3rd and 1st phase derived using the Fourier decomposition | Grison (1994)
$K$ |  Stetson $K$ index | Stetson (1996)
$W$ | Shapiro–Wilk normality test statistics | Shapiro & Wilk (1965)

We take logarithm base 10 of nine of the features (period, $\gamma_{1}$,
$\gamma_{2}$, $\psi^{\eta}$, $\psi^{CS}$, $Q_{3-1}$, $A$, $H_{1}$, and
$m_{p90}$) because we found empirically that a model trained using these
$\log_{10}$ applied features improved the performance over using the features
directly. We scale each of the nine feature set as follows:

  1. 1.

Derive the minimum value of a feature set.

  2. 2.

Subtract the minimum value minus one from each feature in the feature set.

  3. 3.

Take logarithm base 10 of the features.

Performance did not improve when taking the logarithm of the other features,
so they were used directly. Finally, we normalize each 16 feature set by
calculating the standard score.

###  3.3 Model Training

####  3.3.1 Classification Performance Metric

In order to measure the classification performance of a trained model and then
select the one that gives the best performance, we use the MCC (Matthews
Correlation Coefficient; Matthews 1975) metric rather than the mode
traditional $F_{1}$ or accuracy. For two-class problems, the MCC, accuracy,
and $F_{1}$ are defined as follows:

$\text{\footnotesize{MCC}}=\frac{\text{\footnotesize{{TP $\times$ TN - FP
$\times$ FN}}}}{\sqrt{\text{\footnotesize{({TP + FP})({TP + FN})({TN +
FP})({TN + FN})}}}}$ (5)

$\text{Accuracy}=\frac{TP+TN}{TP+TN+FP+FN}$ (6)

$F_{1}=2\times\frac{\text{precision}\times\text{recall}}{\text{precision}+\text{recall}}$
(7)

where $TP,\,TN,\,FP,$ and $TN$ is the number of true positives, true
negatives, false positives, and false negatives, respectively. Precision and
recall in the equation of $F_{1}$ are defined as follows:

$\text{precision}=\frac{TP}{TP+FP}\,\,,\,\,\,\,\text{recall}=\frac{TP}{TP+FN}$
(8)

The MCC is a more informative measure for imbalanced datasets than the other
two measures because the MCC utilizes all four categories of a confusion
matrix (Powers, 2011; Boughorbel S, 2017). $F_{1}$ does not take account of
true negative and thus is less informative for imbalanced datasets. Accuracy
is inappropriate for imbalanced datasets because high accuracy does not
necessarily indicate high classification quality, due to the “Accuracy
Paradox” (Fernandes et al., 2010; Valverde-Albacete & Peláez-Moreno, 2014).
The MCC ranges from -1.0 to 1.0, where 1.0 indicates that the predictions
match exactly with the true labels, 0.0 indicates that the predictions are
random, and -1.0 means that the predictions are completely opposite to the
true labels. It is claimed that the MCC is the most informative value to
measure classification quality using a confusion matrix (Chicco, 2017). In the
case of multi-class problems, the MCC is generalized as follows (Gorodkin,
2004):

$\displaystyle\text{MCC}=\left[\sum_{k}\sum_{l}\sum_{m}C_{kk}C_{lm}-C_{kl}C_{mk}\right]$
(9)
$\displaystyle\times\left[\sum_{k}\left(\sum_{l}C_{kl}\right)\left(\sum_{k^{\prime}|k^{\prime}\neq
k}\sum_{l^{\prime}}C_{k^{\prime}l^{\prime}}\right)\right]^{-\frac{1}{2}}$
$\displaystyle\times\left[\sum_{k}\left(\sum_{l}C_{lk}\right)\left(\sum_{k^{\prime}|k^{\prime}\neq
k}\sum_{l^{\prime}}C_{l^{\prime}k^{\prime}}\right)\right]^{-\frac{1}{2}}$

For convenience, we map MCC to the range [0, 1] as suggested in Chicco &
Jurman 2020:

$\displaystyle M_{c}=\frac{1+\text{MCC}}{2}$ (10)

Hereinafter, we use $M_{c}$ to report classification quality of neural
networks.

####  3.3.2 Training DNN Models

Figure 2: The neural network architecture that we adopted in this work. The
input is a vector of 16 variability features. Each linear unit contains one
batch normalization layer and one fully-connected layer. We use ReLU as an
activation function between layers. The last linear unit has 21 outputs, which
is the number of variable classes in our training set. We use the softmax
function before the output layer in order to scale the outputs to lie between
0 and 1, to represent probabilities for the 21 output classes. Figure 3: Class
probability distribution of the light-curves in the training set. The upper
panel shows the highest and the second highest probabilities. The bottom panel
shows the differences between the two.

In order to find the best architecture for classifying the OGLE and EROS-2
training set, we trained many DNN models with different combinations of the
number of hidden layers, the number of neurons in each hidden layer, loss
functions, and activation functions between layers. The model training
processes are as follows:

  1. 1.

Randomly split the dataset shown in Table 1 into 80% training and 20%
validation set while preserving class ratio (i.e. stratified sampling).

  2. 2.

Train a DNN model from scratch using the training set with the batch size of
1024 and learning rate = 0.1. This counts as one training epoch. $M_{c}$ is
then calculated using the validation set.

  3. 3.

Run the training process in step 2 for 500 iterations (i.e. 500 training
epochs). If $M_{c}$ is not improved for three consecutive epochs, decrease the
learning rate by 10. If the learning rate becomes lower than $10^{-10}$,
increase it back to 0.1, according to a technique called the cyclical learning
rate (CLR; Smith 2015).

  4. 4.

Get the highest $M_{c}$ value (i.e. the best $M_{c}$ value) during the 500
epochs.

  5. 5.

Repeat steps 1 to 4 30 times and calculate the mean of the best $M_{c}$ values
and the standard error of this mean (SEM), which is defined as:

$\text{SEM}=\frac{\sigma}{\sqrt{n}}$ (11)

where $\sigma$ is standard deviation of the n $M_{c}$ values from the $n$=30
cycles.

The loss function that we chose is cross entropy explained in Section 2. While
training DNN models, we use the SGD (stochastic gradient descent; Hinton et
al. 2012, Graves et al. 2013) optimizer because we empirically found SGD gives
better classification performance than other optimizers (e.g. ADAM: Kingma &
Ba 2014; ADADELTA: Zeiler 2012; and ADAGRAD: Duchi et al. 2011). We also use a
batch normalization method that converts the inputs to layers into a normal
distribution in order to mitigate “internal covariate shift” (Ioffe & Szegedy,
2015). Ioffe & Szegedy (2015) showed that the method makes training faster and
more stable.

After training many DNN models, we finally chose the architecture that have
the highest validation-set $M_{c}$, which was 0.9043. This is shown in Fig. 2.
Note that we use $M_{c}$ to choose the best model but not as a loss function
to optimize neural networks. We will refer to this best model as the “U
model”, an abbreviation of “UPSILoN-T model”. The number of trainable
parameters in the U model is 48,799. Given that the number of training samples
is 144,823 and there are 16 features per sample, we presume that there exist
enough features to train the parameters. Furthermore, the parameters in a
network are not, and need not be, independent. Therefore it is not
theoretically necessary to have more training features than the number of
trainable parameters.

Some examples of the DNN architectures that we trained are shown in Table 3
where the U model is shown in bold text. As the table shows, increasing the
number of layers and the number of neurons in each hidden layer increases
classification performance. On the other hand, using too many neurons degrades
classification performance as can be seen in the bottom three rows due to
overfitting of the training data. The $M_{c}$ differences between the models
are statistically significant at the several sigma level. Whether the
differences are practically significant or not is, however, another issue. In
order to confirm that the differences are practically significant, we would
need to apply every trained DNN model to many different time-series databases
having labels for light-curves and then check their classification
performances. We have not done this, as we just chose the best model, but this
does not preclude that a simpler model is in fact almost as good in practice.

We classify each light-curve according to the highest probability of all the
classes. The top panel in Fig. 3 shows the highest and the second highest
probabilities for each source in the training sample. As the panel shows, the
majority of the highest probabilities are larger than 0.8 while the majority
of the second highest probabilities are lower than 0.2. In the bottom panel,
we show the histogram of differences between the two. As expected, the
differences are generally larger than 0.5. This means that the classifier is
reasonably confident about its class assignments. The U model returns both the
predicted class and the probabilities of all classes, so users can set a
threshold on a probability if they desire.

Table 3: Classification performance of the neural network models

The Number of Hidden Layers |  Best $M_{c}$ |  Avg. of $M_{c}$ |  SEM2 | Model Size
---|---|---|---|---
and Neurons in Each Layer1 |  |  |  |
32 | 0.8878 | 0.8848 |  3.9$\times 10^{-4}$ | 9 KB
64 | 0.8926 | 0.8891 |  3.1$\times 10^{-4}$ | 14 KB
128 | 0.8940 | 0.8925 |  1.9$\times 10^{-4}$ | 24 KB
256 | 0.8957 | 0.8929 |  2.1$\times 10^{-4}$ | 44 KB
32 $\rightarrow$ 64 | 0.9005 | 0.8970 |  2.2$\times 10^{-4}$ | 21 KB
64 $\rightarrow$ 128 | 0.9017 | 0.8999 |  1.9$\times 10^{-4}$ | 55 KB
128 $\rightarrow$ 256 | 0.9027 | 0.9002 |  2.4$\times 10^{-4}$ | 171 KB
256 $\rightarrow$ 128 | 0.8996 | 0.8934 |  1.6$\times 10^{-4}$ | 169 KB
32 $\rightarrow$ 64 $\rightarrow$ 128 | 0.9027 | 0.9004 |  1.9$\times 10^{-4}$ | 63 KB
64 $\rightarrow$ 128 $\rightarrow$ 256 | 0.9043 | 0.9015 | $\bm{2.2\times 10^{-4}}$ | 202 KB
128 $\rightarrow$ 256 $\rightarrow$ 512 | 0.9031 | 0.9008 |  2.2$\times 10^{-4}$ | 726 KB
256 $\rightarrow$ 512 $\rightarrow$ 1024 | 0.9018 | 0.9002 |  1.5$\times 10^{-4}$ | 3 MB
512 $\rightarrow$ 1024 $\rightarrow$ 2048 | 0.9032 | 0.9001 |  2.4$\times 10^{-4}$ | 11 MB

1 The integer values indicate the number of neurons in each hidden layer. For
instance “$32\rightarrow 64$” means that there are two hidden layers, which
have 32 and 64 neurons.
2 $n$ in Equation (11) is 30.

####  3.3.3 Classification Quality of the U model

Figure 4: The confusion matrix of the U model. Labels on the vertical axis are
the true classes and labels on the horizontal axis are the predicted classes.
Each row is divided by the number of true objects per variable class. Thus the
values on each diagonal are recall. We show the value if it is larger than or
equal to 0.01. Figure 5: The top panel shows training-set $M_{c}$ (blue line)
and validation-set $M_{c}$ (orange line) as a function of training epochs. The
bottom panel shows changes of learning rate as a result of cyclical learning
rate (CLR) application. The red arrow indicates the training epoch where the
best validation-set $M_{c}$ is achieved.

In Fig. 4, we show the U model’s confusion matrix normalized by the number of
true objects per class. The numbers on the leading diagonal represent recall
values for each variable class. Most of the recall values are higher than
$\sim$0.8 except for a few classes such as T2CEPH or QSO. The figure also
shows confusion within subclasses of a certain variable class such as LPV or
EB. This confusion is expected because variability patterns residing in their
light-curves are likely to be similar.

In the top panel of Fig. 5, we show $M_{c}$ and learning rate as a function of
training epoch. The figure shows 500 epochs of the $n$=18 cycle (see step 5 in
Section 3.3.2) where the highest validation-set $M_{c}$ (annotated with the
red arrow) is achieved. As the figure shows, the training-set $M_{c}$ keeps
increasing as a function of epoch. This indicates that the model eventually
starts to overfit the training samples. Note that the U model is chosen based
on the validation-set $M_{c}$, not based on the training-set $M_{c}$. The
lower panel of Fig. 5 shows the change in the learning rate during the
training processes. We see the learning rate cyclying decreasing and
increasing, a consequence of our using CLR. $M_{c}$ value (the top panel)
derived using the training sets and validation sets vary according to the
changes of learning rate. The highest validation-set $M_{c}$ is obtained after
several iterations of CLR.

For comparison purposes, we trained Random Forest (Breiman, 2001) models with
the same dataset and variability features. We trained the models using 80% of
the data as a training set and then derived $M_{c}$ using the remaining 20%
data, just as we did for the DNN model training. We optimized the model hyper-
parameters using the 80% training set and using ten-fold cross-validation and
brute-force grid search over a two-dimensional grid of $t$ and $m$, where $t$
is the number of trees and $m$ is the number of randomly selected features for
each node in trees. The grid values of $t$ and $m$ are [100, 200, 300, 400,
500, 600, 700, 800, 900, 1000, 1100, 1200] and [4, 6, 8, 10, 12, 14],
respectively.111The grid values are from our previous work, Kim & Bailer-Jones
(2016).. We repeated the training processes ten times. The highest $M_{c}$
after the training is 0.8996, which is lower than DNN’s $M_{c}$. The average
of $M_{c}$ and SEM222In this case, $n$ in the equation 11 is 10. are 0.8963
and 7.7$\times 10^{-4}$, respectively. Thus we concluded that the Random
Forest model gives slightly worse performance than the U model. Nevertheless,
this result does not mean that DNN is always superior than Random Forest for
variable source classification using variability features.

In the case of random light-curves that do not belong to any of the training
classes, we found empirically that most of them are classified as non-
variables as follows:

  * •

We generated 1,000 light-curves consisting of purely random values, extracted
16 variability features from them, and predicted their classes using the U
model. The U model predicted $\sim$800 of them as non-variables, $\sim$100 as
long-period variables. The remaining $\sim$100 light-curves’ predicted classes
were dispersed through other variable classes.

  * •

We randomly shuffled data points in each light-curve of the ASAS variable
stars (Table 4 in Section 3.4), extracted 16 variability features, and used
the U-model to predict their classes. As a result, $\sim$7,000 light-curves
were classified as non-variables, and $\sim$3,000 light-curves were classified
as EB EDs. The remaining $\sim$1,000 light-curves’ predicted classes were
dispersed through other classes.

###  3.4 Application to ASAS light-curves of Periodic Variable Stars

To validate the classification quality of the U model in general, we applied
it to the ASAS light-curves of periodic variable stars that contain $\delta$
Scuti stars, RR Lyraes, Cepheids, eclipsing binaries, and long-period
variables (Pojmanski, 1997). The duration of the light-curves is about nine
years. The average number of data points is about 500. We collected the light-
curves from Kim & Bailer-Jones (2016). The number of samples per true variable
class and the classification quality is shown in Table 4. We derived the
$F_{1}$ measure of the same dataset as well, and it was 0.87. This is slightly
higher than $F_{1}$=0.85 from Kim & Bailer-Jones (2016) that used the same
training set and the 16 variability features to train a Random Forest.
Nevertheless, this does not necessarily mean that the U model is always
superior to the Random Forest. For instance, we applied the U model to light-
curves from the MACHO dataset that Kim & Bailer-Jones (2016) also used. In
this case, the $F_{1}$ measures for both the U model and the Random Forest
model are identical at 0.92.

Table 4: The number of objects per true class in the ASAS dataset  Superclass | Subclass | Number | $M_{c}$
---|---|---|---
EB |  |  |
| EC | 2550 | 0.91
| ED | 2167 | 0.96
| ESD | 823 | 0.86
RRL |  |  |
| ab | 1218 | 0.97
| c | 305 | 0.82
CEPH |  |  |
| F | 567 | 0.84
| 1O | 179 | 0.78
DSCT |  | 520 | 0.88
LPV |  | 2450 | 0.97
Total |  | 10 779 | 0.91

###  3.5 Feature Importance

We use the SHAP (SHapley Additive exPlanations; Lundberg & Lee 2017) method to
measure the feature importance in the U model. SHAP values represents how
strongly each feature impacts on model’s predictions. They are derived from
the Shapley value (Shapley, 1953) used in cooperative game theory.
Conceptually, the Shapley value measures the degree of contribution of each
player to a game where all the players cooperate. Although there are few SHAP
applications in physics, Pham et al. (2019); Amacker et al. (2020); Scillitoe
et al. (2020) used SHAP to measure feature importances for their machine
learning applications such as predicting solar flare activities, Higgs self-
coupling measurements, and data-driven turbulence modelling.

Fig. 6 shows the SHAP feature importance for the U model. This shows the mean
absolute value of SHAP over all samples for each feature. We see that the
period is the most important feature, which has also been found in other
studies (e.g. Kim et al. 2014; Kim & Bailer-Jones 2016; Elorrieta et al.
2016). All other features also contribute to the classification of variable
classes although their contributions are lower than period’s contribution.

We trained two independent DNN models with the same architecture as shown in
Figure 2. Both are trained with periods removed, the second with the period-
related features ($\psi^{\eta}$, $\psi^{CS}$, $m_{p90}$, and $m_{p10}$) also
removed. As a result, the $M_{c}$ drops from 0.90 to 0.87 in the first case
and to 0.82 in the second case. Given that the SEM values (Table 3) are quite
small, these decreases are significant, again confirming that periods are
critical for variable classification. Note, however, that periods of some
training classes do not have a strict physical meaning as a period such as for
quasars. In such cases, they are just used as a variability feature.

Figure 6: SHAP (Shapley additive explanations) feature importance Lundberg &
Lee (2017). The larger the SHAP value, the more important a feature. The mean
absolute SHAP value shows the accumulated feature importance for all variable
classes depicted in different colors.

##  4 Transferring the U model’s Knowledge to Other Light-Curve Datasets of
Variable Sources

###  4.1 Transfer Learning

Transfer learning is a research field in machine learning that aims to
preserve knowledge accumulated while solving one problem (source), then to
utilize this to solve other but related problem (target) (Cowan et al., 1994;
Pan & Yang, 2010). Depending on the problem at hand, conditions of source and
target could vary in several ways. In this work, which aims to transfer the U
model to data from other surveys, we want to deal with the following issues:

  1. 1.

Different class label space.
The number of variable classes (21 as shown in Table 1) of the OGLE and EROS-2
training set is different from the number of variable classes of the ASAS
dataset (9 as shown in Table 4). Moreover, not only the number of variable
classes but also the variable types are different. For instance, there are no
QSOs or blue variables in the ASAS dataset.

  2. 2.

Different frequency of class members.
The number of contacted eclipsing binaries (EC) in the OGLE and EROS-2
training set is 1398 (see Table 1), which is less than 1% of the dataset, but
their number in the ASAS dataset is 2550 (see Table 4), which is $\sim$24% of
the dataset.

  3. 3.

Different distribution of variability features.
Magnitude ranges, filter wavelengths, and noise characteristics are different
per survey. This implies that the distribution of 16 variability features
extracted from light-curves is not identical between source and target.

The widely-used transfer-learning approach to deal with these issues is to
transfer the weights from the pre-trained model. That is, we start with the
same neural network model with the same weights (i.e. the U model). We then
continue with the training in one or two different ways. The first is to
optimize the weights of every layer, and the second is to optimize the weights
of only the last fully-connected layer while freezing the other layers. In
Fig. 2, the last fully-connected layer is in the fourth linear unit (i.e. the
last linear unit). In both approaches we adjust the number of output nodes at
the last linear unit so that the number of output nodes is equal to the number
of variable classes from the target dataset.333Technically, we replace the
fully-connected layer in the fourth linear unit with a new fully-connected
layer having the same number of output nodes with the number of target’s
variable classes. By doing this, we can obtain appropriate prediction results
with regard to the target dataset’s classes.

In order to show the benefit of transfer learning, we define a base model
(step 2 in the following list) as the non-transferred and directly trained
model, and compare it to the transferred models (step 4). We will also compare
a model directly trained on a small dataset (scratch models, step 3) with the
transferred models. The process for the transfer learning that we apply to
each target dataset (i.e. ASAS, Hipparcos, and ASAS-SN) is as follows:

  1. 1.

Randomly split the target dataset into 80% and 20% while preserving the class
ratio (stratified sampling). We call the 80% dataset $D_{0.8}$, and the 20%
dataset the test set.

  2. 2.

Train a DNN model from scratch with the same architecture shown in Fig. 2. We
use the entire $D_{0.8}$ to train the model. We call this the base model. The
training process is the same as the ones from steps 1 to 3 in Section 3.3.2.
We then calculate $M_{c}$ of the base model using the test set. Note that this
base model does not use any accumulated knowledge from the U model (i.e.
weights in the U model).

  3. 3.

Randomly choose a 3% subset of $D_{0.8}$ and then use this subset to train a
DNN model from scratch, which has the same architecture as the one shown in
Fig. 2. We use the same training process in Section 3.3.2. We call this the
scratch model. Also note that we do not transfer any of the U model’s
accumulated knowledge. After the training, we compute $M_{c}$ for the scratch
model on the test set.

  4. 4.

Use the same 3% subset of $D_{0.8}$ used for training the scratch model to
transfer the U model. As mentioned above, we transfer the U model according
two different approaches 1) optimizing weights of every layers, and 2)
optimizing weights of only the last fully-connected layer while freezing
weights of all other layers. We call the former a every-layer model, and the
latter an last-layer model. Note that both approaches start from the initial
weights of the U model rather than from random initialization. We again use
the same training process in Section 3.3.2 to optimize the weights. We compute
the $M_{c}$ of these models using the test set.

  5. 5.

Repeat steps 3 to 4 using 5%, 10%, 15%, 20%, 50%, and 100% of $D_{0.8}$.
Theoretically, classification quality of the base model should be identical to
the one of the scratch model trained using 100% of $D_{0.8}$ because the base
model is also trained using the same 100% of $D_{0.8}$.

  6. 6.

Repeat steps 1 to 5 30 times and use these to compute the mean and SEM value
of $M_{c}$.

In the following three sections, we show and analyze the results of using this
transfer learning procedure on three different datasets.

###  4.2 Application to the ASAS Dataset

Figure 7: Average $M_{c}$ with SEM as error bars for the last-layer, every-
layer, and scratch models. The every-layer models’ $M_{c}$ are slightly higher
than the scratch models’ $M_{c}$. The last-layer models show higher $M_{c}$
for small training sets, and vice versa for large training sets. We add a
small offset on the x-axis to the scratch models in order to prevent its error
bars from lying on top of the other error bars.

The results of applying the transfer learning process to the ASAS dataset
described in Section 3.4 are given in Fig. 7. The base model’s average $M_{c}$
is 0.9501 and SEM is 1.8$\times 10^{-3}$. The figure also shows the results
for the other models (described in the previous section), which we now briefly
discuss.

  1. 1.

Scratch model.

The scratch models’ $M_{c}$ increase as the size of a subset of $D_{0.8}$
increases. The one trained using 100% of $D_{0.8}$ shows $M_{c}$ = 0.9513,
which is very similar to the $M_{c}$ of the base model.

  2. 2.

Every-layer model.

The every-layer models’ $M_{c}$ are generally higher than the scratch models’
$M_{c}$, even when their training set is small. This result shows the benefit
of transfer learning, even when the target dataset is small. For larger
samples (50%-100% subset), the results of the transferred models and scratch
models are similar.

  3. 3.

Last-layer model.

The last-layer models preserve more knowledge from the U model than the every-
layer models do. For the same reason, the last-layer model could give worse
performance because new knowledge from the target dataset cannot be
transmitted to every layer. The results show that which effect dominates
depends on the training sample size. For small training sets, the last-layer
models produce a higher $M_{c}$, and vice versa for large training sets. We
also see that the SEM values of the last-layer models are smaller than other
models, because optimizing the weights in only the last layer gives less
freedom to update the weights than optimizing the weights in every layer.

Figure 8: The confusion matrix of the ASAS transferred model. Labels are as in
Table 4.

Overall we see that transfer learning produces good results when the size of
the target dataset is small, which is one of the advantages of using transfer
learning. Transferring only the last layer is not a good choice when there is
a relatively large number of target samples. In such cases, training from
scratch (base model) or transferring every layer works better, although it
requires more computation time. In addition, we show a confusion matrix of the
every-layer model trained on the 100% subset in Fig. 8. This shows good
classification performance.

###  4.3 Application to the Hipparcos Dataset

Table 5: The number of objects per true class in the Hipparcos dataset

Type | Hipparcos Class | Number |  UPSILoN-T class1
---|---|---|---
Eclipsing binary |  |  |
detached | EA | 222 | EB ED
semi-detached | EB | 246 | EB ESD
contact | EW | 99 | EB EC
RR Lyrae | RRAB | 71 | RRL ab
| RRC | 19 | RRL c
$\delta$ Cepheid |  |  |
fundamental mode | DCEP | 170 | CEPH F
first overtone | DCEPS | 28 | CEPH 1O
multi-mode | CEP(B) | 11 | CEPH Other
$\delta$ Scuti | DSCT | 45 | DSCT
low amplitude | DSCTC | 80 | DSCT
Long-period variable | LPV | 254 | LPV
Ellipsoidal | ELL | 27 |
RS Canum Venaticorum | RS+BY | 35 |
\+ BY Draconis |  |  |
Slowly pulsating B star | SPB | 78 |
$\alpha$ Cygni | ACYG | 17 |
$\alpha^{2}$ Canum Venaticorum | ACV | 75 |
$\beta$ Cephei | BCEP | 29 |
$\gamma$ Doradus | GDOR | 25 |
B emmission line star | BE+GCAS | 12 |
\+ $\gamma$ Cassiopeiae |  |  |
W Virginis |  |  |
long-period (¿ 8 days) | CWA | 9 |
short period (¡ 8 days) | CWB | 6 |
SX Arietis | SXARI | 7 |
RV Tauri | RV | 5 |
Total |  | 1570 |

1 Corresponding classes in the training set.

We now apply transfer learning to the Hipparcos dataset (Dubath et al., 2011)
which has more classes but fewer samples than the ASAS dataset (see Table 5).
The 1570 Hipparcos light-curves that we extracted from Kim & Bailer-Jones
(2016) is substantially smaller than the 10 779 light-curves in the ASAS
dataset. The duration of the light-curves varies from one to three years, and
the average number of data points is about 100.

Overall training process is the same as the one mentioned in Section 4.1. To
ensure sufficient samples for training, however, we split the Hipparcos data
into 50%/50% training/testing sets ($D_{0.5}$), rather than the 80%/20% that
we used for ASAS. We use the entire set of $D_{0.5}$ to train scratch models
and also to transfer the U model. We did not train separate base models since
these are now the same as the scratch models.

The result of transfer learning is shown in Table 6. The scratch model’s
average $M_{c}$ is 0.7398 whereas the every-layer model’s average $M_{c}$ is
0.7770. The last-layer model’ achieves the highest average $M_{c}$ of all
models tested, of 0.8230. Due to the small number of target samples, learning
from scratch is significantly inferior to transfer learning in this case. Fig.
9 is a confusion matrix of the last-layer model, which shows relatively large
confusion between the classes because of the insufficient target samples as
well.

Figure 9: The confusion matrix of the Hipparcos transferred model. Labels are
as in Table 5. Table 6: Transfer learning application using the Hipparcos
dataset

Model |  Avg. of $M_{c}$ |  SEM1
---|---|---
Scratch Model |  |
| 0.7398 |  1.3$\times 10^{-2}$
Transfer Model |  |
(every-layer model) |  |
| 0.7770 |  8.6$\times 10^{-3}$
Transfer Model |  |
(last-layer model) |  |
| 0.8230 |  1.8$\times 10^{-3}$

1 $n$ in Equation (11) is 30.

###  4.4 Application to the ASAS-SN Dataset

Table 7: The number of objects per true class in the ASAS-SN dataset

Type | ASAS-SN Class | Number |  UPSILoN-T class1
---|---|---|---
Cepheid | DCEP | 743 | CEPH F
$\delta$ Cephei-type variable | DCEPS | 207 | CEPH 1O
with a symmetrical light-curve |  |  |
$\delta$ Scuti | DSCT | 1412 | DSCT
High amplitude $\delta$ Scuti | HADS | 1901 | DSCT
RR Lyrae |  |  |
with an asymmetric light-curve | RRAB | 23 891 | RRL ab
with a symmetric light-curve | RRC | 6226 | RRL c
Double mode RR Lyrae | RRD | 296 | RRL d
Eclipsing binary |  |  |
W Ursae Majoris type | EW | 38 284 | EB EC
Detached Algol-type | EA | 22 483 | EB ED
Beta Lyrae type | EB | 10 857 | EB ESD
W Virginis type variable | CWA | 230 | T2CEPH
with period ¿ 8 days |  |  |
Mira variable | M | 7498 | LPV
Red irregular variable | L | 53 598 |
Semi-regular variable | LSP | 160 |
Yellow semi-regular variable | SRD | 135 |
Young stellar object | YSO | 189 |
Suspected rotational variable | ROT | 11 395 |
Suspected semi-regular variable | SR | 108 943 |
Uncertain type of variable | VAR | 250 |
Total |  | 288 698 |

1 Corresponding classes in the training set.

Table 8: Transfer learning application using ASAS-SN dataset

Model |  Avg. of $M_{c}$ |  SEM1
---|---|---
Scratch Model |  |
| 0.8744 |  7.7$\times 10^{-4}$
Transfer Model |  |
(every-layer model) |  |
| 0.8711 |  1.1$\times 10^{-3}$
Transfer Model |  |
(last-layer model) |  |
| 0.8380 |  2.6$\times 10^{-4}$

1 $n$ in Equation (11) is 30.

Figure 10: Examples of ASAS-SN validation-set $M_{c}$ of the scratch models
(blue line) and the every-layer models (orange line). As the figure shows,
transferring the UT model reaches the highest $M_{c}$ faster than training
from scratch does.

In this section, we apply transfer learning to the ASAS-SN database of
variable stars (Shappee et al., 2014; Jayasinghe et al., 2019). We obtained a
catalog of the variable stars and their corresponding light-curves from the
ASAS-SN website (https://asas-sn.osu.edu/variables). We selected only the
light-curves with class probabilities higher than 95%, and whose
classification results are not uncertain. The average number of data points in
the light-curves is about 200, and the duration is about four years. We
extracted 16 time-variability features from each light-curve, excluding light-
curves having fewer than 100 data points. In Table 7 we show the number of
selected light-curves for each variable class and their corresponding
classes444We manually assigned the corresponding classes. in the training set
(if any). The larger number of samples, 288 698, is sufficient to train DNNs
from scratch. Yet even in such cases transfer learning could be useful because
it could achieve the highest $M_{c}$ faster than training from scratch does.

We train scratch, every-layer, and last-layer models using the entire set of
$D_{0.8}$ according to the training process mentioned in Section 4.1. Because
base models are now the same as the scratch models, we did not train them. The
average of $M_{c}$ and SEM is shown in Table 8. The average $M_{c}$ of the
scratch model and the every-layer model are similar as expected, whereas that
of the last-layer model is smaller. Note that we did not train models using a
subset of the ASAS-SN dataset because its result would be similar to what we
explained in Section 4.2 and 4.3. Fig. 11 is a confusion matrix of the every-
layer model. The classification quality is relatively good, but a lot of the
SRD, VAR, YSO, LSP, and L are misclassified as SR. Most of these variables are
either semi-regular or irregular variables, and thus their variability
characteristics are expected to be similar to one another (i.e. no clear
periodicities in their light-curves). Furthermore, the number of SRD, VAR,
YSO, and LSP is relatively small, a few hundreds per class, whereas the number
of SR is 108 943, which could cause the bias toward the majority (SR).

Fig. 10 shows four examples of validation-set $M_{c}$ at the first 40 training
epochs from the $n$=30 cycles (see steps 1 to 5 in Section 3.3.2). From the
figure, we see that the every-layer models reach the highest $M_{c}$ faster
than the scratch models do. We confirmed that the remaining 26 cases out of
the $n$=30 cycles show similar behavior. However the difference is not
significant, which implies that given enough training samples and computing
resources, transfer learning is not really necessary because training from
scratch gives as good classification performance as transfer learning does.

Figure 11: The confusion matrix of the ASAS SN transferred model. Labels are
as in Table 7.

##  5 Performance of a Transferred Model as a Function of Light-Curve Length
and Sampling

Figure 12: Classification quality, $M_{c}$, of the resampled ASAS light-curves
as a function of duration, $d$ (horizontal axis), and the number of data
points $n$ (different lines) in the light-curve. Left: $M_{c}$ of the
transferred model. Right: $M_{c}$ of the U model.

In this section we examine the classification performance of the transferred
model as a function of the observation durations, $d$, and the number of data
points in a light-curve, $n$. For this experiment, we used the every-layer
model transferred using the 20% subset of ASAS $D_{0.8}$ (see Section 4.2).
$M_{c}$ of the model is 0.94.

We constructed a set of light-curves by resampling the ASAS light-curves shown
in Table 4 using $d$ = 30, 60, 90, 180, 365, 730, and 1470 days, and $n$ = 20,
40, 80, 100, 150, 200, and 300. In order to resample a given light-curve, we
first extract measurements observed between the starting epoch and $d$ days
after the starting epoch. We then randomly select $n$ unique data points from
the extracted measurements to make a resampled light-curve. The left panel of
Fig. 12 shows the classification quality of the transferred model applied to
these resampled light-curves. As the panel shows, $M_{c}$ quickly reaches its
maximum value once the number of data points reaches 300. Even with lower $n$
= 100 or 150, or lower $d$ = 365 or 730, $M_{c}$ is fairly high. When $n$ =
20, we see that $M_{c}$ decreases as $d$ increases. This is because $n$ = 20
is too small number of data points to construct a well-sampled light-curve.

From this experiment, we see that if the number of data points, $n$, is larger
than or equal to 100 or 150, $M_{c}$ is not significantly lower than what we
can achieve using more data points. For comparison, we show $M_{c}$ of the U
model for the same dataset in the right panel of Fig. 12. $M_{c}$ of the U
model is lower than the transferred model, as expected, but the overall
patterns of $M_{c}$ are similar with those of the transferred model. For the
Hipparcos and ASAS-SN datasets, we did not resample their light-curves to
carry out the same experiment due to a lack of either $n$ or $d$.
Nevertheless, if enough $n$ and $d$ is given, we expect to see similar
variations in $M_{c}$ for other datasets considered, because those models are
also derived from the U model using transfer learning.

##  6 Summary

We have introduced deep transfer learning for classifying light-curves of
variable sources in order to diminish difficulties in collecting sufficient
training samples with labels, designing an individual neural network for every
survey, and applying inferred knowledge from one dataset to another. Our
approach starts with training a deep neural network using 16 variability
features that are relatively survey-independent. These features are extracted
from a training set composed of the light-curves of OGLE and EROS-2 variable
sources. We then apply transfer learning to optimize the weights in the
trained network so that we can extend the original model to new datasets, here
ASAS, Hipparcos, and ASAS-SN. From these applications we see that transfer
learning successfully utilizes knowledge inferred from the source dataset
(i.e. OGLE and EROS-2) to the target dataset even with a small number of the
target samples. In particular, we see that:

  * •

Transferring only the last layer of the network shows better classification
quality than transferring every layer when there are few samples. For
instance, the last-layer models’ classification performance is 3%-7% higher
than the scratch models when a small number of ASAS samples (i.e. 3%-15% of
the entire ASAS dataset) are used (see Fig. 7).

  * •

As shown in Fig. 7, when there exists a sufficient number of samples (i.e.
20%-100% of the entire ASAS dataset), the every-layer models give better
classification performance 1%-2% higher than the last-layer models.

  * •

Transfer learning successfully works even when label space are different
between the source and the target. For instance, the Hipparcos dataset
contains many types of variable sources different from the training samples
(i.e. OGLE and EROS-2) as shown in Table 5. Transfer learning successfully
works as the every-layer and the last-layer models show $\sim$4% and $\sim$9%
better classification performance, respectively, than the scratch models (see
Table 6).

From these results of using transfer learning, we see that transfer learning
is useful for classification of variable sources from time-domain surveys that
have a few training samples. This is a significant benefit since it is not
always possible to build a robust training set with a sufficient number of
samples. For instance, many ongoing and upcoming time-domain surveys such as
Gaia (Gaia Collaboration et al., 2016), ZTF (Bellm et al., 2019), SkyMapper
(Keller et al., 2007), and Pan-STARRS (Chambers et al., 2016) will produce a
large number of light-curves of astronomical sources. Assembling a
sufficiently large set of labelled light-curves for training for each survey,
however, is a difficult and time-consuming task, especially in the early stage
of the survey. Given that transfer learning works even when using a small set
of data, transfer learning would prove useful for classifying light-curves and
thus building an initial training set for such surveys. Nevertheless, if
enough training samples are readily available, transfer learning does not give
much benefit but at least it does not do any worse as can be seen from the
results of every-layer models (e.g. Fig. 7 and Table 8).

We have not used any survey-specific features such as colours. It would
nonetheless be interesting to test whether including such features improves
classification performance. For instance, one could replace the lowest
important feature $\phi_{21}$ (see Fig. 6) with a colour. One could then train
a DNN model from scratch with this and transfer the trained model to another
survey that uses different colours.

We provide a python software package containing a pre-trained network (the U
model) and functionality to transfer the U model to any time-domain surveys.
The package also can train a DNN model from scratch and deal with imbalanced
datasets. For details about the package, see Appendix.

## Acknowledgement

This work was supported by a National Research Council of Science & Technology
(NST) grant by the Korean government (MSIP) [No. CRC-15-05-ETRI].

## References

  * Ackermann et al. (2018) Ackermann, S., Schawinski, K., Zhang, C., Weigel, A. K., & Turp, M. D. 2018, MNRAS, 479, 415
  * Agatonovic-Kustrin & Beresford (2000) Agatonovic-Kustrin, S. & Beresford, R. 2000, Journal of pharmaceutical and biomedical analysis, 22, 717
  * Amacker et al. (2020) Amacker, J., Balunas, W., Beresford, L., et al. 2020, arXiv e-prints, arXiv:2004.04240
  * Bailer-Jones et al. (2019) Bailer-Jones, C. A. L., Fouesneau, M., & Andrae, R. 2019, MNRAS, 490, 5615
  * Bellm et al. (2019) Bellm, E. C., Kulkarni, S. R., Graham, M. J., et al. 2019, PASP, 131, 018002
  * Boughorbel S (2017) Boughorbel S, Jarray F, E.-A. M. 2017, PLoS ONE
  * Breiman (2001) Breiman, L. 2001, Machine Learning, 45, 5
  * Byra et al. (2020) Byra, M., Wu, M., Zhang, X., et al. 2020, Magnetic Resonance in Medicine, 83, 1109
  * Chambers et al. (2016) Chambers, K. C., Magnier, E. A., Metcalfe, N., et al. 2016, arXiv e-prints, arXiv:1612.05560
  * Chawla et al. (2002) Chawla, N., Bowyer, K., Hall, L., & Kegelmeyer, W. 2002, J. Artif. Intell. Res. (JAIR), 16, 321
  * Chicco (2017) Chicco, D. 2017, BioData Mining, 10, 35
  * Chicco & Jurman (2020) Chicco, D. & Jurman, G. 2020, BMC Genomics, 21, 6
  * Cowan et al. (1994) Cowan, J., Tesauro, G., & Alspector, J. 1994, Advances in Neural Information Processing Systems 6, Advances in Neural Information Processing Systems (Morgan Kaufmann)
  * Di et al. (2018) Di, S., Zhang, H., Li, C., et al. 2018, IEEE Transactions on Intelligent Transportation Systems, 19, 745
  * D’Isanto & Polsterer (2018) D’Isanto, A. & Polsterer, K. L. 2018, A&A, 609, A111
  * Domínguez Sánchez et al. (2019) Domínguez Sánchez, H., Huertas-Company, M., Bernardi, M., et al. 2019, MNRAS, 484, 93
  * Dubath et al. (2011) Dubath, P., Rimoldini, L., Süveges, M., et al. 2011, MNRAS, 414, 2602
  * Duchi et al. (2011) Duchi, J., Hazan, E., & Singer, Y. 2011, Journal of Machine Learning Research, 12, 2121
  * Duev et al. (2019) Duev, D. A., Mahabal, A., Ye, Q., et al. 2019, MNRAS, 486, 4158
  * Ellaway (1978) Ellaway, P. 1978, Electroencephalography and Clinical Neurophysiology, 45, 302
  * Elorrieta et al. (2016) Elorrieta, F., Eyheramendy, S., Jordán, A., et al. 2016, A&A, 595, A82
  * Fernandes et al. (2010) Fernandes, J. A., Irigoien, X., Goikoetxea, N., et al. 2010, Ecological Modelling, 221, 338
  * Gaia Collaboration et al. (2016) Gaia Collaboration, Prusti, T., de Bruijne, J. H. J., et al. 2016, A&A, 595, A1
  * Goodfellow et al. (2014) Goodfellow, I., Pouget-Abadie, J., Mirza, M., et al. 2014, in Advances in Neural Information Processing Systems 27, ed. Z. Ghahramani, M. Welling, C. Cortes, N. D. Lawrence, & K. Q. Weinberger (Curran Associates, Inc.), 2672–2680
  * Gorodkin (2004) Gorodkin, J. 2004, Comput. Biol. Chem., 28, 367
  * Graczyk et al. (2011) Graczyk, D., Soszyński, I., Poleski, R., et al. 2011, Acta Astronomica, 61, 103
  * Graves et al. (2013) Graves, A., Mohamed, A.-r., & Hinton, G. 2013, arXiv e-prints, arXiv:1303.5778
  * Grison (1994) Grison, P. 1994, A&A, 289, 404
  * He et al. (2008) He, H., Bai, Y., Garcia, E. A., & Li, S. 2008, 2008 IEEE International Joint Conference on Neural Networks (IEEE World Congress on Computational Intelligence), 1322
  * Hinton et al. (2012) Hinton, G., Deng, l., Yu, D., et al. 2012, Signal Processing Magazine, IEEE, 29, 82
  * Hinton et al. (2015) Hinton, G., Vinyals, O., & Dean, J. 2015, arXiv e-prints, arXiv:1503.02531
  * Hon et al. (2017) Hon, M., Stello, D., & Yu, J. 2017, MNRAS, 469, 4578
  * Hosenie et al. (2019) Hosenie, Z., Lyon, R. J., Stappers, B. W., & Mootoovaloo, A. 2019, MNRAS, 488, 4858
  * Hu et al. (2019) Hu, G., Zhang, Y., & Yang, Q. 2019, arXiv e-prints, arXiv:1901.07199
  * Ioffe & Szegedy (2015) Ioffe, S. & Szegedy, C. 2015, arXiv e-prints, arXiv:1502.03167
  * Jayasinghe et al. (2018) Jayasinghe, T., Kochanek, C. S., Stanek, K. Z., et al. 2018, MNRAS, 477, 3145
  * Jayasinghe et al. (2019) Jayasinghe, T., Stanek, K. Z., Kochanek, C. S., et al. 2019, MNRAS, 485, 961
  * Kains et al. (2019) Kains, N., Calamida, A., Rejkuba, M., et al. 2019, MNRAS, 482, 3058
  * Keller et al. (2007) Keller, S. C., Schmidt, B. P., Bessell, M. S., et al. 2007, PASA, 24, 1
  * Kim & Bailer-Jones (2016) Kim, D.-W. & Bailer-Jones, C. A. L. 2016, A&A, 587, A18
  * Kim et al. (2014) Kim, D.-W., Protopapas, P., Bailer-Jones, C. A. L., et al. 2014, A&A, 566, A43
  * Kim et al. (2011) Kim, D.-W., Protopapas, P., Byun, Y.-I., et al. 2011, ApJ, 735, 68
  * Kim et al. (2012) Kim, D.-W., Protopapas, P., Trichas, M., et al. 2012, ApJ, 747, 107
  * Kim & Brunner (2017) Kim, E. J. & Brunner, R. J. 2017, MNRAS, 464, 4463
  * Kingma & Ba (2014) Kingma, D. P. & Ba, J. 2014, arXiv e-prints, arXiv:1412.6980
  * Krizhevsky et al. (2012) Krizhevsky, A., Sutskever, I., & E. Hinton, G. 2012, Neural Information Processing Systems, 25
  * Lanusse et al. (2018) Lanusse, F., Ma, Q., Li, N., et al. 2018, MNRAS, 473, 3895
  * Lecun et al. (2015) Lecun, Y., Bengio, Y., & Hinton, G. 2015, Nature, 521, 436
  * Li et al. (2014) Li, R., Zhao, Z., Chen, X., Palicot, J., & Zhang, H. 2014, IEEE Transactions on Wireless Communications, 13, 2000
  * Lieu et al. (2019) Lieu, M., Conversi, L., Altieri, B., & Carry, B. 2019, MNRAS, 485, 5831
  * Lomb (1976) Lomb, N. R. 1976, Ap&SS, 39, 447
  * Long et al. (2012) Long, J. P., El Karoui, N., Rice, J. A., Richards, J. W., & Bloom, J. S. 2012, PASP, 124, 280
  * Lu et al. (2019) Lu, C., Hu, F., Cao, D., et al. 2019, IEEE Transactions on Intelligent Transportation Systems, 1
  * Lundberg & Lee (2017) Lundberg, S. M. & Lee, S.-I. 2017, in Advances in Neural Information Processing Systems 30, ed. I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, & R. Garnett (Curran Associates, Inc.), 4765–4774
  * Maqsood et al. (2019) Maqsood, M., Nazir, F., Khan, U., et al. 2019, Sensors (Basel, Switzerland), 19, 2645
  * Matthews (1975) Matthews, B. 1975, Biochimica et Biophysica Acta (BBA) - Protein Structure, 405, 442
  * Nair & Hinton (2010) Nair, V. & Hinton, G. E. 2010, in Proceedings of the 27th international conference on machine learning (ICML-10), 807–814
  * Pan & Yang (2010) Pan, S. J. & Yang, Q. 2010, IEEE Trans. on Knowl. and Data Eng., 22, 1345
  * Pan et al. (2012) Pan, W., Xiang, E. W., & Yang, Q. 2012, in Proceedings of the Twenty-Sixth AAAI Conference on Artificial Intelligence, AAAI’12 (AAAI Press), 662–668
  * Pearson et al. (2018) Pearson, K. A., Palafox, L., & Griffith, C. A. 2018, MNRAS, 474, 478
  * Petegrosso et al. (2016) Petegrosso, R., Park, S., Hwang, T. H., & Kuang, R. 2016, Bioinformatics, 33, 529
  * Pham et al. (2019) Pham, C., Pham, V., & Dang, T. 2019, in 2019 IEEE International Conference on Big Data (Big Data), 5844–5853
  * Pojmanski (1997) Pojmanski, G. 1997, Acta Astronomica, 47, 467
  * Poleski et al. (2010) Poleski, R., Soszyñski, I., Udalski, A., et al. 2010, Acta Astronomica, 60, 1
  * Powers (2011) Powers, D. M. W. 2011, Journal of Machine Learning Technologies, 2, 37
  * Scillitoe et al. (2020) Scillitoe, A., Seshadri, P., & Girolami, M. 2020, arXiv e-prints, arXiv:2003.01968
  * Shapiro & Wilk (1965) Shapiro, S. S. & Wilk, M. B. 1965, Biometrika, 52, 591
  * Shapley (1953) Shapley, L. S. 1953, Princeton University Press CY - Princeton, 2
  * Shappee et al. (2014) Shappee, B. J., Prieto, J. L., Grupe, D., et al. 2014, ApJ, 788, 48
  * Shin et al. (2016) Shin, H.-C., Roth, H. R., Gao, M., et al. 2016, arXiv e-prints, arXiv:1602.03409
  * Silver et al. (2016) Silver, D., Huang, A., Maddison, C. J., et al. 2016, Nature, 529, 484
  * Smith (2015) Smith, L. N. 2015, arXiv e-prints, arXiv:1506.01186
  * Soszyñski et al. (2009) Soszyñski, I., Udalski, A., Szymañski, M. K., et al. 2009, Acta Astronomica, 59, 239
  * Soszynski et al. (2008) Soszynski, I., Poleski, R., Udalski, A., et al. 2008, Acta Astronomica, 58, 163
  * Soszyński et al. (2008) Soszyński, I., Udalski, A., Szymański, M. K., et al. 2008, Acta Astronomica, 58, 293
  * Soszyński et al. (2009) Soszyński, I., Udalski, A., Szymański, M. K., et al. 2009, Acta Astronomica, 59, 1
  * Stetson (1996) Stetson, P. B. 1996, PASP, 108, 851
  * Szegedy et al. (2015) Szegedy, C., Liu, W., Jia, Y., et al. 2015, in Computer Vision and Pattern Recognition (CVPR)
  * Tang et al. (2019) Tang, H., Scaife, A. M. M., & Leahy, J. P. 2019, MNRAS, 488, 3358
  * Tisserand et al. (2007) Tisserand, P., Le Guillou, L., Afonso, C., et al. 2007, A&A, 469, 387
  * Udalski et al. (1997) Udalski, A., Kubiak, M., & Szymanski, M. 1997, Acta Astronomica, 47, 319
  * Vafaei Sadr et al. (2019) Vafaei Sadr, A., Vos, E. E., Bassett, B. A., et al. 2019, MNRAS, 484, 2793
  * Valverde-Albacete & Peláez-Moreno (2014) Valverde-Albacete, F. J. & Peláez-Moreno, C. 2014, PLoS One, 9, e84217
  * von Neumann (1941) von Neumann, J. 1941, Ann. Math. Statist., 12, 367
  * Wang et al. (2018) Wang, J., Zheng, H., Huang, Y., & Ding, X. 2018, IEEE Transactions on Intelligent Transportation Systems, 19, 2913
  * Xu et al. (2010) Xu, Q., Xiang, E. W., & Yang, Q. 2010, in 2010 IEEE International Conference on Bioinformatics and Biomedicine (BIBM), 62–67
  * Yeo et al. (2018) Yeo, D., Bae, J., Kim, N., et al. 2018, in 2018 25th IEEE International Conference on Image Processing (ICIP), 674–678
  * Yim et al. (2017) Yim, J., Joo, D., Bae, J., & Kim, J. 2017, in 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 7130–7138
  * Zeiler (2012) Zeiler, M. D. 2012, arXiv e-prints, arXiv:1212.5701
  * Zhao & Grace (2014) Zhao, Q. & Grace, D. 2014, in 1st International Conference on 5G for Ubiquitous Connectivity, 152–157

## Appendix

### How to Predict Variable Classes Using UPSILoN-T

The UPSILoN-T python software package is available from
https://etrioss.kr/ksb/upsilon-t555Permission is required to access the
repository. Please send an email to one of the authors of this paper, either
D.-W. Kim or D. Yeo. The following pseudocode shows how to use the package to
extract variability features from a set of light-curves and then to predict
their variable classes.

⬇

from upsilont import UPSILoNT

from upsilont.features import VariabilityFeatures

# Extract features from a set of light-curves.

feature_list = []

for light_curve in set_of_light_curves:

# Read a light-curve.

date = np.array([:])

mag = np.array([:])

err = np.array([:])

# Extract features.

var_features = VariabilityFeatures(date, mag, err).get_features()

# Append to the list.

feature_list.append(var_features)

# Convert to Pandas DataFrame.

features = pd.DataFrame(feature_list)

# Classify.

ut = UPSILoNT()

label, prob = ut.predict(features, return_prob=True)

label and prob is a list of predicted classes and class probabilities,
respectively.

### How to Transfer UPSILoN-T’s Knowledge to Another Dataset

The UPSILoN-T package can transfer the U model as follows:

⬇

# Get features and labels.

features = …

labels = …

# Transfer UPSILoN-T.

ut = UPSILoNT()

ut.transfer(features, labels, ”/path/to/transferred/model/”)

features is a list of features extracted from a set of light-curves, and
labels is a list of corresponding labels. The package writes the transferred
model and other model-related parameters to a specified location (i.e.
“/path/to/transferred/model/” in the above pseudocode). The transferred model
can predict variable classes as follows:

⬇

# Get features.

features = …

# Predict.

ut = UPSILoNT()

ut.load(”/path/to/transferred/model/”)

label, prob = ut.predict(features, return_prob=True)

### How to Deal with an Imbalanced Dataset

As shown in Table 1, training set is often imbalanced. For instance, the
number of OSARG RGBs is about 179 times more than the number of QSOs (i.e. 29
516 / 165 $\approx$ 179). Due to such class imbalance, training of a network
could be biased towards the more dominant classes, even though this dominance
is just a consequence of the relative frequency of available training samples
that we do not want to learn.

There are several approaches to deal with imbalanced datasets such as
weighting a loss function according to the sample frequencies, synthesizing
artificial samples (e.g. SMOTE introduced at Chawla et al. 2002, or ADASYN
introduced at He et al. 2008), over- or under-sampling methods that repeat or
remove samples in order to balance the sample frequency per class, or Bayesian
methods (Bailer-Jones et al. 2019). Bailer-Jones et al. (2019) introduces a
method to accommodate class imbalance in probabilistic multi-class
classifiers. The UPSILoN-T library provides two of these approaches when
training or transferring a model:

  * •

Weighting a loss function

In Equation 3, we weight a loss function using $\alpha$, which is proportional
to the number of samples per class. In brief, we give higher weight to the
minority class, and vice versa. $\alpha$ for each class is defined as follows:

$\alpha_{i}=\frac{f_{i}}{\sum_{i=1}^{c}f_{i}}\,\,,\,\text{where}\,\,f_{i}=\frac{1}{N_{i}}\,\,,$
(12)

where $N_{i}$ is the number of samples per class and $c$ is the number of
variable classes.

  * •

Over-sampling technique

Conceptually, an over- or under-sampling method builds an artificial training
set by balancing the number of each class in the original training set. Among
them, the over-sampling method resamples the original training set by randomly
duplicating samples from the minority class. For instance, if there are 20
samples of class A and 40 samples of class B, over-sampling randomly selects
twice as many samples from class A as class B. The disadvantage of this
approach to addressing imbalance is that the training time is increased.
Another disadvantage is that a trained model could overfit the minority class
since it just duplicates samples.

The following pseudocode shows how to use these two methods.

⬇

ut = UPSILoNT()

# Over-sampling.

ut.train(features, labels, balanced_sampling=True)

# Weighting a loss function.

ut.train(features, labels, weight_class=True)

# Do both.

ut.train(features, labels, balanced_sampling=True, weight_class=True)