% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/test_AE.R
\name{test_AE}
\alias{test_AE}
\title{Evaluate Autoencoder Model on Test Data}
\usage{
test_AE(args, model, dataloader_test)
}
\arguments{
\item{args}{A list of arguments, typically containing configurations such as whether to use CUDA for computation.}

\item{model}{A trained autoencoder model that will be evaluated. The model is expected to have a \code{forward} method that takes input data and a mode (e.g., "autoencoder").}

\item{dataloader_test}{A list representing the test data loader. Each element in the list should be a batch containing test data that the model will evaluate.}
}
\value{
A numeric value representing the mean test error (MSE) across all batches in the test dataset.
}
\description{
This function evaluates the performance of an autoencoder model on a test dataset, calculating the mean squared error (MSE) between the original inputs and the reconstructed outputs.
}
\details{
The \code{test_AE} function performs the following steps:
\enumerate{
\item Initializes the mean squared error (MSE) loss criterion.
\item Sets the model to evaluation mode to ensure layers like dropout are appropriately handled.
\item Iterates over the test data batches provided by \code{dataloader_test}.
\item For each batch, the function:
\itemize{
\item Extracts the data, ensuring it is in numeric format and reshapes it as necessary.
\item Converts the data into torch tensors, moving them to CUDA if specified.
\item Performs a forward pass through the model in autoencoder mode, obtaining both the encoded representation and the reconstructed output.
\item Computes the MSE loss between the input and the reconstructed output.
\item Accumulates the loss for each batch.
}
\item Computes the mean of the accumulated losses to return the overall test error.
}
}
\examples{
\donttest{
## Called internally by DICEr() after each autoencoder warm-up epoch.
## Requires a trained EncoderRNN/DecoderRNN model; see ?DICEr.
}
}
