Kajian Machine Learning dengan Metode Matriks Koragam dan Transformasi Fitur Interval pada Pengklasifikasian Deret Waktu
Date
2023-01-24Author
Rahman, Rifqi Aulya
Sadik, Kusman
Fitrianto, Anwar
Metadata
Show full item recordAbstract
Klasifikasi deret waktu adalah konsep pemodelan yang mengklasifikasi deret waktu dengan suatu label kelas. Salah satu teknik pemodelannya menggunakan pendekatan fitur. Pendekatan fitur mengekstrak informasi statistik dari deret menjadi vektor berisi fitur-fitur, sehingga deret waktu yang kemiripan fiturnya dekat akan diklasifikasikan pada kelas yang sama. Kelebihan teknik ini membuat pemodelan lebih representatif dan berdimensi rendah. Akan tetapi, kekuranganya terletak pada segmentasi deret berapa dan komposisi fitur mana yang membuat model menjadi optimal. Kondisi ini terjadi pada model terbaru matriks koragam fitur dan transformasi fitur interval (IFT). Kedua model tidak mengevaluasi segmentasi dan komposisi fitur. Di tambah lagi, matriks koragam fitur masih menggunakan klasifikasi one nearest-neighbor (1-NN) yang hanya meninjau kesederhanaan, sehingga dikenal dengan Kor-NN.
Penelitian ini memperbarui model KorNN menjadi Kor-kNN, lalu mengevaluasi segmentasi deret dan bentuk fitur bagi model Kor-kNN dan IFT. Evaluasi berarti menyelidiki pada jumlah segmen berapa dan bentuk fitur seperti apa model akan tepat memprediksi kelas deret. Fitur Kor-kNN yang diteliti adalah fitur lokal berupa nilai titik dan differencing pertama, dan fitur global yaitu penjumlahan kumulatif dan selisih titik terhadap rata-rata. Pada model IFT, fitur IFT I berisi rata-rata dan simpangan baku, IFT II berisi IFT I ditambah kemenjuluran dan kurtosis, dan IFT III berisi IFT I ditambah jumlah mutlak differencing pertama dan jarak antar kuartil.
Tujuan pertama penelitian ini adalah mengkaji dan membandingkan kinerja Kor-kNN dan IFT pada data simulasi. Data simulasi dibangkitkan mengikuti pola deret waktu sehari-hari. Skenario I berisi enam pola dasar yaitu, normal, siklus, trend naik, trend turun, shift naik dan shift turun. Skenario II berisi empat pola gabungan dari pola-pola dasar tersebut. Setiap pola dalam Skenario I dan Skenario II terdiri 10 deret dengan panjang indeks waktu 40. Selanjutnya, Skenario III adalah usaha menyimulasikan deret magnitudo sebelum gempa. Penyimulasian gempa mengacu pada dugaan parameter b-value dari data riil Badan Meteorologi Klimatologi dan Geofisika (BMKG). Deret berkelas potensi gempa besar memiliki b-value senilai 0,430 dan kecil sebesar 0,584. Sebanyak 20 deret tiap radius 100 km terbangkitkan dengan panjang waktu 47 bulan. Dengan begitu, Kor-kNN dan IFT diharapkan tepat mengklasifikasi kelas-kelas deret berpotensi sebelum gempa.
Data simulasi dibagi menjadi 70% untuk data latih dan 30% untuk data uji. Setiap deret data latih disegmentasi lalu diekstrak vektor fitur Kor-kNN. Banyak segmen deret yang mungkin adalah 1, 2, 4, dan 8, sehingga setiap kemungkinan ini menjadi bahan evaluasi. Kemudian, vektor-vektor fitur tersebut dikonstruksi matriks koragam untuk tiap segmen deret. Klasifikasi kelas dari deret uji ditentukan berdasarkan rataan jarak antar matriks koragam deret-deret latih terdekat. Jika terdapat k tetangga terdekat, maka deret uji diklasifikasi atas kelas mayoritasnya. Pada model IFT, vektor-vektor fitur tiap interval data latih diseleksi agar mendapat vektor diskriminatif. Vektor ini adalah acuan transformasi bagi data latih dan uji untuk menjadi data silang baru dan dilanjutkan pada klasifikasi Random Forest. Dalam hal ini, parameter ketetanggaan kNN dan banyak pohon Random Forest perlu dicari nilai optimalnya terlebih dahulu melalui validasi silang 10-folds. Pada tahap ini, terdapat delapan model Kor-kNN (dua fitur tiap jumlah segmen) dan dua belas model IFT (tiga fitur tiap jumlah segmen) yang terbentuk.
Evaluasi kinerja antar model yang menjadi bahan perbandingan adalah ukuran akurasi dan sensitivitas kelas pada data uji. Pada model matriks koragam, modifikasi Kor-kNN mampu mengoptimalkan nilai akurasi dengan spesifikasi fitur global meraih akurasi dan sensitivitas sempurna pada Skenario I dan Skenario II. Akan tetapi, model dengan fitur lokal cenderung berakurasi rendah bahkan mengalami penurunan saat jumlah segmen deret bertambah. Hal ini disebabkan matriks menangkap sedikit titik dan beberapa matriks merepresentasikan pola yang tidak unik. Pada model IFT, model dengan fitur IFT II dan IFT III memiliki akurasi dan sensitivitas yang baik dan optimal di jumlah segmen tertentu, namun sulit diinterpretasikan karena berbasis ansambel. Walaupun begitu, model IFT lebih baik daripada Kor-kNN pada Skenario III dalam mendeteksi kelas gempa. Berdasarkan uraian ini, dapat disimpulkan bahwa evaluasi komposisi fitur dan segmentasi sangat mempengaruhi performa model dalam klasifikasi.
Tujuan kedua penelitian adalah menerapkan model Kor-kNN dan IFT terhadap data kejadian gempa bumi. Lokasi data berada di negara Indonesia yang berada di kawasan potensial gempa dengan penduduk berpopulasi tinggi. Setiap tahun bencana gempa tidak dapat dihindarkan dan ditambah aktivitas penduduknya terkonsentrasi di daerah rawan gempa. Sebagai studi peringatan dini, maka perlu dikaji bagaimana mengklasifikasi rangkaian magnitudo sebelum gempa termasuk kelas besar atau kecil. Prosedur penerapan Kor-kNN dan IFT diawali dari pengambilan data, prapemrosesan, klasifikasi, dan evaluasi. Data diambil dari web BMKG kurun tahun 20092021 dengan rentang 3,09,5 magnitudo. Pengambilan data menghasilkan 62057 titik gempa lalu diberi label gempa besar bagi titik bermagnitudo di atas enam dan kecil untuk selainnya.
Prapemrosesan data berikutnya adalah menarik deret waktu magnitudo sepanjang 47 bulan sebelum muncul titik gempa besar dalam radius 100 km lalu deret-deret diberi label kelas potensi gempa besar. Durasi tersebut merupakan hasil dugaan rata-rata waktu kemunculan antar dua gempa besar secara nasional. Penarikan juga dilakukan pada kelas potensi gempa kecil namun melalui percontohan acak titik-titik terlebih dahulu. Pada tahap ini, data deret empiris yang terbentuk terdiri 111 deret bagi masing-masing kelas. Data deret empiris dibagi menjadi 70% berisi deret-deret data latih dan 30% deret-deret data uji. Prosedur klasifikasi Kor-kNN dan IFT yang diterapkan sama seperti klasifikasi pada data simulasi. Model terbaik yang ditemukan adalah IFT II dengan jumlah segmen delapan yang mencapai akurasi prediksi sebesar 73% dan sensitivitas terhadap gempa besar senilai 81%. Model ini menghasilkan 23 vektor fitur diskriminatif selama 5-6 bulan yang menjadi acuan transformasi fitur interval pada data deret. Time series classification is a modelling concept that classifies time series with a class label. The feature approach is one of the modelling techniques which extracts statistical information from a series or segment into a feature vector. So that, the time series with close similarity of features will be classified in the same class. The advantage of this technique is that the modelling is more representative and has low dimensions. However, the weakness faced is when the segment is optimal and which feature form is the best. This condition occurs in the newest model of the covariance feature matrices and interval feature transformation model (IFT). Both models do not evaluate feature segmentation and composition. In addition, the feature matrices still use the one nearest-neighbor (1-NN) classification which only looks at simplicity, so it is known as KorNN.
This novel study extends the KorNN model to Kor-kNN and then evaluates series segmentation and feature for the Kor-kNN and IFT models. Evaluation means investigating what number of segments and best features the model will accurately predict the class of the series. The Kor-kNN features studied are local features: point values and first differencing, and global features: cumulative sum up and point difference to the average. In the IFT model, the IFT I feature contains the mean and standard deviation, IFT II contains IFT I with skewness and kurtosis, and IFT III contains IFT II with the absolute sum of differencing and interquartile.
The first objective is to examine and compare the performance of Kor-kNN and IFT on simulation data. Simulation data is generated following the daily time series pattern. Scenario-I contains six basic patterns: normal, cyclical, uptrend, downtrend, upshift and downshift. Scenario-II contains four combination patterns of the basic patterns. Each pattern in Scenario-I and Scenario-II consists of 10 series with a time length of 40 indices. Then, Scenario-III is an attempt to simulate the earthquake magnitude series. Earthquake simulation refers to the estimated b-value from real data from the Meteorology, Climatology and Geophysics Agency (BMKG). Class series of potential large earthquakes are generated following the estimated b-value of 0.430 and small by 0.584. The scenario contains 20 series with a length of 47 months. It represents a series of magnitudes for 47 months before large and small earthquakes within a radius of 100 km. The model is expected to classify the series classes in these scenarios correctly.
Simulation data is partitioned into 70% training and 30% testing. Each training data series was segmented and extracted the Kor-kNN feature vector. The number of possible segments is 1, 2, 4, and 8, so that each of these possibilities will be the part of evaluation. Then, the feature vectors are constructed with a uniform matrix for each segment of the series. The class classification of the test series is determined based on the average distance between the matrices of the nearest training series. If there are k nearest neighbours, then the test series is classified according to its majority class. In the IFT model, the feature vectors for each training data interval are selected to obtain a discriminative vector. This vector is the basis for transforming the series data into new cross-data, which can be classified with classic random forest. Before that, the neighbouring parameters of k-NN and the count tree of the random forest must first find the optimal through cross-validation in 10-folds. Finally, there are eight Kor-kNN models and twelve IFT models. At this, eight Kor-kNN models (two features per number of segments) and twelve IFT models (three features per number of segments) were formed.
Evaluation and comparison between performance models are under a measure of the accuracy and class sensitivity of the test data. In the covariance matrices, the modification Kor-kNN can optimize accuracy through the global features of this model have perfect accuracy and sensitivity in Scenario-I and Scenario II. However, models with local features tend to perform less and even decrease as the number of series segments increases. It is because the matrices capture a few points and local feature matrices represent non-unique patterns. In the IFT model, models with IFT II and IFT III features have good and optimal performance in certain segments. High accuracy in the model is difficult to interpret because it is ensemble based. It makes the model accuracy better than Kor-kNN in Scenario III. Thus, the study of features and segmentation affects the performance models in classification.
The next aim is to apply the Kor-kNN and IFT models to earthquake data. Indonesia is located in an earthquake-potential area and has a high population. Every year earthquake disasters are unavoidable, and population activities are concentrated in earthquake-prone areas. As an early warning study, it is necessary to study how to classify the magnitude series before an earthquake, including large or small classes. Implementing the Kor-kNN and IFT models begins with retrieval, pre-processing, classification, and evaluation. The data is taken from the BMKG web earthquake catalogue for 2009-2021, with a range of 3.0 to 9.5 magnitudes. The results of data collection obtained 62057 points of the earthquake with the magnitude distribution extending to the right. Then, each point with a magnitude of six and above is labelled with a large and small earthquake for the other.
The next pre-processing is to record a magnitude series of 47 months before the big earthquake point within a radius 100 km. The duration is nationally estimated by the average time of occurrence between two large earthquakes. Record is also carried out on small earthquake classes but through random sampling of earthquake points before. As a result, the empirical series data formed consists of 111 series for each class. The empirical series data is divided into 70% training data and 30% test data. The analysis continued to Kor-kNN and IFT classification. The procedure applied is the same as the classification of simulation data for each feature composition and segmentation of both models. The best model obtained is IFT II, with eight segments. Model accuracy is 73%, and sensitivity to large earthquakes is 81%. This model can find 23 discriminative vectors containing magnitude statistics for 5-6 months which are the reference for interval feature transformations.