필터 지우기
필터 지우기

How can I normalize data between 0 and 1 ? I want to use logsig...

조회 수: 405 (최근 30일)
Platon
Platon 2013년 5월 13일
댓글: shazia 2023년 8월 10일
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.

채택된 답변

José-Luis
José-Luis 2013년 5월 15일
bla = 100.*randn(1,10)
norm_data = (bla - min(bla)) / ( max(bla) - min(bla) )
  댓글 수: 3
José-Luis
José-Luis 2013년 5월 15일
Yes, provided you use the same normalization bounds (the min and max of both datasets). To rescale, please look at the below code.
bla = 100.*randn(1,10)
minVal = min(bla);
maxVal = max(bla);
norm_data = (bla - minVal) / ( maxVal - minVal )
your_original_data = minVal + norm_data.*(maxVal - minVal)
Aviral Petwal
Aviral Petwal 2018년 6월 22일
No need to denormalize the data. For your Test set also you can normalize the data with the same parameters and feed it to NN. If you trained on Normalised data just normalize your test set using same parameters and feed the data to NN.

댓글을 달려면 로그인하십시오.

추가 답변 (4개)

Jurgen
Jurgen 2013년 5월 15일
NDATA = mat2gray(DATA);
  댓글 수: 2
JohnDylon
JohnDylon 2016년 10월 8일
Is this exactly a min-max normalizaton?
Greg Heath
Greg Heath 2016년 10월 8일
편집: Greg Heath 2016년 10월 8일
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
Abhijit Bhattacharjee 2022년 5월 25일
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
shazia
shazia 2023년 8월 10일
How about denormalization what comand should we use to denormalize after training to calculate the error. please guide

댓글을 달려면 로그인하십시오.


Greg Heath
Greg Heath 2017년 5월 11일
편집: Greg Heath 2017년 5월 11일
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
Angus Steele 2017년 9월 20일
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

카테고리

Help CenterFile Exchange에서 Pattern Recognition and Classification에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by