How can I normalize data between 0 and 1 ? I want to use logsig...
Mostra commenti meno recenti
All is in the question: I want to use logsig as a transfer function for the hidden neurones so I have to normalize data between 0 and 1. The mapminmax function in NN tool box normalize data between -1 and 1 so it does not correspond to what I'm looking for.
Risposta accettata
Più risposte (4)
Jurgen
il 15 Mag 2013
NDATA = mat2gray(DATA);
2 Commenti
JohnDylon
il 8 Ott 2016
Is this exactly a min-max normalizaton?
Greg Heath
il 8 Ott 2016
Modificato: Greg Heath
il 8 Ott 2016
Why not just try it and find out?
close all, clear all, clc
[ x1 , t1 ] = simplefit_dataset;
DATA1 = [ x1, t1 ];
DATA2 = [ x1; t1 ];
whos DATA1 DATA2
minmax1 = minmax(DATA1)
minmax2 = minmax(DATA2)
minmaxMTG1 = minmax( mat2gray(DATA1) )
minmaxMTG2 = minmax( mat2gray(DATA2) )
Hope this helps.
Greg
Abhijit Bhattacharjee
il 25 Mag 2022
As of MATLAB R2018a, there is an easy one-liner command that can do this for you. It's called NORMALIZE.
Here is an example, where a denotes the vector of data:
a_normalized = normalize(a, 'range');
1 Commento
shazia
il 10 Ago 2023
How about denormalization what comand should we use to denormalize after training to calculate the error. please guide
Greg Heath
il 11 Mag 2017
Modificato: Greg Heath
il 11 Mag 2017
I like to calculate min, mean, std and max to detect outliers with standardized data (zero mean/unit variance). For normalization and denormalization I just let the training function use defaults
tansig and linear
however, if the ouput is naturally bounded use
tansig and tansig
or
tansig and logsig
In short, unless you are plotting you don't have to worry about anything except outliers.
Hope this helps.
Greg
Angus Steele
il 20 Set 2017
function [ newValue ] = math_scale_values( originalValue, minOriginalRange, maxOriginalRange, minNewRange, maxNewRange )
% MATH_SCALE_VALUES
% Converts a value from one range into another
% (maxNewRange - minNewRange)(originalValue - minOriginalRange)
% y = ----------------------------------------------------------- + minNewRange
% (maxOriginalRange - minOriginalRange)
newValue = minNewRange + (((maxNewRange - minNewRange) * (originalValue - minOriginalRange))/(maxOriginalRange - minOriginalRange));
end
Categorie
Scopri di più su Define Shallow Neural Network Architectures in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!