# DATA MINING And NEURAL NETWORKS

MA4022/MA7022 DATA MINING and NEURAL NETWORKS

Computational Task 3, 2021

Due date 07.05.2021, 23:59

For this task you need to download 4 time series from the Yahoo!Finance website:

Any student should have their own unique set of time series!

Please collect available data for three years 2018-2020

Please pay attention that for your analysis the time moments should be sorted from oldest to newest.

Use the daily closing price.

1. Data evaluation and elementary preprocessing. Analyse completeness of data. Are there missed

data (besides weekends)? How many missed data points are in your time series? Are the dates of

missed values the same for all your time series? What may be the reasons for missing? How can you

handle the missed values in your data (explain at least three approaches)? Use the simple rule: fill in a

missed value by the closest in time past existing value. Plot the results. Normalise to the z-score (zero

mean and unit standard deviation). Plot the results. (15 marks)

3. Segmentation. Prepare the bottom-up piecewise linear segmentation for the transformed and

normalised log-return time series. Use the following mean square errors tolerance levels: 1%, 5%, 10%

(the thresholds of the mean square errors). Plot the results. Are the segments similar for different time

series you analysed? (25 marks)

4. Prediction. Chose one of the transformed and normalised time series as a target π(π‘) and other 3 as

supporting data π1

(π‘), π2

(π‘), π3

(π‘), where π‘ = 1, β¦ , π. Provide scatter diagrams of (g(t),g(t+1)).

Evaluate the error of the βnext-day forecastβ, πΜ(π‘ + 1) = π(π‘).

Use data for 2018 as the training set and find the predictor of π(π‘ + 1) (the next day value) as a

linear function Ξ¨ of π(π‘), π1

(π‘), π2

(π‘), π3

(π‘):

πΜ(π‘ + 1) = Ξ¨(π(π‘), π1

(π‘), π2

(π‘), π3

(π‘)) (1)

(linear regression). Evaluate the training set error. Use data for 2019 as a test set and evaluate the test

set error for this set. Also, use data for 2020 as a test set and evaluate the test set error for this set.

Compare these errors. Compare these errors to the errors of the βnext-day forecastβ. Comment.

Provide plots of π(π‘), πΜ(π‘), and the residual. Present the (π(π‘), πΜ(π‘)) scatter diagram. (30 marks)

5. Adaptive predictors. For each given value of the βframe widthβ, Ξ=5, 10, 30, create and test the

following adaptive predictor. For every T> Ξ create the training set with Ξ input vectors

(π(π‘), π1

(π‘), π2

(π‘), π3

(π‘)) (π‘ = π β Ξ, β¦ , π-1) and the corresponding outputs π(π‘ + 1).

In more detail, the input vectors ππ and the output values π¦π

for a given T are

π1 = (π(π β Ξ), π1

(π β Ξ), π2

(π β Ξ), π3

(π β Ξ)), π¦1 = π(π β Ξ + 1)

β¦β¦β¦..

ππ = (π(π β Ξ + π β 1), π1

(π β Ξ + π β 1), π2

(π β Ξ + π β 1), π3

(π β Ξ + π β 1)),

π¦π = π(π β Ξ + π)

Where i=1,2,β¦, Ξ.

Find the linear regression (1) for each T> Ξ. Test this linear regression for the next time value, t=T+1.

In more detail, for each T there is one test example with the input vector ππ‘ππ π‘ and output value π¦π‘ππ π‘:

ππ‘ππ π‘ = (π(π), π1

(π), π2

(π), π3

(π)), π¦π‘ππ π‘ = π(π + 1)Please pay attention that this example does not belong to a training set for this value of T.

Find the residuals at these test time moments. Plot these residuals and the values π(π‘), πΜ(π‘). Present

the (π(π‘), πΜ(π‘)) scatter diagram (t=T+1). Calculate the mean square error. Compare to the previous

task. Comment. (30 marks