@Test public void testDecode() { final Equilateral eq = new Equilateral(3, -1, 1); final double[] d0 = {0.866, 0.5}; final double[] d1 = {-0.866, 0.5}; final double[] d2 = {0, -1}; assertEquals(2, eq.decode(d0)); assertEquals(2, eq.decode(d1)); assertEquals(0, eq.decode(d2)); }
public final int decode(final double[] activations) { double minValue = Double.POSITIVE_INFINITY; int minSet = -1; for (int i = 0; i < this.matrix.length; i++) { final double dist = getDistance(activations, i); if (dist < minValue) { minValue = dist; minSet = i; } } return minSet; }
Equilateral implements Serializable { public final int decode(final double[] activations) { double minValue = Double.POSITIVE_INFINITY; int minSet = -1; for (int i = 0; i < this.matrix.length; i++) { final double dist = getDistance(activations, i); if (dist < minValue) { minValue = dist; minSet = i; } } return minSet; } }
Equilateral implements Serializable { public final int decode(final double[] activations) { double minValue = Double.POSITIVE_INFINITY; int minSet = -1; for (int i = 0; i < this.matrix.length; i++) { final double dist = getDistance(activations, i); if (dist < minValue) { minValue = dist; minSet = i; } } return minSet; } Equilateral(final int count, final double low, final double high); }
Equilateral implements Serializable { public final int decode(final double[] activations) { double minValue = Double.POSITIVE_INFINITY; int minSet = -1; for (int i = 0; i < this.matrix.length; i++) { final double dist = getDistance(activations, i); if (dist < minValue) { minValue = dist; minSet = i; } } return minSet; } Equilateral(final int count, final double low, final double high); final int decode(final double[] activations); final double[] encode(final int set); final double getDistance(final double[] data, final int set); }
Equilateral implements Serializable { public final int decode(final double[] activations) { double minValue = Double.POSITIVE_INFINITY; int minSet = -1; for (int i = 0; i < this.matrix.length; i++) { final double dist = getDistance(activations, i); if (dist < minValue) { minValue = dist; minSet = i; } } return minSet; } Equilateral(final int count, final double low, final double high); final int decode(final double[] activations); final double[] encode(final int set); final double getDistance(final double[] data, final int set); static final int MIN_EQ; }