List of usage examples for weka.core.matrix Matrix det
public double det()
From source file:org.knime.knip.suise.node.boundarymodel.BoundaryModel.java
License:Open Source License
private double calcLMDL(double epsilon) { // create sample matrix Matrix V = new Matrix(m_contourData.numFeatures(), m_contourData.numVectors()); double[] vec; for (int i = 0; i < m_contourData.numVectors(); i++) { vec = m_contourData.getVector(i); for (int j = 0; j < vec.length; j++) { V.set(j, i, vec[j]);/*from w w w . ja v a 2s .c om*/ } } // estimate of the covariance matrix Matrix W = V.times(V.transpose()); W.times(m_contourData.numFeatures() / (epsilon * epsilon * m_contourData.numVectors())); W = Matrix.identity(m_contourData.numFeatures(), m_contourData.numFeatures()).plus(W); return Utils.log2(W.det()) * (m_contourData.numFeatures() + m_contourData.numVectors()) / 2; }
From source file:org.knime.knip.suise.node.boundarymodel.contourdata.ContourCluster.java
License:Open Source License
private double calcLMDL() { // create sample matrix Matrix V = new Matrix(m_cdata.numFeatures(), m_samples.size()); double[] vec; for (int i = 0; i < m_samples.size(); i++) { vec = m_cdata.get(m_samples.get(i)[0], m_samples.get(i)[1]); for (int j = 0; j < vec.length; j++) { V.set(j, i, vec[j]);/*from w w w.j a v a 2s. c om*/ } } double epsilon = 5; // estimate of the covariance matrix Matrix W = V.times(V.transpose()); W.times(m_cdata.numFeatures() / (epsilon * epsilon * m_samples.size())); W = Matrix.identity(m_cdata.numFeatures(), m_cdata.numFeatures()).plus(W); return Utils.log2(W.det()) * (m_cdata.numFeatures() + m_samples.size()) / 2; }