public void testDriverIterationsMahalanobisSeq() throws Exception {
generateAsymmetricSamples(100, 0, 0, 0.5, 3.0);
generateAsymmetricSamples(100, 0, 3, 0.3, 4.0);
ClusteringTestUtils.writePointsToFile(sampleData, getTestTempFilePath("input/data.txt"), fs, conf);
// Now run the driver using the run() method. Others can use runJob() as before
MahalanobisDistanceMeasure measure = new MahalanobisDistanceMeasure();
DistributionDescription description =
new DistributionDescription(DistanceMeasureClusterDistribution.class.getName(),
DenseVector.class.getName(),
MahalanobisDistanceMeasure.class.getName(),
2);
Vector meanVector = new DenseVector(new double[] { 0.0, 0.0 });
measure.setMeanVector(meanVector);
Matrix m= new DenseMatrix(new double [][] {{0.5, 0.0}, {0.0, 4.0}});
measure.setCovarianceMatrix(m);
Path inverseCovarianceFile =
new Path(getTestTempDirPath("mahalanobis"), "MahalanobisDistanceMeasureInverseCovarianceFile");
conf.set("MahalanobisDistanceMeasure.inverseCovarianceFile", inverseCovarianceFile.toString());
FileSystem fs = FileSystem.get(inverseCovarianceFile.toUri(), conf);
MatrixWritable inverseCovarianceMatrix = new MatrixWritable(measure.getInverseCovarianceMatrix());
DataOutputStream out = fs.create(inverseCovarianceFile);
try {
inverseCovarianceMatrix.write(out);
} finally {
Closeables.closeQuietly(out);