Langkah Umum Principal Component Analysis

Misalkan kita memiliki sebuah balok dengan informasi panjang (p), lebar (l) dan tinggi (t). Dari ketiga jenis infomasi ini, bila kita olah dan kita ganti dengan  informasi volume (v) dari balok tersebut, maka informasi volume dianggap sudah dapat menggambarkan panjang, lebar dan tinggi balok tadi. Karena v = p x l x t.
Inilah konsep sederhana kinerja Principal Component Analysis.

PCA bekerja pada data set ukuran besar (mxn) dan kemudian mentransformasinya ke ukuran (mxk) dengan mempertahankan data yang tidak redundant, atau tidak berkorelasi, atau tidak berhubungan. Kenapa data yang tidak berkorelasi? sebab data-data inilah yang memiliki peran penting terhadap variasi data asli.

Kembali lagi ke ilustrasi balok tadi. Seandainya informasi yang kita miliki adalah p, l, t, v dan 2v. Dalam hal ini 2v adalah 2 x volume. Nah 2v inilah yang saya maksud data yang redundant. Informasi 2v bisa didapatkan hanya dengan menyimpan data v saja. Sedangkan p, l dan t berkorelasi dengan nilai v. Jadi dari p, l, t, v dan 2v…cukup disimpan nilai v-nya saja.

Apakah korelasi (correlation), dan bagaimana cara menghitung korelasi? jawabannya ada di catatan saya di sini. Singkatnya, dengan mengetahui korelasi antara dua variabel, misal korelasi p terhadap l, t terhadap p, 2v terhadap v dapat menjadikan dasar dimulainya proses PCA.

Korelasi sendiri tidak dapat dilepaskan dari saudaranya…yaitu kovarians. Catatan saya mengenai kovarians dapat dilihat di sini.

Terdapat banyak cara merepresentasikan hubungan antara dua atau beberapa variabel dengan melihat perubahan nilainya. Contohnya dengan grafik linear, eksponensial, periodic, log..dsb. PCA menggunakan grafik linear dan basisnya adalah nilai korelasi.

Untuk lebih jelasnya, saya coba jelaskan proses PCA dimulai dengan langkah umum diikuti penjelasan beserta contoh program menggunakan Matlab.

Langkah umum penyelesaian PCA dapat dilihat pada diagram berikut:

Langkah PCA

Gambar 1. Langkah PCA

(warna hijau menandakan program yang ditulis dalam Matlab)

1. Input data

Data awal dipersiapkan dalam sebuah matriks ukuran mxn. Nantinya jumlah variable n akan berkurang menjadi k jumlah principal component yang dipertahankan.

Contoh data yang diinputkan adalah:

Data

Sebut saja kolom pertama adalah variabel X, kedua Y dan ketiga Z. Masing-masing barisnya (observasi) diberi label: a, b, c…dan seterusnya sampai t. Tabel Data berukuran 20×3. Dengan m=20 dan n=3.

X dengan range 110-2999, Y: 8-202 dan Z: 5-30.
_________________________________

Data =[110 8 5; 228 21 3; 342 31 14; 375 40 15; 578 48 4; 699 60 12; 807 71 14; 929 79 16; 1040 92 18; 1160 101 38; 1262 109 28; 1376 121 32; 1499 128 35; 1620 143 28; 1722 150 30; 1833 159 15; 1948 172 12; 2077 181 35; 2282 190 23; 2999 202 30];
plot3(Data(:,1),Data(:,2),Data(:,3),’o’)
labels=’abcdefghijklmnopqrst’;
labels = labels’;
text(Data(:,1), Data(:,2), Data(:,3), labels, ‘horizontal’,’left’, ‘vertical’,’bottom’);
xlabel(‘X’);
ylabel(‘Y’);
zlabel(‘Z’);
_________________________________

DataPlot

Gambar 2. Grafik data awal

Bila kita perhatikan hubungan antara variabel X dan Y, X dan Z serta Y dan Z seperti berikut:

X dan Y

Gambar 3. Hubungan antara variabel X dan Y

Terlihat  bahwa variabel X dan Y terhubung secara linear. Kelihatannya perubahan pada satu variabel berarti juga Continue reading

My weather struggle: Sleepless

This time, I posted my messages for a friend who just moved to Pakistan for a job..and she was facing the same thing: weather struggle. Especially winter.

I was facing the problem of sleeping at night. It was too cold. I didn’t know how to choose the best temperature of the room heater. If I choose lower, it will get too cold. If i set up to higher level, at mid night I wake up and feel exhausted..lack of oxygen…and the room will be so hot! The next day my skin will be so dry..and the face and lips started to ‘crack…crackkk’..

The normal lotion can’t help to reduce my itchy skin all over my body.

I can’t move my body easily because of this strange weather. Even I can’t open my book to study (this is true!). My hand was too shaky because of the cold and i felt all the bones got stiff 😥

Then I found the answer from a friend who married and stays in Iceland. She is professional in facing cold now.. (She was my friend in junior high school)

