Mapstd is used for standardization, mapminmax is for normalization. But When to use mapstd and mapminmax? I want to do a regression(function fitting) with neural network. While I am creating the nn with nftool, it normalize the input data and target(mapminmax) automatically. So I was wondered that.
Neeta Dsouza answered .
2025-11-20
Both mapstd and mapminmax are used for transforming data before feeding it into a neural network, but they serve different purposes and are suitable for different situations. Here's a breakdown of when and why to use each of them, especially in the context of regression with neural networks.
mapstd (Standardization):Purpose: It standardizes the input data by transforming it to have a mean of 0 and a standard deviation of 1. This is useful when the data has different units or widely varying scales.
Formula:
xnew=x−μσx_{\text{new}} = \frac{x - \mu}{\sigma}where:
When to use mapstd:
mapstd when your data has different units, scales, or distributions. For example, if one feature ranges from 0 to 1 and another ranges from 0 to 1000, standardizing the data ensures that each feature contributes equally to the model.% Standardize data (mean=0, std=1) [X_standardized, settings] = mapstd(X); /pre>
mapminmax (Normalization):Purpose: It normalizes the input data by scaling it to a specified range, typically between 0 and 1. This can be useful when your features are on different scales but need to be treated equally in terms of importance.
Formula:
xnew=x−minmax−minx_{\text{new}} = \frac{x - \text{min}}{\text{max} - \text{min}}where:
When to use mapminmax:
mapminmax when you want to scale the data into a fixed range, typically [0, 1], and the neural network activation function (like the sigmoid) expects inputs in this range.Example:
% Normalize data (scale to [0, 1]) [X_normalized, settings] = mapminmax(X);
Default Behavior in nftool:
nftool for regression with a neural network, it automatically normalizes the data with mapminmax by default, scaling both the inputs and targets to the range [0, 1].How to handle normalization manually:
mapminmax to normalize the data. However, if the automatic normalization of nftool works well for your data, you may not need to do it manually.Use mapstd when:
Use mapminmax when:
mapminmax is typically preferred for neural networks, especially when using activation functions like sigmoid or tanh, because it ensures the input data is in a range that avoids saturation of the activations.mapstd is useful if you want to standardize the data, especially when the data has a Gaussian distribution or different scales across features.If you're using nftool and it automatically normalizes the data using mapminmax, it's likely best to let it do so unless you have a specific reason to manually adjust the normalization or standardization.