$30
1 Recurrent Neural Network for Classification
In this problem, you are given a csv file that contains the number of confirmed people with COVID-19 in a period of time in different countries. You are required to implement a recurrent neural network to classify if the number of confirmed people will increase in the next day. The following figure shows some samples in the dataset. The dataset can be downloaded here.
i Please compute the correlation coefficient between two countries. The correlation coeffi-
cient function is expressed by
Cov(X,Y ) Var(X) Var(Y )
Correlation(X,Y ) = . p p
You should plot these coefficients in all the pairs of two countries like the following figure.
1
ii To process on you data,
− first, collecting the pairs of the country with high correlation with the other country. Here, you therefore collect a lot of countries in a set denoted as C.
− second, setting an interval (sequence length) L.
− third, using the sequence x of the country in C to generate the subsequence with the length equal to L in x, And based on the next day of the last day in the subsequence, you can give it a label to specify if it is increasing or not.
− fourth, repeating third step until all the countries in C are used to generate the data.
To help you understand the above process, the following is the simple example graph to show how to generate the data.
iii Build a recurrent neural network to predict the label based on the given sequence. And show the accuracy of training and test.
iv Please implement different recurrent neural network like LSTM and GRU and change the value of interval L to analyze its effect on the result
v Compute the probability for each country and plot on a world map by using ”pygal” package in python as below example.
vi Do some discussion based on your result.
2 Variational Autoencoder for Image Generation
In this exercise, you will construct a Variational Autoencoder (VAE) for image reconstruction by the animation faces dataset here.
Figure 1: Structure of VAE
VAE paper can be downloaded here. You should preprocess the images such as resizing or cropping by yourself before implementation.
i Describe in details how to preprocess images (such as resizing or cropping) and design the network architecture.
ii Plot the learning curve of the negative evidence lower bound (ELBO) of log likelihood of
training images.
Figure 2: Learning curve of negative ELBO using VAE
iii Show some examples reconstructed by your model.
Figure 3: Real samples in dataset Figure 4: Reconstruction samples using VAE
iv Sample the prior p(z) and use the latent codes z to synthesize some examples when your model is well-trained.
Figure 5: Synthesized samples drawn from VAE
v Show the synthesized images based on the interpolation of two latent codes z between two real samples.
Figure 6: Generated images based on interpolation of latent codes from two real images.
Hint: you need to interpolate two latent variables encoded form two real images. Several new latent variables in two images should be drawn. Finally, decode those new latent variables into images.
vi Multiply the Kullback-Leibler (KL) term in ELBO by 100 in your loss and repeat ii ∼ v. vii Multiply the KL term by 0 in ELBO and repeat ii ∼ v. viii Do some discussion on the effect of KL term based on your result.