loops - out of memory in matlab run time -
i wrote code in matlab r2014a predicting target user rate target item. in method assign weight items computing item similarity between target item , each of corated items between target user , user. after computing items similarities (isim) , catch memory should compute user similarities base on isim. face out of memory error. have 1206 user , 1508 item in dataset. traindata = 1206x1508 isim = 1508x1508 isim , user similarity formulas below:
(isim)
(user similarity respect isim)
and code below
load('isim.mat'); isim2 = isim.^2; = 1 : size(traindata,1) target_user = traindata(i,:); mean_target_user = repmat(mean(target_user),length(target_user),1); k = i+1 : size(traindata,1) second_user = traindata(k,:); mean_second_user = repmat(mean(second_user),length(second_user),1); z = 1 : size(isim , 1) pearson{i,k}{z} = sum(isim(z,:) .*(target_user - (mean_target_user')).*(second_user - (mean_second_user')))/sqrt((sum(isim(z,:) .*(target_user - (mean_target_user')).^2)))*sqrt(sum((isim(z,:).*(second_user - (mean_second_user')).^2))); mean(target_user))*(traindata(k,z)-mean(traindata(k,:)))/sqrt(isim(j,z)*(traindata(i,z)-mean(target_user))^2)*sqrt(isim{j}(z)*(traindata(k,z)-mean(traindata(k,:)))^2); end end end
Comments
Post a Comment