apollon.som.plot module¶
apollon/som/plot.py
Plotting functions for SOMs.
Licensed under the terms of the BSD-3-Clause license. Copyright (C) 2019 Michael Blaß mblass@posteo.net
-
apollon.som.plot.
cluster_by
(ax: matplotlib.axes._axes.Axes, som, data: numpy.ndarray, target: numpy.ndarray, **kwargs) → None¶ Plot bmu colored by
traget
.- Parameters
ax – Axis subplot.
som – SOM instance.
data – Input data.
target – Target labels.
-
apollon.som.plot.
component
(ax: matplotlib.axes._axes.Axes, som, comp: int, outline: bool = False, **kwargs) → None¶ Plot a component plane.
- Parameters
ax – Axis subplot.
som – SOM instance.
comp – Component number.
-
apollon.som.plot.
hit_counts
(ax: matplotlib.axes._axes.Axes, som, transform: Optional[Callable] = None, **kwargs) → None¶ Plot the winner histogram.
Each unit is colored according to the number of times it was bmu.
- Parameters
ax – Axis subplot.
som – SOM instance.
mode – Choose either ‘linear’, or ‘log’.
-
apollon.som.plot.
label_target
(ax: matplotlib.axes._axes.Axes, som, data: numpy.ndarray, target: numpy.ndarray, **kwargs) → None¶ Add target labels for each bmu.
- Parameters
ax – Axis subplot.
som – SOM instance.
data – Input data.
target – Target labels.
-
apollon.som.plot.
qerror
(ax: matplotlib.axes._axes.Axes, som, **kwargs) → None¶ Plot quantization error.
-
apollon.som.plot.
umatrix
(ax: matplotlib.axes._axes.Axes, som, outline: bool = False, **kwargs) → None¶ Plot the U-matrix.
- Parameters
ax – Axis subplot.
som – SOM instance.
Note
Figure aspect is set to ‘eqaul’.
-
apollon.som.plot.
wire
(ax: matplotlib.axes._axes.Axes, som, unit_size: Union[int, float, numpy.ndarray] = 100.0, line_width: Union[int, float] = 1.0, highlight: Optional[numpy.ndarray] = None, labels: bool = False, **kwargs) → None¶ Plot the weight vectors of a SOM with two-dimensional feature space.
Neighbourhood relations are indicate by connecting lines.
- Parameters
ax – The axis subplot.
som – SOM instance.
unit_size – Size for each unit.
line_width – Width of the wire lines.
highlight – Index of units to be marked in different color.
labels – If
True
, attach a box with coordinates to each unit.
- Returns
vlines, hlines, bgmarker, umarker