out of memory in matlab run time

75 views Asked by At

I wrote code in matlab r2014a for predicting target user rate to the target item. in my method i assign weight to the items by computing item similarity between target item and each of corated items between target user and another user. after i computing items similarities (ISIM) and catch it to memory should compute user similarities base on isim. but i face with out of memory error. i have 1206 user and 1508 item in my dataset. traindata = 1206x1508 isim = 1508x1508 isim and user similarity formulas are as below:

enter image description here(isim)

enter image description here(user similarity with respect to isim)

and my code is below

load('isim.mat');
        isim2 = isim.^2;
        for i = 1 : size(traindata,1)
            target_user = traindata(i,:);
            mean_target_user = repmat(mean(target_user),length(target_user),1);
             for k = i+1 : size(traindata,1)
                 second_user = traindata(k,:);
                 mean_second_user = repmat(mean(second_user),length(second_user),1);
                 for 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
0

There are 0 answers