Error in mapminmax.reverse

2 ビュー (過去 30 日間)
fariha Shahid
fariha Shahid 2021 年 3 月 29 日
回答済み: Harshavardhan 2025 年 4 月 4 日
Hello everyone,
I am working on ANN code and I have to predict 365 data points ahead. I am scaling up the data between -1 and 1 using mapminmax command. The problem is that input data points are 150000 in number where as the predicted output has 365 data points. Thus I am facing a mismatch in dimension when applying reverse mapminmax command.
Data=load('Karachi_corr.csv');
length(Data);
x= Data(:,1:11);
y= Data(:,12);
[x2,PS] = mapminmax(x); % (150000x11)
y2 = mapminmax('apply',y,PS); % (150000x1)
% ANN Code
yPred_rev = mapminmax('reverse',yPred2,PS); % (365x1) double
Errors that it is giving me are
Error using bsxfun
Non-singleton dimensions of the two input arrays must match each other.
Error in mapminmax.reverse (line 7)
x = bsxfun(@rdivide,x,settings.gain);
Error in nnet7.process_fcn (line 41)
out1 = info.reverse(in2,out2);
Error in mapminmax (line 46)
y = nnet7.process_fcn(mfilename,x,varargin{:});
Error in ANN_Func (line 130)
yPred_rev = mapminmax('reverse',yPred2,PS);

回答 (1 件)

Harshavardhan
Harshavardhan 2025 年 4 月 4 日
To address the dimension mismatch issue in your ANN prediction, ensure you scale your input and output separately using "mapminmax".
[x2, PSx] = mapminmax(x'); % Transpose for compatibility
[y2, PSy] = mapminmax(y'); % Transpose for compatibility
% ANN Code to predict yPred2
% Reverse scaling of predicted output
yPred_rev = mapminmax('reverse', yPred2, PSy);
For more information on “mapminmax” you can type the following command in a MALTAB command window
doc mapminmax
Hope this helps.

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by