SOMPlots — Visualization
SOMPlots extends either SOM or
SOMGpu (whichever is available) with a full suite
of visualization methods. It is the recommended entry point for most users.
from NNSOM.plots import SOMPlots
som = SOMPlots((8, 8))
som.init_w(data)
som.train(data, init_neighborhood=3, epochs=200, steps=100)
fig, ax, patches = som.plot('neuron_dist')
- class NNSOM.plots.SOMPlots(dimensions)[source]
Bases:
SOMA subclass of either SOM or SOMGpu (based on the availability of CuPy), designed to provide visualization and interactive plotting capabilities for Self-Organizing Maps (SOMs). This class is intended to enrich the analysis of SOMs by offering a variety of advanced visualization techniques to explore the trained SOM topology, distribution of data points, and various statistics derived from the SOM’s learning process.
- dimensions
A Gird of the SOM topology.
- The class includes methods for plotting the topology of the SOM, generating hit histograms,
- displaying cluster information, and more. These methods support interactive features through
- mouse clicks, allowing users to engage with the visualizations dynamically. Each method
- can also handle additional parameters for customization and handles various plotting styles
- like hexagonal units, numbered neurons, color gradients, and complex cluster histograms.
- The class also provides a generic plot method to handle different types of SOM visualizations
- and an event handling method to manage user interactions during the plotting sessions.
This class supports interactivity and offers multiple visualization methods to deeply understand and analyze the behaviors and results of SOMs. It’s especially useful for gaining insights into the topology, data distribution, and classification performance of SOMs.
Constructor
Initializes the SOMPlots class with specified dimensions for the SOM grid. |
Topology plots
Plots the topology of the SOM using hexagonal units. |
|
Plots the topology of the SOM with each neuron numbered. |
Hit and distance maps
Generates a hit histogram for the SOM, which displays the frequency of data points assigned to each neuron. |
|
Generates a neuron distance plot that visualizes the distances between neighboring neurons in the SOM grid. |
|
Generates a grayscale histogram for the SOM, where the shade of each hexagon represents the corresponding value from the provided percentage array. |
Cluster and class plots
Generates a complex hit histogram for the SOM, incorporating information about cluster quality, misclassifications, and false positives/negatives. |
|
Generates a custom complex hit histogram for the SOM, allowing for flexible customization of the hexagon face colors, edge colors, and edge widths. |
|
Generates a simple grid plot that visualizes the SOM neurons as hexagons with varying sizes and colors. |
|
Generates a Neighborhood Connection Map for the SOM, displaying the connections between neighboring neurons. |
Color-coded and component maps
Generates a colored histogram for the SOM, where the color of each hexagon represents the corresponding value from the provided average array. |
|
Generates a stem plot visualization for the SOM, displaying the input data and neuron responses. |
|
Generates a pie chart visualization for the SOM, displaying the composition of each neuron's data or cluster. |
|
Generates a line plot visualization for the SOM weights, displaying the weight vectors for each neuron. |
|
Generates a histogram visualization for the SOM, displaying the data distribution within each neuron's cluster. |
|
Generates a boxplot visualization for the SOM, displaying the statistical summary of the data distribution within each neuron's cluster. |
|
Generates a violin plot visualization for the SOM, displaying the distribution of data within each neuron's cluster. |
|
Generates a scatter plot visualization for the SOM, displaying the data points assigned to each neuron and an optional regression line. |
|
Visualizes the positions of the components in a Self-Organizing Map (SOM) along with the input vectors. |
|
Visualizes the weight distribution across different features in a Self-Organizing Map (SOM) using a series of 2D plots. |
|
Visualizes the weights of a Self-Organizing Map (SOM) as images within a hexagonal grid layout. |
Interactive plot
Generic Plot Function. |