comirva.mlearn
Class SDH

java.lang.Object
  extended by comirva.mlearn.SDH
All Implemented Interfaces:
VisuListItem, Serializable

public class SDH
extends Object
implements Serializable, VisuListItem

This class implements a Smoothed Data Histogram (SDH) for a SOM. An SDH in its simplest form visualizes the number of data items that are mapped to each map unit (spread=1). Alternatively, it is possible that each data item votes for more than one map unit and the resulting distribution is visualized. In this case, the parameter spread equals the number of map units each data items votes for.

See Also:
Serialized Form

Field Summary
 int borderUnits
           
 
Constructor Summary
SDH(SOM som)
          Creates a new SDH-instance based on the passed SOM.
SDH(SOM som, int iter)
          Creates a new SDH-instance based on the passed SOM.
 
Method Summary
 void addFractalComponent(int fractalComponent)
          "Unsharpens" the SDH by adding a fractal component to its voting matrix.
 void calcSDH(int spread)
          Calculates an SDH with the specified spread.
 double[][] getInterpolatedVotingMatrix()
          Returns the interpolated voting matrix of the SDH.
 SOM getSOM()
          Returns the SOM-instance for which the SDH is calculated.
 double[][] getVotingMatrix()
          Returns the voting matrix of the SDH.
static double[][] interpolateMatrix(double[][] votes)
          Interpolates the double[][] matrix votes linearly by inserting a data item containing the medium of the neighboring values between every array element.
 void interpolateVotingMatrix(int iter)
          Prepares the SDH-instance for visualization by interpolating the voting matrix.
 void normalizeVotingMatrix()
          Normalizes the voting matrix by dividing every element by the maximum number of votes a map unit got.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

borderUnits

public final int borderUnits
See Also:
Constant Field Values
Constructor Detail

SDH

public SDH(SOM som)
Creates a new SDH-instance based on the passed SOM.

Parameters:
som - the SOM for which the SDH is to be calculated

SDH

public SDH(SOM som,
           int iter)
Creates a new SDH-instance based on the passed SOM. The number of iterations the interpolation of the voting matrix is performed is set to iter.

Parameters:
som - the SOM for which the SDH is to be calculated
iter - the number of iterations, the voting matrix is interpolated
Method Detail

getVotingMatrix

public double[][] getVotingMatrix()
Returns the voting matrix of the SDH.

Returns:
the double[][] voting matrix

getInterpolatedVotingMatrix

public double[][] getInterpolatedVotingMatrix()
Returns the interpolated voting matrix of the SDH.

Returns:
the double[][] interpolated voting matrix

getSOM

public SOM getSOM()
Returns the SOM-instance for which the SDH is calculated.

Returns:
the SOM-instance on which the SDH is based

calcSDH

public void calcSDH(int spread)
Calculates an SDH with the specified spread.

Parameters:
spread - the number of map units each data item votes for

normalizeVotingMatrix

public void normalizeVotingMatrix()
Normalizes the voting matrix by dividing every element by the maximum number of votes a map unit got.


interpolateVotingMatrix

public void interpolateVotingMatrix(int iter)
Prepares the SDH-instance for visualization by interpolating the voting matrix. At first, the voting matrix is interpolated once. Then, a border around it is inserted. Finally, interpolation is performed iter times.

Parameters:
iter - the number of iterations that are performed

interpolateMatrix

public static double[][] interpolateMatrix(double[][] votes)
Interpolates the double[][] matrix votes linearly by inserting a data item containing the medium of the neighboring values between every array element. The resulting matrix has size (oldNumberOfRows*2)-1 x (oldNumberOfColumns*2)-1.

Parameters:
votes - the double[][] matrix to be interpolated
Returns:
a double[][] matrix containing the interpolated values

addFractalComponent

public void addFractalComponent(int fractalComponent)
"Unsharpens" the SDH by adding a fractal component to its voting matrix. To every element of the voting matrix a random value between ([-0.5, 0.5]/1000)*fractalComponent is added.

Parameters:
fractalComponent - the strength of the fractal component (should be in [0, 100]))