• Tidak ada hasil yang ditemukan

BAB V KESIMPULAN DAN SARAN

5.2 Saran

Berdasarkan analisis, pembahasan dan kesimpulan yang telah dilakukan maka saran pada penilitian selanjutnya sebaiknya menambahkan metode lain yang berbasis machine learning. Meskipun pada penelitian ini menghasilkan nilai MAPE pada metode EEMD-LSTM lebih baik dibandingkan menggunakan metode LSTM tanpa EEMD.

44

(Halaman ini sengaja dikosongkan)

45

DAFTAR PUSTAKA

Ariani, M. (2015) Penerapan Jaringan Syaraf Tiruan Untuk Deteksi Penyakit Jantung Koroner (PJK) Menggunakan Metode Learning Vector Quantization 2 (LVQ2). Universitas Islam Negeri Sultan Syarif Kasim Riau

Huang, N.E., Shen, Z., dan Long, S.R.1998. The Empirical Mode Decomposition and the Hilbert Spectrum for Nonlinear and Nonstationary Time Series Analysis. Process of the Royal Society of London, A 454, pp. 903–995.

J. Peng, Z. Li, dan B. M. Drakeford, “Dynamic characteristics of crude oil price fluctuation-from the perspective of crude oil price influence mechanism,”

Energies, vol. 13, no. 17, 2020.

L. Charfeddine dan K. Barkat, “Short- and long-run asymmetric effect of oil prices and oil and gas revenues on the real GDP and economic diversification in oil- dependent economy,” Energy Econ., vol. 86, p.

104680, 2020.

M. I. Haque, “Oil price shocks and energy consumption in GCC countries: a system- GMM approach,” Environ. Dev. Sustain., vol. 23, no. 6, pp.

9336–9351, 2021.

Pandji, B. Y., Rohmawati, A. A., dan Indwiarti. (2019). Perbandingan prediksi harga saham dengan model arima dan. Indonesian Journal of Computing, 4(2), 189–198.

Qiao-feng Tan, Xiao-hui Li, Xu Wang, Hao Wang, Xin Wen, Yi Ji, dan Ai-qin.

(2018). An adaptive middle and long-term runoff forecast model using EEMD-ANN hybrid approach.

Qiu J, Wang B, dan Zhou C. (2020). Forecasting Stock Prices with Long-Short Term Memory Neural Network Based On Attention Mechanism. PLOS ONE 15(1): e0227222.

S. A. Basher, A. A. Haug, dan P. Sadorsky, “The impact of oil-market shocks on stock returns in major oil-exporting countries,” J. Int. Money Financ., vol.

86, pp. 264–280, 2018.

S. Sa’adah dan M. S. Wibowo, “Prediction of Gross Domestic Product (GDP) in Indonesia Using Deep Learning Algorithm,” 2020 3rd Int. Semin. Res.

Inf. Technol. Intell. Syst. ISRITI 2020, no. 1, pp. 32–36, 2020.

Sunariyah. 2006. Pengantar Pengetahuan Pasar Modal, Edisi 5. Yogyakarta: UPP AMP YKPN.

Supriharyono. 2000. Konservasi Ekosistem Sumber Daya Hayati di Wilayah

46

Pesisir dan Laut Tropis. Yogyakarta: Pustaka Pelajar.

Trnka, P. dan Hofreiter, M. 2011. The Empirical Mode Decomposition in Real- Time. 18th International Conference on Process Control, Tatranska Lomnica, Slovakia, June 14-17 2011, pp. 284 – 289.

T. Singhal, “A Review of Coronavirus Disease-2019 (COVID-19),” Indian J.

Pediatr., vol. 87, no. 4, pp. 281–286, 2020.

Warsono (2010). Prinsip-prinsip dan Praktik Keuangan Pribadi. Volume 13 no 2.

Wei, L., Wei, D.L. dan Jianwei, G., Forecasting Oil Production using ensemble empirical mode decomposition based Long Short-Term Memory neural network. Journal of Petroleum Science and Engineering. 189 (2020) 107013

Wu, Z.H., dan Huang, N.E. Ensemble empirical mode decomposition: A noise assisted data analysis method. Adv. Adapt. Data Anal. 2009, 1, 1–41.

[CrossRef]

Y. Chen, R. Inglesi-Lotz, dan T. Chang, “Revisiting the asymmetric causal link between energy consumption and output in China: Focus on coal and oil consumption,” Energy Sources, Part B Econ. Plan. Policy, vol. 12, no.

11, pp. 992– 1000, 2017.

Yarman, R. (2019), “Penerapan Elman Reqqurent Neural Networ (ERRN) untuk memprediksi jumlah Produksi Barang (Studi kasus : Ekaputra Foods)”.

Jurnal Ekonomi, Vol. 2, No. 1, hal 41-49.

Yulianti, N., dan Silvy, M. (2013). Sikap Pengelola Keuangan Dan Perilaku Perencanaan Investasi Keluarga Di Surabaya. Journal of Business and Banking, 3(1), 57–68

47

BIODATA PENULIS

Nuchaila Ainiyah, atau yang biasa dipanggil Nucha.

Pendidikan formal yang sudah ditempuh oleh penulis adalah MI Alma’arif 09 Singosari, MTs. Darul Karomah Singosari, SMA Al-Rifa’ie Malang dan menempuh pendidikan S1 di Jurusan Matematika Fakultas Sains dan Teknologi Universitas Islam Negeri Maulana Malik Ibrahim (UIN) Malang. Penulis diterima sebagai mahasiswa Departemen Statistika Institut Teknologi Sepuluh Nopember (ITS) pada tahun 2021. Selama perkuliahan, penulis pernah menjadi asisten dosen mata kuliah Ekonometrika di Departemen Statistika Bisnis Fakultas Vokasi ITS pada semester genap tahun akademik 2022/2023. Penulis juga mengikuti beberapa pelatihan Data Analyst dan Data Scientist yang diadakan Google. Demikian untuk biodata penulis, jika terdapat kritik, saran dan informasi lebih lanjut berkaitan dengan Tesis ini dapat menghubungi melalui email: [email protected].

48

(Halaman ini sengaja dikosongkan)

49

LAMPIRAN

Lampiran 1. Data Penelitian Date

ICP Date ICP

01/01/2012 115,91 01/10/2017 54,02