So the main answers in short are:

  1. Sleep with mini nighty..or if you want, sleeping naked is best (seriously, i was like…’WHAT!?)
  2. Use the blanket made from feather, goose down, (gladly I was given this kind of blanket by a friend for free) or wool comforter
  3. Apply body lotion regularly, especially after a warm or hot shower
  4. Apply products special for winter time with moisturizer for your face and lips

and..it’s time to post the discussion here 🙂

Mel, ta kasih info soal tidur biar nyaman di musim dingin. Blanketnya kalo gak wol, pake yang bulu angsa. Mbak pake yang bulu angsa..nyaman banget, gak pake penghangat bahkan disuhu -20 kmren. Bukan cuma bulunya yg ngangetin, tapi pas tidur jangan pake baju bahan katun..apalagi piyama. Pake yang mini aja, kalo mau..tidur naked lebih anget (ini saran dari tmn mbak yang nikah ke islandia). Tapi pake pakaian yg minim aja cukup kok angetnya.

kenapa? alasannya karena struktur bulu yang dipake akan nge-trap udara dingin dan menahannya di dalam..tapi dengan sirkulasi udara yang tetap stabil (gak ky bahan plastik, yang menjebak udara..trus tanpa sirkulasi). Suhu tubuh kita akan memanaskan udara yang ditahan oleh bulu tadi. Jadi emang pas masuk ke blanketnya bakalan dingin..tp lama kelamaan anget banget! dijamin. Klo malah tidur dgn pakaian tebal, proses penghangatan udara yg terjebak tadi jadi terhambat oleh pakaian yang kita pake.

hahaha.. ya mbak, teori “telanjang” itu memang winter 101 survival guide… di sini aku pake mink blanket, cukup anget sih. Krn di kamar juga ada carpet heater, jadi penghangatnya dari bawah … ntar winter sekali lagi, coba deh beli blanket yg bulu angsa .. thx for the feedback

—-

mbak malah gak tau itu mink blanket, hehe..  ini juga dihadiahi sama org jerman yg nikah ma org indo, dua-duanya udah jadi temen skrg.

Tapi bener bgt, terbukti tuh teorinya. Malem2 penghangat ruangan beneran ta matiin!

** Itu tadi tips dari saya untuk tidur nyaman di musim dingin. Tidur tetap hangat dan gak perlu pake selimut listrik, karpet listrik..atau lainnya yang kalo dipake terus-terusan bisa mengganggu kesehatan **

My weather struggle: Electric shock

I was standing near the wall where all the earphones were hanging. It was the display of the electronics shop. I was waiting for my brother to choose his thing..then i was about to try to see one of the earphones, suddenly I got the electric shock and run to him. I told him to be careful because i just got the shock there. He was confused 😀

Then days after that..and also yesterday I felt the same thing. Got electric shock in the train, in the store..etc. Most of the time when i touch stuff made from metal or iron.

Why only me? other people were also there!

Something is wrong..or..

———-

When I was young, very young, I used to imagine that I was blessed with 6th or 7th sense..or perhaps Super Power that I just haven’t realized yet. I tried to look at the spoon on the table for few minutes without blinking my eyes..hoping that the spoon will move. I believed i was trying to discover my ability of using Telepathy. But failed. I tried on the stones, papers, any small things..and failed. Then I forgot about that.

I was thinking I was blessed, so I can see the ghosts. I was trying to see in the dark..and looking at the movements in the dark, again without blinking my eyes.

This is also failed.

———–

Better to don’t mention all super power things that I tried in here. Let’s just get back to the topic.

I browsed, and found the answer. It is because of the static charges in my body.

At first the web showing: it is called pre menopause symptom. I was d*mn scared! I have not married  yet..and getting menopause? Too soon! How come!? *almost crying while reading all of the text.

But then I found the reasonable and more acceptable answer as I mentioned above. Happens because of the static charges in my body. If my body is too dry (especially during winter) and I wear silk or synthetic clothes, the body will get accumulated with static charges. If I touch metal thing, water,.. etc, I ll get electric shock sensation.

The key is to keep moisturizing the body and wear cotton.

Quite happy with this text.

I almost think ‘finally I discovered my hidden super power’ 😀

pahlawan

My weather struggle: Blood spots

darahFor few times I had this problem. I realized there were spots of blood on the tissue that I used when I blow my nose. Not too much, it was like one..or two small spots. But because it was red..and blood..and came from my nose..it was scary! Negative thoughts covering my head that time.

But..slowly..i was trying to calm, trying to don’t get panic..

The very first idea that came was: ask Google.

I asked, and I found calming answer: it was caused by the dry weather during winter. The inside nose is lined with membrane with lot of capillaries. When it is too dry..and blowed strongly it can irritate the inside part of the nose..and result a bloody nose.

It also can be worse for those who has spent their time in warm climate and moved to a new place with cold weather, which is me for this case.

In this site I have found explanation of how to prevent it, but i chose one of the ways mentioned there (the simplest way) to cure myself 🙂

I boiled the water and breathe in the fumes. It gives extra humidity to the nose and the heat loosen the nose and yes, it worked for me. I am ok now.

Acclimation is quite hard and we can’t say the exact time each person will adapt to the new weather..