-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.py
102 lines (69 loc) · 3.04 KB
/
Main.py
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
'''
Created on 6 de fev de 2017
By Gustavo Oliveira
Universidade Federal de Pernambuco, Recife, Brasil
E-mail: ghfmo@cin.ufpe.br
ALGORITHMS USED IN THE PAPER PUBLISHED BELOW:
OLIVEIRA, Gustavo HFM et al. Time series forecasting in the presence of concept drift: A pso-based approach.
In: 2017 IEEE 29th International Conference on Tools with Artificial Intelligence (ICTAI).
IEEE, 2017. p. 239-246.
https://ieeexplore.ieee.org/document/8371949
IDPSO-ELM-S is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>
'''
# importing the algorithms
from algoritmos_online.ELM_DDM import ELM_DDM
from algoritmos_online.ELM_ECDD import ELM_ECDD
from algoritmos_online.ELM_FEDD import ELM_FEDD
from algoritmos_online.IDPSO_ELM_B import IDPSO_ELM_B
from algoritmos_online.IDPSO_ELM_S import IDPSO_ELM_S
# importing libs to help in the methods execution
from ferramentas.Importar_dataset import Datasets
from ferramentas.Particionar_series import Particionar_series
#1. importing the datasets
dtst = Datasets()
#1.1 REAL DATASETS ###################################################
# 1 = Dow 30
# 2 = Nasdaq
# 3 = S&P 500
dataset = dtst.Leitura_dados(dtst.bases_reais(1), csv=True)
dataset = Particionar_series().Normalizar(dataset)
#1.1 #################################################################
#1.2 SYNTHETIC DATASETS ###############################################
# dtst.bases_lineares(1)
# dtst.bases_nlineares(1)
# dtst.bases_sazonais()
# dtst.bases_hibridas()
#dataset = dtst.Leitura_dados(dtst.bases_hibridas(1), csv=True)
#dataset = Particionar_series().Normalizar(dataset)
#1.2 ##################################################################
#2. IMPORTING AND RUNNING ALGORITHMS ################################
# IDPSO-ELM-S
idpso_elm_s = IDPSO_ELM_S(dataset)
idpso_elm_s.Executar(grafico=True)
# IDPSO-ELM-B
idpso_elm_b = IDPSO_ELM_B(dataset)
idpso_elm_b.Executar(grafico=True)
# ELM-FEDD
elm_fedd = ELM_FEDD(dataset)
elm_fedd.Executar(grafico=True)
# ELM-ECDD
elm_ecdd = ELM_ECDD(dataset)
elm_ecdd.Executar(grafico=True)
# ELM-DDM
elm_ddm = ELM_DDM(dataset)
elm_ddm.Executar(grafico=True)
#2. ###################################################################
####### 3. STORING THE PREDICTIONS ################################################################
import pandas as pd
df = pd.DataFrame(data={'predictions': idpso_elm_s.predictions, 'target':idpso_elm_s.target})
df.to_csv("images/"+idpso_elm_s.tecnica+".csv")
####### 3. STORING THE PREDICTIONS ################################################################