01/02/2012 122,17 01/11/2017 59,34

01/03/2012 128,14 01/12/2017 60,9

01/04/2012 124,63 01/01/2018 65,59

01/05/2012 113,76 01/02/2018 61,61

01/06/2012 99,08 01/03/2018 61,87

01/07/2012 102,88 01/04/2018 67,43

01/08/2012 111,72 01/05/2018 72,46

01/09/2012 111,02 01/06/2018 70,36

01/10/2012 109,85 01/07/2018 70,68

01/11/2012 106,68 01/08/2018 69,36

01/12/2012 106,9 01/09/2018 74,88

01/01/2013 111,07 01/10/2018 77,56

01/02/2013 114,86 01/11/2018 62,9

01/03/2013 107,42 01/12/2018 54,81

01/04/2013 100,19 01/01/2019 56,55

01/05/2013 99,01 01/02/2019 61,31

01/06/2013 99,97 01/03/2019 63,6

01/07/2013 103,12 01/04/2019 68,31

01/08/2013 106,5 01/05/2019 68,07

01/09/2013 109,69 01/06/2019 61

01/10/2013 106,39 01/07/2019 61,32

01/11/2013 104,69 01/08/2019 57,27

01/12/2013 107,2 01/09/2019 60,84

01/01/2014 105,8 01/10/2019 59,82

01/02/2014 106,08 01/11/2019 63,26

01/03/2014 106,9 01/12/2019 67,18

01/04/2014 106,44 01/01/2020 65,38

01/05/2014 106,2 01/02/2020 56,61

01/06/2014 108,95 01/03/2020 34,23

01/07/2014 104,63 01/04/2020 20,66

01/08/2014 99,51 01/05/2020 25,67

01/09/2014 94,97 01/06/2020 36,68

01/10/2014 83,72 01/07/2020 40,64

01/11/2014 75,39 01/08/2020 41,63

50

01/12/2014 59,56 01/09/2020 37,43

01/01/2015 45,3 01/10/2020 38,07

01/02/2015 54,3 01/11/2020 40,67

01/03/2015 53,66 01/12/2020 47,78

01/04/2015 57,58 01/01/2021 53,17

01/05/2015 61,86 01/02/2021 60,36

01/06/2015 59,4 01/03/2021 63,5

01/07/2015 51,81 01/04/2021 61,96

01/08/2015 42,81 01/05/2021 65,49

01/09/2015 43,13 01/06/2021 70,23

01/10/2015 43,68 01/07/2021 71,17

01/11/2015 41,44 01/08/2021 67,8

01/12/2015 35,47 01/09/2021 72,2

01/01/2016 27,49 01/10/2021 81,8

01/02/2016 28,92 01/11/2021 80,13

01/03/2016 34,19 01/12/2021 73,36

01/04/2016 37,2 01/01/2022 85,89

01/05/2016 44,68 01/02/2022 95,72

01/06/2016 44,5 01/03/2022 113,05

01/07/2016 40,7 01/04/2022 103,57

01/08/2016 41,11 01/05/2022 110,7

01/09/2016 42,17 01/06/2022 119,5

01/10/2016 46,64 01/07/2022 109,09

01/11/2016 43,25 01/08/2022 98,3

01/12/2016 51,09 01/09/2022 91,12

01/01/2017 51,88 01/10/2022 93,45

01/02/2017 52,5 01/11/2022 90,84

01/03/2017 48,71 01/12/2022 78,74

01/04/2017 49,56 01/01/2023 79,71

01/05/2017 47,09 01/02/2023 80,76

01/06/2017 43,66 01/03/2023 76,02

01/07/2017 45,48 01/04/2023 81,63

01/08/2017 48,43 01/05/2023 73,31

01/09/2017 52,47 01/06/2023 73,27

51

Lampiran 2. Augmented Dickey Fuller (ADF) Test

ADF test Indonesia Crude Oil Price ADF Statistic: -2.466691

p-value: 0.123790 Critical Values:

1%: -3.479 5%: -2.883 10%: -2.578

Kesimpulan : data tidak stasioner None

52

Lampiran 3. Hasil Output Parameter Bobot EEMD-LSTM 1. IMF 1

Weights of LSTM Layer 1:

Forget Gate Weights: [[-0.14925574 -0.16888066 0.32507038 -0.20797254 - 0.18323377 -0.321033

-0.17670944 0.06344822 -0.18038325 -0.20343788 -0.12815626 0.02959604

-0.13626939 -0.15484098 0.31415498 0.1299171 -0.22376198 0.45116252 -0.30624053 -0.22516489 0.49958292 -0.15074445 -0.19758071

0.40758443

-0.2260286 -0.01415802 0.37814245 -0.28824574 -0.2029298 -0.10061546 -0.06837888 -0.27024785]]

Input Gate Weights: [[-0.2960011 -0.30221263 -0.355147 -0.02252894 - 0.09153562 -0.05312384

-0.24927482 0.0533327 -0.09642895 -0.22743118 -0.03210109 0.36093542 -0.14996459 -0.18588704 0.02956108 -0.14986491 -0.22936715 -

0.14933662

0.08067421 0.08643992 0.02231724 0.13130137 -0.19485202 0.0340159 -0.09980098 -0.19692023 -0.15096024 -0.05405665 -0.16381739

0.08751858

0.10331367 0.06851505]]

