Class UnifiedDistanceMatrix
java.lang.Object
org.apache.commons.math3.ml.neuralnet.twod.util.UnifiedDistanceMatrix
- All Implemented Interfaces:
MapVisualization
U-Matrix
visualization of high-dimensional data projection.
- Since:
- 3.6
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DistanceMeasure
Distance.private final boolean
Whether to show distance between each pair of neighbouring units. -
Constructor Summary
ConstructorsConstructorDescriptionUnifiedDistanceMatrix
(boolean individualDistances, DistanceMeasure distance) Simple constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate double[][]
Computes the distances between a unit of the map and its neighbours.double[][]
Creates an image of themap
.private double[][]
Computes the distances between a unit of the map and its neighbours.
-
Field Details
-
individualDistances
private final boolean individualDistancesWhether to show distance between each pair of neighbouring units. -
distance
Distance.
-
-
Constructor Details
-
UnifiedDistanceMatrix
Simple constructor.- Parameters:
individualDistances
- Iftrue
, the 8 individual inter-units distances will becomputed
. They will be stored in additional pixels around each of the original units of the 2D-map. The additional pixels that lie along a "diagonal" are shared by two pairs of units: their value will be set to the average distance between the units belonging to each of the pairs. The value zero will be stored in the pixel corresponding to the location of a unit of the 2D-map.
Iffalse
, only the average distance between a unit and all its neighbours will be computed (and stored in the pixel corresponding to that unit of the 2D-map). In that case, the number of neighbours taken into account depends on the network'sneighbourhood type
.distance
- Distance.
-
-
Method Details
-
computeImage
Creates an image of themap
.- Specified by:
computeImage
in interfaceMapVisualization
- Parameters:
map
- Map.- Returns:
- a 2D-array (in row major order) representing the property.
-
individualDistances
Computes the distances between a unit of the map and its neighbours. The image will contain more pixels than the number of neurons in the givenmap
because each neuron has 8 neighbours. The value zero will be stored in the pixels corresponding to the location of a map unit.- Parameters:
map
- Map.- Returns:
- an image representing the individual distances.
-
averageDistances
Computes the distances between a unit of the map and its neighbours.- Parameters:
map
- Map.- Returns:
- an image representing the average distances.
-