Prof Christian Bharat, dari Antropolis,Nice,France datang buat lawatan kerja kat opis aku. Prof Marzuki mintak dia consult researchers kat opis aku (CAIRO) on projek Kenalkayu.
Aku try nak buat program untuk kurangkan features untuk training database kenalkayu (ni actually hasil kajian Prof Christian tu la). Nak buat benda ni kena pakai matrix. Tiba-tiba aku check x de la pulak function Covariance dalam library matrix tu. Ahh... sudah. Jenus nak kena carik pulak. Dalam matlab satu baris je Cov(M).
Jadi aku pun berhempas pulas la dengan Due(email glamor dia =MrUTM) nak buat benda ni. Akhirnya berjaya jugak.Ni aku pastekan code dalam VB.NET yang aku buat.
Private Function Covariance(ByVal M As CSML.Matrix, Optional ByVal N As Integer = 0)
Dim iRow As Integer = M.Size(0)
Dim iCol As Integer = M.Size(1)
Dim i, j As Integer
'Console.WriteLine("Mean")
'Dim MeanMat As New CSML.Matrix(Mean)
'Console.WriteLine(MeanMat.ToString)
Dim MeanMat As CSML.Matrix = Mean(M)
Me.PrintMatrixSize("Covariance Mean=", MeanMat)
Me.PrintMatrix("Covariance Mean=", MeanMat)
Dim A As New CSML.Matrix
For i = 1 To iRow
Dim B As CSML.Matrix = M.Row(i) - MeanMat.Row(1)
A.InsertRow(B, i)
Next
'Console.WriteLine(A.ToString)
Dim AT As CSML.Matrix = A.Transpose
Dim covMat As CSML.Matrix = AT * A
Dim divider As Integer = iRow - 1
If N = 1 Then
divider = iRow
End If
covMat = covMat / divider
'Console.WriteLine(covMat.ToString)
Return covMat
End Function
Library matrix(C#) boleh download kat sini :
http://www.codeproject.com/KB/cs/CSML.aspx
References :
http://en.wikipedia.org/wiki/Covariance_matrix
Malaya Merdeka - from Ash's vinyl collection
9 months ago
1 comments:
sbb apa dlm matlab tu dokleh pakai ke?
teruskan usaha..senang utk phd sy nnt...kekekke
Post a Comment