how to get aic from gapfill function?

조회 수: 2 (최근 30일)
Peter Mills
Peter Mills 2018년 7월 2일
편집: Peter Mills 2018년 7월 2일
How do I get the values of aic for MATLAB gapfill function?
load mtlb
gn = 3;
mt = mtlb;
gl = randi([300 600],gn,1);
for kj = 1:gn
mt(kj*1000+randi(100)+(1:gl(kj))) = NaN;
end
lb = fillgaps(mt,4001,'aic');
How do I get the aic values that were used to optimize for model as outputs? How do I get the mae and rmse of the accuracy of each prediction of missing values?
I have tried a for loop of model order but it works out very slow.
order=1:4001;
MAEmetric=length(order);
RMSEmetric=length(order);
for i=1:4001
lb = fillgaps(mt,4001,order(i));
MAEmetric(i)=mae(mtlb,lb);
RMSEmetric(i)=rmse(mtlb,lb);
end
The following function is required for rmse
function r=rmse(data,estimate)
% Function to calculate root mean square error from a data vector or matrix
% and the corresponding estimates.
% Usage: r=rmse(data,estimate)
% Note: data and estimates have to be of same size
% Example: r=rmse(randn(100,100),randn(100,100));
% delete records with NaNs in both datasets first
I = ~isnan(data) & ~isnan(estimate);
data = data(I); estimate = estimate(I);
r=sqrt(sum((data(:)-estimate(:)).^2)/numel(data));

답변 (0개)

카테고리

Help CenterFile Exchange에서 Monte-Carlo에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by