|
123456789101112131415161718192021222324252627282930 |
- function [dataWithAtt, totalAttNum] = CombineDataWithAttributes3(data, attData, attWeight)
-
- totalAttNum = size(attData,2);
- sizeWithAtt = totalAttNum + size(data,1);
- dataWithAtt = sparse(sizeWithAtt, sizeWithAtt);
- dataWithAtt(totalAttNum+1:end,totalAttNum+1:end) = data;
-
- dataLines = size(data,1);
- attLines = size(attData,1);
- if (attLines ~= dataLines)
- fprintf('CombineDataWithAttributes - Invalid data sizes: data %d, attributes %d\n',dataLines,attLines);
- end
-
- % Sigal 1.3.13: normalizeWeight
- % make sure that ratio att/link is same w/1-w
- if attWeight < 1 && attWeight >= 0
- normalizeWeight = attWeight/(1-attWeight);
- else
- normalizeWeight = 1;
- end
- for line=1:dataLines
- nnzAtt = find(attData(line,:));
- for att = nnzAtt
- dataWithAtt(totalAttNum+line,att)=normalizeWeight;
- dataWithAtt(att,totalAttNum+line)=normalizeWeight;
- end
- end
-
- dataWithAtt = sparse(dataWithAtt);
-
|