clear load X4058 [m,n]=size(X528); Mean=zeros(1,n); Dev=zeros(1,n); for i=1:n Xi=X528(1:end-1,i); Xi(Xi==0)=[]; Mean(i) = mean(Xi); Dev(i) = std(Xi); X528(X528(:,i)==0,i)=Mean(i); end
clear load ColFilData1 for k =393 index=numsort(k,1);numindex=num(index,2); items528_580=ratings(ratings(:,1)==index,2); ratings528_580=[]; for i=1:numindex items=items528_580(i); ratings528_580=[ratings528_580;ratings(ratings(:,2)==items,:)]; end items528_580=sortrows(items528_580,1); ratingsNew528_580=ratings528_580; for i=1:numindex ratingsNew528_580(ratingsNew528_580(:,2)==items528_580(i),2)=i; end ratingsNew528_580=sortrows(ratingsNew528_580,2); Labnum528=[]; num528=[]; for i=1:6040 Ai=ratings(ratingsNew528_580(:,1)==i,:); for j=1:5 Labnum528(i,j)=length(Ai(Ai(:,3)==j)); end num528(i)=length(Ai(:,1)); end num528=[[1:6040]‘,num528‘]; numsort528=sortrows(num528,-2); Xratings528_1500=[]; for i=1:1501 Xi=ratingsNew528_580(ratingsNew528_580(:,1)==numsort528(i,1),:); Xi(:,1)=i; Xratings528_1500=[Xratings528_1500;Xi]; end % Labnum528=[]; % ratings528_580=[]; % ratingsNew528_580=[]; X528=zeros(1501,numindex); for i=1:size(Xratings528_1500,1) X528(Xratings528_1500(i,1),Xratings528_1500(i,2)) = Xratings528_1500(i,3); end rate(k-40) = (size(Xratings528_1500,1)-numindex)/(1500*numindex); end [~,imax]=max(rate)
时间: 2024-10-15 20:39:35