% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/optimalSOM.R
\name{optimalSOM}
\alias{optimalSOM}
\title{Estimate Optimal SOM Grid Size based on the Data}
\usage{
optimalSOM(data, method = "A", increments = 1, iterations = NULL)
}
\arguments{
\item{data}{Matrix containing numeric data. A preprocessed data matrix containing the input data for SOM training. Argument is required.}

\item{method}{Character or integer. Method for estimating the maximum grid dimension. One of:
\describe{
  \item{"A"}{Uses the heuristic formula by Vesanto et al. (default).}
  \item{"B"}{Applies an alternative heuristic approach.}
  \item{numeric}{Manually specified maximum dimension.}
}}

\item{increments}{Integer. Step size for increasing grid dimensions.
For example, set increments to 2 or 5 to increment the grid size by 2 or 5 rows/columns at each step.
Smaller increments lead to more granular searches but may increase computation time;
larger increments risk errors if they exceed the estimated maximum SOM grid dimensions.
Default is 1.}

\item{iterations}{Integer. Number of iterations (`rlen`) for SOM training.
If set to NULL (default), the function automatically calculates a sensible number
of iterations based on the dataset size.
If you want to override this, you can provide a numeric value.
A lower value, such as less than 500, helps reduce computation time—if the process takes too long or an error occurs, try reducing the number of iterations for quicker results.}
}
\value{
A data frame summarizing optimal SOM grid dimensions and suggested iterations for each quality measure.
  Use these results to select the most suitable grid size for your SOM.
}
\description{
Computes the optimal grid size for training a SOM using various quality
measures and heuristic approaches.
}
\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

# Run the optimalSOM function with the mock data
myOptimalSOM <- optimalSOM(data, method = "A", increments = 2, iterations = 300)

}