Output Gate Weights: [[ 0.50784755 0.07212219 -0.04139071 0.11373772 - 0.12152386 0.07398179

0.3536215 0.03758164 0.12493724 0.22048876 -0.1431725 -0.10296219 0.4605168 -0.11682472 -0.06709594 -0.07230734 -0.15841454 -

0.15493068

-0.0107466 -0.20291632 -0.2738064 -0.18709925 0.00838187 -0.23764394 0.08743668 0.15576726 -0.24132489 -0.05837381 0.06529104

0.10808139

0.05815438 -0.01907609 -0.01814367 -0.09793321 0.01672859 - 0.07796244

0.09409981 -0.09911443 -0.17126068 0.13966458 0.11265109 0.01105037

0.01831903 -0.07770278 -0.04607542 0.06719302 -0.00887989 0.15093166

0.04431641 -0.00652928 0.26328653 0.18222706 -0.07311258 - 0.21090555

0.02510732 0.11571942 -0.21428151 0.02697149 0.17166886 - 0.18697423

-0.02282901 0.02049164 -0.30238736 -0.03875666 -0.0783807 - 0.10456961

0.05256049 -0.06752746 -0.03972134 -0.09826607 0.03497013 0.10458624

0.07174245 0.024555 -0.05545011 0.15438728 -0.03386301 -0.1497231

53

-0.08021216 -0.20118797 -0.10251484 -0.12748171 0.07741465 0.06244363

0.12588559 -0.01216749 -0.05042884 0.08855417 0.16068988 - 0.00126199

-0.17862965 -0.25884825 -0.21507561 -0.01937504 -0.103511 -0.33521393 -0.2759544 -0.14939412 -0.11575301 -0.06262214 0.5501689 -0.0073615 -0.29087266 0.11983838 -0.3605874 -0.0100135 0.44245353 -0.19481379 -0.16063355 0.3815503 -0.17144872 -0.1509244 0.3826656 -0.06552923 -0.1222209 -0.28032342 -0.19913222 -0.25948468 -0.04913742 -

0.17146197

-0.30973008 -0.19945368 0.1440855 0.05604001 -0.14916496 0.21438026 -0.0825037 0.16410756 0.10426331 0.2929513 -0.09457132 -0.102981 0.09974297 -0.2573821 -0.18117242 -0.20434502]]

54

Hasil Output Parameter Bobot EEMD-LSTM (Lanjutan) 2. IMF 2

Weights of LSTM Layer 1:

Forget Gate Weights: [[ 0.15156652 0.369793 0.00120081 -0.21059535 - 0.17542067 -0.1625289

0.41537088 -0.25814238 0.22169796 0.04312101 -0.3097757 0.08292667

0.1709622 -0.05771128 -0.01693448 0.22455072 0.00513037 0.0897399 -0.13156302 -0.24843587 -0.43764487 -0.11314914 0.358564 -

0.20717937

-0.31489062 0.216153 -0.00186328 0.13144879 -0.23867413 - 0.08687452

0.1086043 -0.33352903]]

Input Gate Weights: [[-0.09980673 -0.5189524 -0.20457786 0.28591767 - 0.02610148 0.2481728

-0.2760077 0.09715354 -0.25520694 -0.3061526 0.23824166 0.02210287

-0.04263701 -0.2938354 0.02067188 0.07265572 -0.06712525 0.20119977

0.2309605 0.40550154 0.11449616 -0.14700544 0.05272822 0.0995012 0.36492118 0.02997822 0.25039813 0.36677292 -0.25597283

0.33329043

0.45184663 0.2819415 ]]

Output Gate Weights: [[ 0.19421433 0.47915083 0.21160173 0.22809471 0.222963 0.23347084

0.03598775 -0.1744531 0.21256226 -1.1376094 -0.30397978 0.21414964

0.12672026 0.4271785 0.26279306 0.16807866 0.2046274 0.14390953 0.23349087 -0.03220049 -0.01761066 0.8405524 0.19963197

0.07479858

-0.35440886 0.19593868 -0.31441352 0.13687727 0.32754058 - 0.33765012

0.01912952 -0.24214719 -0.01152568 0.28869417 0.4341657 0.40249747

-0.43885458 -0.28336233 0.22843572 -0.09032103 -0.02894995 - 0.13984454

-0.8455112 0.1266803 0.21333146 -0.4325576 -0.12385689 - 0.35720843

0.29676777 0.06696551 0.08461665 0.21901494 -0.19986992 0.15575045

-0.38625726 -0.02683465 0.02745621 -0.10378625 0.34761444 0.07667266

-0.09882069 0.26767886 -0.5542806 0.3060643 0.30250287 - 0.08963939

0.15582892 0.2460127 -0.24827397 -0.0108842 0.21708445 0.3978125

55

-0.28927657 0.26880795 0.12196649 0.17504343 -0.09164468 0.06409013

-0.2213552 -0.12989666 0.22032797 0.1072653 -0.13553476 - 0.16286172

-0.08266146 0.18916407 0.7130527 0.70376194 0.29106864 - 0.27608374

0.04065085 -0.07753831 0.38801333 -0.304374 0.28615242 0.46654072

-0.20957552 0.25113162 0.70918083 0.29977778 0.2674214 0.1917683 0.4827884 0.5756523 0.04350528 -0.04740969 -0.03166387 -

0.31105652

0.66404045 -0.34509552 -0.1846259 0.50539416 0.4591011 0.6598405 -0.02717549 -0.18867095 0.59443563 -0.1234036 0.24747626 -

0.08200896

-0.00930999 0.3841242 0.4071663 0.3541898 -0.2535519 0.27890822 -0.33649898 0.08755636 0.36329103 -0.1821113 0.15652554 -

0.39270353

-0.26453236 0.5621325 0.34147877 0.71280575]]

56

Hasil Output Parameter Bobot EEMD-LSTM (Lanjutan) 3. IMF 3

Weights of LSTM Layer 1:

Forget Gate Weights: [[ 0.17518358 0.03796102 0.23526362 -0.05452094 0.25583827 0.2527456

-0.02135916 -0.09406123 0.21431059 -0.00977544 0.14930543 0.3895227 -0.25260425 -0.02650705 -0.05947763 -0.07480776 0.2287644 -0.23647267 -0.1761054 -0.02181003 0.1089875 0.02359105 -0.04011139 0.03351945 0.08676798 -0.08166957 0.11001024 -0.34735236 0.11833438 0.3363575 -0.11515125 0.04108793]]

Input Gate Weights: [[ 1.20473616e-01 2.37534806e-01 2.14105169e-03 - 1.03320412e-01

1.42132312e-01 -8.31284225e-02 -3.51620314e-04 5.78781515e-02 -3.16944649e-03 1.54577091e-01 -2.12839484e-01 -1.90043859e-02 1.64509237e-01 3.85157257e-01 2.66659230e-01 1.04070030e-01 -1.41482815e-01 1.03311568e-01 3.33993584e-01 3.55554521e-01 3.28061730e-01 -1.06362574e-01 2.78734833e-01 4.70831603e-01 1.00553170e-01 -1.34296611e-01 1.39836743e-01 2.09904477e-01 5.24538830e-02 5.31032383e-01 -1.97692052e-01 1.75941940e-02]]

