generatePlot {somhca}R Documentation

Generate SOM Visualization Plots

Description

Creates various types of plots to visualize and evaluate the trained SOM model.

Usage

generatePlot(model, plot_type, data = NULL)

Arguments

model

A trained SOM model object.

plot_type

An integer specifying the type of plot to generate. Options are:

1

Training progress plot (changes during training).

2

Node count plot (number of samples mapped to each node) for assessing map quality.

3

U-matrix plot (visualizing similarities between neighboring nodes).

4

Weight vector plot (patterns in the distributions of variables).

5

Kohonen heatmaps for all variables in the dataset (distribution of single variables across the map).

data

A preprocessed data matrix containing the input data. Required only for 'plot_type = 5'.

Value

A plot or a series of plots is generated and displayed based on the specified type.

Examples

# Create a toy matrix with 9 columns and 100 rows
data <- matrix(rnorm(900), ncol = 9, nrow = 100)  # 900 random numbers, 100 rows, 9 columns

# Assign column names to the data matrix
colnames(data) <- paste("Var", 1:ncol(data), sep = "_")

# Run the finalSOM function with the mock data
model <- finalSOM(data, dimension = 6, iterations = 700)

# Generate plots using the mock model
generatePlot(model, plot_type = 2)
generatePlot(model, plot_type = 5, data)

[Package somhca version 0.2.0 Index]