-
Notifications
You must be signed in to change notification settings - Fork 4
/
init.m
46 lines (37 loc) · 1.78 KB
/
init.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
disp("Init")
stock_name = "AAPL.mat";
load(stock_name); % Date Open Close High Low
% see train section: if 0 a specified .mat file is loaded
% if 1 a new training is done
TRAIN = 0;
if (~TRAIN)
filename = ("train/hmmtrain-2023-07-17-02-52-06.mat");
load(filename);
end
% see sequences train section: if 0 a new sequence is grouped every #days = latency
% if 1 a new sequence is grouped every day
shiftWindowByOne = 1;
% select training period, date format YYYY-MM-DD
startTrainDate = '2017-01-03';
endTrainDate = '2019-01-03';
startTrainDateIdx = indexOfDate(Date, startTrainDate);
endTrainDateIdx = indexOfDate(Date, endTrainDate);
trainIndexes = startTrainDateIdx:endTrainDateIdx;
% select prediction period, date format YYYY-MM-DD
startPredictionDate = '2023-01-03';
endPredictionDate = Date(end);
%endPredictionDate = '2023-06-30';
startPredictionDateIdx = indexOfDate(Date, startPredictionDate);
endPredictionDateIdx = indexOfDate(Date, endPredictionDate);
predictionLength = endPredictionDateIdx - startPredictionDateIdx + 1;
predictionIndexes = startPredictionDateIdx:endPredictionDateIdx;
% dynamic edges for discretization: - if 1, edges are changed accordingly to
% training set
% - if 0, default values for edges are
% used
useDynamicEdges = 0;
discretizationPoints = [50 10 10]; % uniform intervals to discretize observed parameters
totalDiscretizationPoints = discretizationPoints(1)*discretizationPoints(2)*discretizationPoints(3);
underlyingStates = 4; % number of hidden states
mixturesNumber = 4; % number of mixture components for each state
latency = 10; % days aka vectors in sequence