Output Gate Weights: [[ 0.22790667 0.28318048 0.41917402 -0.00933035 0.08266915 0.3700881

0.11069994 0.28737462 0.03894163 0.26381165 0.33791497 0.24449319 0.24560924 -0.0207733 0.06403723 0.17682293 0.05395653 0.26811844 0.16117735 0.3592103 0.27914688 -0.0162139 0.20534274 0.35603753 -0.12292936 0.28589067 0.21992199 0.3029174 0.16171107 -0.13617039 0.26303735 0.3426693 0.21497057 0.3691975 0.20508176 0.30216032 0.2536017 0.34206283 -0.22729391 0.07904 -0.3186258 0.26241335 -0.26668084 0.14550675 0.21055672 -0.2666832 0.24841629 0.59940493 0.2830527 -0.24874826 -0.30650112 0.24428363 -0.20760038 0.29113483 0.28690204 -0.2611639 -0.25312832 -0.25223717 -0.11299522 0.24869306 -0.2514442 -0.24318089 0.3068376 0.02024078 -0.38301182 0.308625 0.22037901 -0.36711308 -0.31673935 0.24124119 0.20806989 -0.28643787 0.2939294 0.18255785 0.30713168 -0.4136109 0.416416 0.3796068 0.0537899 0.01810882 0.27315938 -0.42065004 0.3103632 0.30001858 0.14733705 -0.3390469 0.30624467 0.3531021 0.23216535 -0.13494466 0.2604752 0.608582 0.38497508 -0.04895964 0.23316845 0.26007938 -0.05799261 0.5664977 -0.3094286 0.11258262 0.16510123 0.1782313 0.3295418 -0.15305151 -0.05949982 0.32837808 0.33741012 0.4707848 -0.18283868 0.19862275 0.22036614 0.33435068 0.5329587 0.0047758 0.13310792 0.44277978 -0.02993796 0.22601892 0.377759 0.4164539 0.15156114 -0.0019268 0.13735864 0.11115959 -0.02859829 0.31735468 0.24201132 0.57535815 -0.11811348 0.29406938 0.30632168 0.38943806 0.26069486 0.2991833 -0.18892603 0.13377534]]

57

Hasil Output Parameter Bobot EEMD-LSTM (Lanjutan) 4. IMF 4

Weights of LSTM Layer 1:

Forget Gate Weights: [[ 0.22142124 -0.03416787 0.38025376 0.05696323 0.02047661 0.05344651

0.15295531 0.01270392 -0.03116991 -0.2683918 0.07871281 0.23271501

0.09309808 0.24033079 0.00896137 0.04833417 -0.02817428 0.09393574

-0.11368619 -0.02048161 0.10601892 0.36432725 0.02315442 0.11582698

-0.28098902 0.19033362 0.16794674 -0.0616975 0.09594654 0.10949905

-0.020375 0.1610745 ]]

Input Gate Weights: [[ 0.00372069 0.28472918 -0.21446612 0.14232078 0.30596682 -0.32796282

-0.01273487 0.00413344 -0.13633648 0.00783333 0.40404174 0.13395855

0.03054465 0.29600367 0.1302535 -0.2550205 -0.03896649 0.1714168 0.20513517 0.31374773 0.34041676 -0.01026617 0.004288

0.16222008

0.279666 -0.11934675 0.1080638 -0.18210612 0.03781749 0.08612339 -0.00701899 0.25406858]]

Output Gate Weights: [[ 0.3196678 0.2130932 0.14861238 0.25773293 0.07226032 0.05642447

0.0122438 0.26526797 -0.20262499 0.09969768 -0.3535629 0.2904896 0.22174625 0.29010487 0.08266129 0.25392428 -0.09540266

0.15469119

-0.00358339 0.13573197 -0.19804128 0.07360983 0.32919368 - 0.70410466

0.09846541 0.15343705 0.04388278 0.25678098 0.19429903 0.14661577

0.18952432 0.30585426 0.28766444 -0.19960526 0.09941699 0.16783938

-0.29966685 0.30879626 0.4443185 -0.25219795 0.18127368 - 0.28654614

0.343377 0.03680525 0.0360694 0.10829041 -0.0983255 0.31153446 -0.23357916 0.26282713 0.4603952 -0.3356397 -0.23125787 -0.2960638 -0.00763664 -0.3391281 0.35312727 0.24342301 0.23875047

0.20367649

-0.25075504 0.24084531 0.23648265 -0.23380238 -0.32941493 0.27204525

0.14514682 -0.30929032 0.11751872 0.30681297 0.14354496 0.20543872

0.21106333 -0.189036 -0.21597034 -0.24940483 0.04997059 - 0.29100114

58

0.2642073 0.33142307 -0.23372747 -0.31521544 -0.2590839 0.3072722 0.2701463 0.23931198 0.27224082 0.173503 0.7316363 -0.08442745 -0.04383326 0.09232527 0.2620966 -0.1176712 0.02637991 0.0272732 0.04872656 0.33528376 0.29020563 0.34803006 0.16395555

0.20778383

-0.05483893 0.06490296 -0.07725006 0.06751367 0.3419802 0.5194138 -0.02332647 -0.0305393 -0.08700899 0.16710055 0.15848446

0.27833262

0.18132561 0.02989843 -0.21970066 0.16405444 -0.24996532 0.24037433

-0.3381495 0.29657122 0.29517767 -0.2175949 0.24892795 - 0.04988411

-0.0213924 0.11422388 0.4756114 0.14098577 0.03583938 0.42910483

0.03540843 -0.1185012 0.3941958 0.03244263]]

59

Hasil Output Parameter Bobot EEMD-LSTM (Lanjutan) 5. IMF 5

Weights of LSTM Layer 1:

Forget Gate Weights: [[-0.2102036 -0.06635984 0.15907426 0.1053622 0.15412311 -0.04494001

-0.30160028 0.05396765 -0.15773138 0.18069229 0.02607813 0.19694605

-0.02070653 -0.03265012 -0.30236173 0.01185506 -0.24745613 0.3177341 0.2214276 -0.09750114 -0.11864271 0.24239492 -0.2454142 0.20709006 -0.06001051 0.04431513 0.42601252 0.15885456 0.06922846 -

0.13148823

0.24789177 -0.28329238]]

