Skip to content
Snippets Groups Projects
Commit 3c15ae4a authored by Vojtech Moravec's avatar Vojtech Moravec
Browse files

Add commented out smape metric.

parent 6e2eceac
No related branches found
No related tags found
No related merge requests found
...@@ -123,17 +123,26 @@ public class MeasurePlaneErrorFunction extends CustomFunctionBase { ...@@ -123,17 +123,26 @@ public class MeasurePlaneErrorFunction extends CustomFunctionBase {
final OutputStreamWriter reportWriter) throws IOException { final OutputStreamWriter reportWriter) throws IOException {
final int[][] testData = loadPlanes(testFile, ReferenceFileDimensions); final int[][] testData = loadPlanes(testFile, ReferenceFileDimensions);
final int pixelCount = ReferenceFileDimensions.getNumberOfElementsInDimension(2);
reportWriter.write("=========================================\n"); reportWriter.write("=========================================\n");
reportWriter.write(testFile); reportWriter.write(testFile);
reportWriter.write('\n'); reportWriter.write('\n');
reportWriter.write("=========================================\n"); reportWriter.write("=========================================\n");
reportWriter.write("PlaneIndex;ErrorSum;MeanError\n"); reportWriter.write("PlaneIndex;ErrorSum;MeanError\n"); //;SMAPE
final int planePixelCount = ReferenceFileDimensions.getNumberOfElementsInDimension(2); final int planePixelCount = ReferenceFileDimensions.getNumberOfElementsInDimension(2);
final int[] diffData = new int[planePixelCount]; final int[] diffData = new int[planePixelCount];
for (int plane = 0; plane < ReferenceFileDimensions.getPlaneCount(); plane++) { for (int plane = 0; plane < ReferenceFileDimensions.getPlaneCount(); plane++) {
// NOTE(Moravec): SMAPE metric. https://en.wikipedia.org/wiki/Symmetric_mean_absolute_percentage_error
// double numerator = 0;
// double denominator = 0;
// for (int i = 0; i < pixelCount; i++) {
// numerator += Math.abs((double) testData[plane][i] - (double) referenceData[plane][i]);
// denominator += ((double) referenceData[plane][i] + (double) testData[plane][i]);
// }
// assert (denominator != 0) : "SMAPE denominator can't be zero.";
// final double SMAPE = numerator / denominator;
Utils.differenceToArray(referenceData[plane], testData[plane], diffData); Utils.differenceToArray(referenceData[plane], testData[plane], diffData);
Utils.applyAbsFunction(diffData); Utils.applyAbsFunction(diffData);
......
package cz.it4i.qcmp.cli.functions;
public class PlaneError {
private final int planeIndex;
private final double absoluteError;
private final double meanAbsoluteError;
public PlaneError(final int planeIndex, final double absoluteError, final double meanAbsoluteError) {
this.planeIndex = planeIndex;
this.absoluteError = absoluteError;
this.meanAbsoluteError = meanAbsoluteError;
}
public int getPlaneIndex() {
return planeIndex;
}
public double getAbsoluteError() {
return absoluteError;
}
public double getMeanAbsoluteError() {
return meanAbsoluteError;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment