You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CreateNewNodesFromClusters.m 945B

5 years ago
12345678910111213141516171819202122232425262728293031323334
  1. function [newNodes] = CreateNewNodesFromClusters(data, test_clustering, noiseNumAddedPHs)
  2. % Sigal 5.12.13:
  3. % add additinal parameters noiseNumAddedPHs
  4. % if noiseNumAddedPHs > 0, i.e. the last # PHs are noise
  5. % thus need to be ignored
  6. % sigal - backwards compatibility
  7. if nargin < 3
  8. noiseNumAddedPHs = 0;
  9. end
  10. if noiseNumAddedPHs < 0
  11. fprintf('>>>> ERROR: CreateNewNodesFromClusters - Invalid noiseNumAddedPHs=%d !!!!\n',noiseNumAddedPHs);
  12. return;
  13. end
  14. n = size(data,2)-noiseNumAddedPHs;
  15. m = max(test_clustering);
  16. newNodes = sparse(m,n);
  17. last_known_node = n - size(test_clustering,1);
  18. for i = 1 : size(test_clustering,1)
  19. current_cluster = test_clustering(i);
  20. % folding all the placeholders rows of the same cluster into one row (by
  21. % using "OR" between them)
  22. newNodes(current_cluster, 1:n) = newNodes(current_cluster, 1:n) | data(last_known_node + i, 1:n);
  23. end
  24. end