Input Gate Weights: [[-0.00584208 0.07038058 0.15890513 0.26618797 - 0.12578642 0.25543016

-0.06258857 -0.26939908 -0.27538413 0.00579862 0.1110256 0.12890959 0.18237425 0.15557687 0.33751145 0.57302177 -0.08456055 0.09300707 0.02619929 0.21465813 0.09013877 -0.06527333 0.12204356 0.01653366 -0.10521539 0.20516247 -0.0164128 0.10572221 0.03767743 -0.04301859 0.01718144 0.01915114]]

Output Gate Weights: [[-0.23427014 0.18005878 -0.2370315 0.14232951 0.01660625 0.09443589

-0.14906363 0.26099467 -0.5830181 0.23975039 0.09619065 -0.04195957 -0.0146028 0.11864831 0.04517581 -0.430092 0.01647786 -0.31996349 -0.02570466 0.13707918 0.07206356 0.00323369 0.10210135 0.03985905 -0.05230906 -0.21508653 -0.12392224 -0.07478593 0.01842703

0.15826349

0.07369406 0.06071166 -0.03429239 0.21310107 0.10072723 0.08560082 0.06928862 0.19846892 0.16645633 0.23182353 0.200736 0.03823119 0.13687393 0.28041333 0.24150078 -0.18058051 0.25340483 0.23205619 -0.06060991 -0.2575695 -0.22043166 -0.03712585 -0.25793427

0.45803392

0.36877632 0.0847313 0.29856935 -0.27127215 -0.23362279 0.2781281 0.26677874 0.17533848 -0.44194442 -0.21344763 0.3862215 0.21981727 -0.20191011 0.40507057 0.12731344 0.21365368 0.19944265 -0.174482 0.25123295 0.26731497 -0.10322104 0.22548147 -0.23323482 0.1549301 0.30965078 -0.324702 -0.63477546 0.2855851 0.43977156 -0.9190552 0.19203058 -0.2510448 -0.02646342 0.26334205 0.24991302 0.01066464 0.26047462 -0.19146922 -0.15487789 0.28868616 0.10005584

0.03718651

0.15407988 0.13557695 -0.16639258 0.06103494 -0.26211378 - 0.08048094

-0.23263988 0.2979312 0.27687904 -0.21665238 -0.30305672 0.06346359 -0.3688373 0.23080315 0.27635175 0.09950462 0.44015086 0.3001318 0.01252507 -0.29742277 0.11582514 -0.14344814 -0.1795775 0.15388608

60

0.17893842 0.26969448 0.21615514 0.15440999 -0.08820789 - 0.08301065

-0.03941817 0.01929674 0.11791149 0.15507156 0.45074984 0.08873077 0.40900487 0.5698542 0.16941543 0.03283268]]

61

Lampiran 4. Syntax EEMD-LSTM pip install EMD-signal

import warnings

warnings.filterwarnings('ignore') import numpy as np

import pandas as pd

import matplotlib.pyplot as plt import seaborn as sns

from datetime import date from scipy import stats from math import sqrt

from datetime import datetime

from sklearn.preprocessing import MinMaxScaler

from sklearn.metrics import mean_squared_error, mean_absolute_error from sklearn.metrics import mean_absolute_percentage_error

from pandas.plotting import lag_plot from pylab import rcParams

import statsmodels.api as sm

from statsmodels.tsa.seasonal import seasonal_decompose from pandas import DataFrame

from pandas import concat

from statsmodels.tsa.stattools import adfuller

from statsmodels.graphics.tsaplots import plot_acf, plot_pacf from sklearn.model_selection import train_test_split

from tensorflow.keras.models import Sequential from tensorflow.keras.layers import LSTM, Dense import matplotlib as mpl

import tensorflow as tf import random

mpl.rcParams['figure.figsize'] = (7,4) mpl.rcParams['axes.grid'] = False data = pd.read_csv('MINYAK.csv')

data['Date'] = pd. to_datetime(data['Date'], infer_datetime_format=True) data.set_index('Date')[['ICP']].plot(subplots=True)

data_input = data[['ICP']]

# Training & Testing train = data.iloc[:111]

test = data.iloc[111:]

# Differencing satu kali pada data 'ICP'

62

train['ICP_diff'] = train['ICP'].diff()

# Buat plot ACF dengan differencing 1 kali fig, ax1 = plt.subplots(figsize=(12, 4))

acf = plot_acf(train['ICP_diff'].dropna(), lags=24, ax=ax1) ax1.set_title('Autocorrelation Function with 1st Differencing') plt.show()

np.random.seed(0)

Signal = data['ICP'].to_numpy() T = data.index.to_numpy() from PyEMD import EEMD eemd = EEMD()

IMFs = eemd(Signal) nIMFs = len(IMFs) plt.figure(figsize=(12,9)) plt.subplot(nIMFs+10, 1, 1) plt.plot(T, Signal, 'r') np.random.seed(0) for n in range(nIMFs):

plt.figure(figsize=(12,9)) plt.subplot(nIMFs+1, 1,2) plt.plot(T, IMFs[n], 'g') plt.ylabel("IMF %i" %(n+1))

plt.locator_params(axis='y', nbins=5) plt.title('EEMD')

plt.xlabel("Time") plt.show()

from keras.preprocessing.sequence import TimeseriesGenerator from sklearn.preprocessing import MinMaxScaler, StandardScaler

63

Lampiran 5. Syntax EEMD-LSTM IMF IMF 1

np.random.seed(0) IMFs[0]

# Memunculkan data IMF ke-1(indeks 0) plt.figure()

plt.plot(IMFs[0], 'b')

plt.title('Data IMF ke-0 (indeks 1)') plt.show()

data_imf1 = IMFs[0]

# Normalisasi data

scaler = MinMaxScaler(feature_range=(0, 1))

data_imf1_scaled = scaler.fit_transform(data_imf1.reshape(-1, 1))

# Pembuatan dataset untuk LSTM np.random.seed(0)

def create_dataset(data, look_back=1):

X, Y = [], []

for i in range(len(data) - look_back):

X.append(data[i:(i + look_back), 0]) Y.append(data[i + look_back, 0]) return np.array(X), np.array(Y) look_back = 3

X, Y = create_dataset(data_imf1_scaled, look_back)

# Reshape input untuk LSTM [samples, time steps, features]

