Changeset 117 for trunk/CrossPare/src/de/ugoe/cs/cpdp/dataselection
- Timestamp:
- 06/02/16 17:01:08 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CrossPare/src/de/ugoe/cs/cpdp/dataselection/MahalanobisOutlierRemoval.java
r86 r117 19 19 import org.apache.commons.math3.linear.LUDecomposition; 20 20 import org.apache.commons.math3.linear.RealMatrix; 21 import org.apache.commons.math3.linear.SingularMatrixException; 21 22 import org.apache.commons.math3.stat.correlation.Covariance; 22 23 24 import de.lmu.ifi.dbs.elki.logging.Logging.Level; 23 25 import de.ugoe.cs.cpdp.util.WekaUtils; 26 import de.ugoe.cs.util.console.Console; 24 27 import weka.core.Instances; 25 28 … … 92 95 values.setRow(i, WekaUtils.instanceValues(data.get(i))); 93 96 } 94 RealMatrix inverseCovariance = 97 RealMatrix inverseCovariance; 98 try { 99 inverseCovariance = 95 100 new LUDecomposition(new Covariance(values).getCovarianceMatrix()).getSolver() 96 101 .getInverse(); 97 102 } catch(SingularMatrixException e) { 103 Console.traceln(Level.WARNING, "could not perform Mahalanobis outlier removal due to singular covariance matrix"); 104 return; 105 } 98 106 // create mean vector 99 107 double[] meanValues = new double[data.numAttributes() - 1];
Note: See TracChangeset
for help on using the changeset viewer.