X = np.reshape(X, (X.shape[0], X.shape[1], 1))

# Bagi data menjadi training set dan testing set

X1_train, X1_test, y1_train, y1_test = train_test_split(X, Y, test_size=0.2, random_state=42, shuffle=False)

# Membuat model LSTM np.random.seed(0) model = Sequential()

model.add(LSTM(50, input_shape=(look_back, 1))) model.add(Dense(1))

model.compile(loss='mean_squared_error', optimizer='adam') model.summary()

# Melatih model

64

np.random.seed(0)

model.fit(X1_train, y1_train, epochs=100, batch_size=1, verbose=2)

# Melakukan prediksi pada testing set np.random.seed(0)

y1_pred = model.predict(X1_test)

# Denormalisasi data

y1_test = scaler.inverse_transform(y1_test.reshape(-1, 1)) y1_pred = scaler.inverse_transform(y1_pred)

# Plot hasil prediksi

plt.plot(y1_test, label='True') plt.plot(y1_pred, label='Predicted') plt.legend()

plt.show()

mse = mean_squared_error(y1_test, y1_pred)

mape = mean_absolute_percentage_error(y1_test, y1_pred) rmse = np.sqrt(mse)

print("MSE: {:.2f}".format(mse)) print("MAPE: {:.2f}%".format(mape)) print("RMSE: {:.2f}".format(rmse))

# Get the weights of the LSTM layers

lstm1_weights = model.layers[0].get_weights()[0]

# Print the weights of forget gate, input gate, and output gate for each LSTM layer

print("Weights of LSTM Layer 1:")

print("Forget Gate Weights:", lstm1_weights[:, :32]) print("Input Gate Weights:", lstm1_weights[:, 32:64]) print("Output Gate Weights:", lstm1_weights[:, 64:])

65

Syntax EEMD-LSTM IMF (lanjutan) IMF 2

np.random.seed(0) IMFs[1]

# Memunculkan data IMF ke-2 plt.figure()

plt.plot(IMFs[1], 'b') plt.title('Data IMF ke-2') plt.show()

data_imf2 = IMFs[1]

# Normalisasi data

scaler = MinMaxScaler(feature_range=(0, 1))

data_imf2_scaled = scaler.fit_transform(data_imf2.reshape(-1, 1))

# Pembuatan dataset untuk LSTM np.random.seed(0)

def create_dataset(data, look_back=1):

X, Y = [], []

for i in range(len(data) - look_back):

X.append(data[i:(i + look_back), 0]) Y.append(data[i + look_back, 0]) return np.array(X), np.array(Y) look_back = 3

X, Y = create_dataset(data_imf2_scaled, look_back)

# Reshape input untuk LSTM [samples, time steps, features]

X = np.reshape(X, (X.shape[0], X.shape[1], 1))

# Bagi data menjadi training set dan testing set

X2_train, X2_test, y2_train, y2_test = train_test_split(X, Y, test_size=0.2, random_state=42, shuffle=False)

# Membuat model LSTM tf.random.set_seed(0) model = Sequential()

model.add(LSTM(50, input_shape=(look_back, 1))) model.add(Dense(1))

model.compile(loss='mean_squared_error', optimizer='adam') model.summary()

66

# Melatih model np.random.seed(0)

model.fit(X2_train, y2_train, epochs=100, batch_size=1, verbose=2)

# Melakukan prediksi pada testing set np.random.seed(0)

y2_pred = model.predict(X2_test)

# Denormalisasi data

y2_test = scaler.inverse_transform(y2_test.reshape(-1, 1)) y2_pred = scaler.inverse_transform(y2_pred)

# Plot hasil prediksi

plt.plot(y2_test, label='True') plt.plot(y2_pred, label='Predicted') plt.legend()

plt.show()

mse = mean_squared_error(y2_test, y2_pred)

mape = mean_absolute_percentage_error(y2_test, y2_pred) rmse = np.sqrt(mse)

print("MSE: {:.2f}".format(mse)) print("MAPE: {:.2f}%".format(mape)) print("RMSE: {:.2f}".format(rmse))

# Get the weights of the LSTM layers

lstm2_weights = model.layers[0].get_weights()[0]

# Print the weights of forget gate, input gate, and output gate for each LSTM layer

print("Weights of LSTM Layer 1:")

print("Forget Gate Weights:", lstm2_weights[:, :32]) print("Input Gate Weights:", lstm2_weights[:, 32:64]) print("Output Gate Weights:", lstm2_weights[:, 64:])

67

Syntax EEMD-LSTM IMF (lanjutan) IMF 3

np.random.seed(0) IMFs[2]

# Memunculkan data IMF ke-3 plt.figure()

plt.plot(IMFs[2], 'b') plt.title('Data IMF ke-3') plt.show()

data_imf3 = IMFs[2]

# Normalisasi data

scaler = MinMaxScaler(feature_range=(0, 1))

data_imf3_scaled = scaler.fit_transform(data_imf3.reshape(-1, 1))

# Pembuatan dataset untuk LSTM np.random.seed(0)

def create_dataset(data, look_back=1):

X, Y = [], []

for i in range(len(data) - look_back):

X.append(data[i:(i + look_back), 0]) Y.append(data[i + look_back, 0]) return np.array(X), np.array(Y) look_back = 3

X, Y = create_dataset(data_imf3_scaled, look_back)

# Reshape input untuk LSTM [samples, time steps, features]

X = np.reshape(X, (X.shape[0], X.shape[1], 1))

# Bagi data menjadi training set dan testing set

X3_train, X3_test, y3_train, y3_test = train_test_split(X, Y, test_size=0.2, random_state=42)

# Membuat model LSTM np.random.seed(0) model = Sequential()

model.add(LSTM(50, input_shape=(look_back, 1))) model.add(Dense(1))

model.compile(loss='mean_squared_error', optimizer='adam') model.summary()

# Melatih model

68

np.random.seed(0)

model.fit(X3_train, y3_train, epochs=100, batch_size=1, verbose=2)

# Melakukan prediksi pada testing set np.random.seed(0)

y3_pred = model.predict(X3_test)

# Denormalisasi data

y3_test = scaler.inverse_transform(y3_test.reshape(-1, 1)) y3_pred = scaler.inverse_transform(y3_pred)

# Plot hasil prediksi

plt.plot(y3_test, label='True') plt.plot(y3_pred, label='Predicted') plt.legend()

plt.show()

mse = mean_squared_error(y3_test, y3_pred)

mape = mean_absolute_percentage_error(y3_test, y3_pred) rmse = np.sqrt(mse)

print("MSE: {:.2f}".format(mse)) print("MAPE: {:.2f}%".format(mape)) print("RMSE: {:.2f}".format(rmse))

# Get the weights of the LSTM layers

lstm3_weights = model.layers[0].get_weights()[0]

# Print the weights of forget gate, input gate, and output gate for each LSTM layer

print("Weights of LSTM Layer 1:")

print("Forget Gate Weights:", lstm3_weights[:, :32]) print("Input Gate Weights:", lstm3_weights[:, 32:64]) print("Output Gate Weights:", lstm3_weights[:, 64:])

69

Syntax EEMD-LSTM IMF (lanjutan) IMF 4

np.random.seed(0) IMFs[3]

# Memunculkan data IMF ke-4 plt.figure()

plt.plot(IMFs[3], 'b') plt.title('Data IMF ke-4') plt.show()

data_imf4 = IMFs[3]

# Normalisasi data

scaler = MinMaxScaler(feature_range=(0, 1))

data_imf4_scaled = scaler.fit_transform(data_imf4.reshape(-1, 1))

# Pembuatan dataset untuk LSTM np.random.seed(0)

def create_dataset(data, look_back=1):

X, Y = [], []

for i in range(len(data) - look_back):

X.append(data[i:(i + look_back), 0]) Y.append(data[i + look_back, 0]) return np.array(X), np.array(Y) look_back = 3

X, Y = create_dataset(data_imf4_scaled, look_back)

# Reshape input untuk LSTM [samples, time steps, features]

X = np.reshape(X, (X.shape[0], X.shape[1], 1))

# Bagi data menjadi training set dan testing set

X4_train, X4_test, y4_train, y4_test = train_test_split(X, Y, test_size=0.2, random_state=42)

# Membuat model LSTM np.random.seed(0) model = Sequential()

model.add(LSTM(50, input_shape=(look_back, 1))) model.add(Dense(1))

model.compile(loss='mean_squared_error', optimizer='adam') model.summary()

70

# Melatih model np.random.seed(0)

model.fit(X4_train, y4_train, epochs=100, batch_size=1, verbose=2)

# Melakukan prediksi pada testing set np.random.seed(0)

y4_pred = model.predict(X4_test)

# Denormalisasi data

y4_test = scaler.inverse_transform(y4_test.reshape(-1, 1)) y4_pred = scaler.inverse_transform(y4_pred)

# Plot hasil prediksi

plt.plot(y4_test, label='True') plt.plot(y4_pred, label='Predicted') plt.legend()

plt.show()

mse = mean_squared_error(y4_test, y4_pred)

mape = mean_absolute_percentage_error(y4_test, y4_pred) rmse = np.sqrt(mse)

print("MSE: {:.2f}".format(mse)) print("MAPE: {:.2f}%".format(mape)) print("RMSE: {:.2f}".format(rmse))

# Get the weights of the LSTM layers

lstm4_weights = model.layers[0].get_weights()[0]

# Print the weights of forget gate, input gate, and output gate for each LSTM layer

print("Weights of LSTM Layer 1:")

print("Forget Gate Weights:", lstm4_weights[:, :32]) print("Input Gate Weights:", lstm4_weights[:, 32:64]) print("Output Gate Weights:", lstm4_weights[:, 64:])

71

Syntax EEMD-LSTM IMF (lanjutan) IMF 5

np.random.seed(0) IMFs[4]

# Memunculkan data IMF ke-5 plt.figure()

plt.plot(IMFs[4], 'b') plt.title('Data IMF ke-5') plt.show()

data_imf5 = IMFs[4]

# Normalisasi data

scaler = MinMaxScaler(feature_range=(0, 1))

data_imf5_scaled = scaler.fit_transform(data_imf5.reshape(-1, 1))

# Pembuatan dataset untuk LSTM np.random.seed(0)

def create_dataset(data, look_back=1):

X, Y = [], []

for i in range(len(data) - look_back):

X.append(data[i:(i + look_back), 0]) Y.append(data[i + look_back, 0]) return np.array(X), np.array(Y) look_back = 3

X, Y = create_dataset(data_imf5_scaled, look_back)

# Reshape input untuk LSTM [samples, time steps, features]

X = np.reshape(X, (X.shape[0], X.shape[1], 1))

# Bagi data menjadi training set dan testing set

X5_train, X5_test, y5_train, y5_test = train_test_split(X, Y, test_size=0.2, random_state=42)

# Membuat model LSTM np.random.seed(0) model = Sequential()

model.add(LSTM(50, input_shape=(look_back, 1))) model.add(Dense(1))

model.compile(loss='mean_squared_error', optimizer='adam') model.summary()

# Melatih model

72

np.random.seed(0)

model.fit(X5_train, y5_train, epochs=100, batch_size=1, verbose=2)

# Melakukan prediksi pada testing set np.random.seed(0)

y5_pred = model.predict(X5_test)

# Denormalisasi data

y5_test = scaler.inverse_transform(y5_test.reshape(-1, 1)) y5_pred = scaler.inverse_transform(y5_pred)

# Plot hasil prediksi

plt.plot(y5_test, label='True') plt.plot(y5_pred, label='Predicted') plt.legend()

plt.show()

mse = mean_squared_error(y5_test, y5_pred)

mape = mean_absolute_percentage_error(y5_test, y5_pred) rmse = np.sqrt(mse)

print("MSE: {:.2f}".format(mse)) print("MAPE: {:.2f}%".format(mape)) print("RMSE: {:.2f}".format(rmse))

# Get the weights of the LSTM layers

lstm5_weights = model.layers[0].get_weights()[0]

# Print the weights of forget gate, input gate, and output gate for each LSTM layer

print("Weights of LSTM Layer 1:")

print("Forget Gate Weights:", lstm5_weights[:, :32]) print("Input Gate Weights:", lstm5_weights[:, 32:64]) print("Output Gate Weights:", lstm5_weights[:, 64:])

73

Syntax EEMD-LSTM IMF (lanjutan) IMF 6

np.random.seed(0) IMFs[5]

# Memunculkan data IMF ke-6 plt.figure()

plt.plot(IMFs[5], 'b') plt.title('Data IMF ke-6') plt.show()

data_imf6 = IMFs[5]

# Normalisasi data

scaler = MinMaxScaler(feature_range=(0, 1))

data_imf6_scaled = scaler.fit_transform(data_imf6.reshape(-1, 1))

# Pembuatan dataset untuk LSTM np.random.seed(0)

def create_dataset(data, look_back=1):

X, Y = [], []

for i in range(len(data) - look_back):

X.append(data[i:(i + look_back), 0]) Y.append(data[i + look_back, 0]) return np.array(X), np.array(Y) look_back = 3

X, Y = create_dataset(data_imf6_scaled, look_back)

# Reshape input untuk LSTM [samples, time steps, features]

X = np.reshape(X, (X.shape[0], X.shape[1], 1))

# Bagi data menjadi training set dan testing set

X6_train, X6_test, y6_train, y6_test = train_test_split(X, Y, test_size=0.2, random_state=42)

# Membuat model LSTM np.random.seed(0) model = Sequential()

model.add(LSTM(50, input_shape=(look_back, 1))) model.add(Dense(1))

model.compile(loss='mean_squared_error', optimizer='adam') model.summary()

# Melatih model

74

np.random.seed(0)

model.fit(X6_train, y6_train, epochs=100, batch_size=1, verbose=2)

# Melakukan prediksi pada testing set np.random.seed(0)

y6_pred = model.predict(X6_test)

# Denormalisasi data

y6_test_denormalized = scaler.inverse_transform(y6_test.reshape(-1, 1)) y6_pred_denormalized = scaler.inverse_transform(y6_pred)

# Plot hasil prediksi

plt.plot(y6_test, label='True') plt.plot(y6_pred, label='Predicted') plt.legend()

plt.show()

mse = mean_squared_error(y6_test, y6_pred)

mape = mean_absolute_percentage_error(y6_test, y6_pred) rmse = np.sqrt(mse)

print("MSE: {:.2f}".format(mse)) print("MAPE: {:.2f}%".format(mape)) print("RMSE: {:.2f}".format(rmse))

75

Syntax EEMD-LSTM IMF (lanjutan) Gabungan IMF

ygabungan_pred = y1_pred + y2_pred + y3_pred + y4_pred + y5_pred + y6_pred ygabungan_test = y1_test + y2_test + y3_test + y4_test + y5_test + y6_test combined_pred = np.concatenate((y1_pred, y2_pred, y3_pred, y4_pred, y5_pred), axis=0)

combined_test = np.concatenate((y1_test, y2_test, y3_test, y4_test, y5_test), axis=0)

# Plot hasil prediksi

plt.plot(combined_test, label='True') plt.plot(combined_pred, label='Predicted') plt.legend()

plt.show()

mse = mean_squared_error(combined_test, combined_pred)

mape = mean_absolute_percentage_error(combined_test, combined_pred) rmse = np.sqrt(mse)

print("MSE: {:.2f}".format(mse)) print("MAPE: {:.2f}%".format(mape)) print("RMSE: {:.2f}".format(rmse))

76

Lampiran 6. Syntax LSTM import warnings

warnings.filterwarnings('ignore') import numpy as np

import pandas as pd

import matplotlib.pyplot as plt import seaborn as sns

from datetime import date from scipy import stats from math import sqrt

from datetime import datetime

from sklearn.preprocessing import MinMaxScaler

from sklearn.metrics import mean_squared_error, mean_absolute_error from pandas.plotting import lag_plot

from pylab import rcParams import statsmodels.api as sm

from statsmodels.tsa.seasonal import seasonal_decompose from pandas import DataFrame

from pandas import concat

from statsmodels.tsa.stattools import adfuller

from statsmodels.graphics.tsaplots import plot_acf, plot_pacf from sklearn.model_selection import train_test_split

from keras.preprocessing.sequence import TimeseriesGenerator from sklearn.preprocessing import MinMaxScaler, StandardScaler from sklearn.preprocessing import MinMaxScaler

from tensorflow.keras.models import Sequential from tensorflow.keras.layers import LSTM, Dense import tensorflow as tf

import matplotlib as mpl import random

mpl.rcParams['figure.figsize'] = (7,4) mpl.rcParams['axes.grid'] = False

# Tetapkan nilai acak untuk NumPy np.random.seed(0)

# Tetapkan nilai acak untuk TensorFlow random.seed(0)

tf.random.set_seed(0)

data = pd.read_csv('MINYAK.csv')

data.set_index('Date', inplace=True) #set date as index

77

Syntax LSTM (Lanjutan) plt.xlabel("Date") plt.ylabel("ICP")

plt.title("Indonesian Crude Oil Price") plt.plot(data['ICP'],)

from sklearn.preprocessing import MinMaxScaler scaler=MinMaxScaler(feature_range=(0,1)) data=scaler.fit_transform(data)

#Creating train and test partition train = int(len(data)*0.80) test = len(data)-train

train_data,test_data=data[0:train,:],data[train:len(data),:1]

# converting an array of values into a dataset matrix np.random.seed(0)

def create_dataset(dataset, time_step=1):

dataX, dataY = [], []

for i in range(len(dataset)-time_step-1):

a = dataset[i:(i+time_step), 0] ###i=0, 0,1,2,3 dataX.append(a)

dataY.append(dataset[i + time_step, 0]) return np.array(dataX), np.array(dataY)

# reshape into X=t,t+1,t+2,t+3 and Y=t+4 time_step = 4

X_train, y_train = create_dataset(train_data, time_step) X_test, ytest = create_dataset(test_data, time_step)

# reshape input to be [sample, time steps, features] which is required for LSTM

X_train =X_train.reshape(X_train.shape[0], 4, 1) X_test = X_test.reshape(X_test.shape[0], 4, 1) tf.random.set_seed(0)

model=Sequential()

model.add(LSTM(50,return_sequences=True,input_shape=(4,1))) model.add(LSTM(50))

model.add(Dense(1))

model.compile(loss='mean_squared_error',optimizer='adam')

model.fit(X_train,y_train,validation_data=(X_test,ytest),epochs=150,b atch_size=1,verbose=2)

Dokumen terkait