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.

CheckProperties.m 3.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. clear;
  2. clc;
  3. %affinity calculation types
  4. % affinity_calculation_shortest_path = 0;
  5. % affinity_calculation_euclid = 1;
  6. % affinity_calculation_common_friends = 2;
  7. % affinity_calculation_random_clustering = 3;
  8. % affinity_calculation_adamic_adar = 4;
  9. % affinity_calculation_katz_beta_0_5 = 5;
  10. % affinity_calculation_katz_beta_0_05 = 6;
  11. % affinity_calculation_katz_beta_0_005 = 7;
  12. affinities = 3; %%[2,3,4,6]; %3,4]; %,6];
  13. num_missing_nodes_arr = 11; %%[11 21 31 41 50]; %%5:5:30; %10:10:50; %%[11 21 31 41 50]; %10:10:50;
  14. percentKnownPHsVec = 1;
  15. datasetDir = 'D:/SocialNets/Steam/Results_Test/FF75_50Att/' ;
  16. results_dir = strcat(datasetDir,'GED_25w3/test/');
  17. filePrefix = 'Steam_*';
  18. netSizes = 1000; %%[2048];
  19. runAlgFlag = 1;
  20. debugFlag = 0;
  21. dumpFlag = 0;
  22. numThreshold = 0;
  23. maxAttStat = 0.25; % use this attribute only if it appears less than this percentage
  24. numAttrCols = 50;
  25. attSelected = ones(1,numAttrCols);
  26. %selectedAttr(1) = 0; %skip country
  27. attWeight = 0.3;
  28. %skip all games
  29. for gm=2:1:11
  30. selectedAttr(1) = 0;
  31. end
  32. date_now = clock;
  33. date_now = strcat(num2str(date_now(1)),'_',num2str(date_now(2)),'_', num2str(date_now(3)),'_', num2str(date_now(4)), num2str(date_now(5)),'_', num2str(date_now(6)));
  34. LogMsg(sprintf('%s Strating CheckProperties ...',date_now));
  35. for nodes = netSizes
  36. prefix = sprintf('%s%s%d_%s',datasetDir,filePrefix,nodes,'*.mat');
  37. files = dir(prefix);
  38. firstIter = 1;
  39. for iter = 1 %1:2 %100 % loop over same network with different missing nodes
  40. for i = 1:size(files,1) % loop over the list of networks
  41. file = files(i).name;
  42. attFile = strrep(file, '.txt.mat', '.usr.txt');
  43. [attributes, attUpperRange, attSelected, attStat] = PrepareAttributes2(datasetDir, attFile, nodes, numAttrCols, maxAttStat, attSelected);
  44. if runAlgFlag == 1
  45. date_now = clock;
  46. date_now = strcat(num2str(date_now(1)),'_',num2str(date_now(2)),'_', num2str(date_now(3)),'_', num2str(date_now(4)), num2str(date_now(5)),'_', num2str(date_now(6)));
  47. % make sure dump & results directories exist
  48. if (firstIter == 1 && i == 1)
  49. firstIter = 0;
  50. if isdir(results_dir) == 0
  51. mkdir(results_dir);
  52. end
  53. dump_data_dir = sprintf('%sdumpPropertiesData_%s/', results_dir, date_now);
  54. if isdir(dump_data_dir) == 0
  55. mkdir(dump_data_dir)
  56. end
  57. end
  58. fprintf('reading network information from file %s%s ...\n', datasetDir, file);
  59. load(strcat(datasetDir, file), 'data');
  60. % pre process attributes (translate to binary attributes)
  61. [attData, totalAttNum] = PreProcessDataAttributes(data, attributes, attUpperRange);
  62. % Calc Attributes Affinity - similarity score
  63. fprintf('calculating attribtes affinity matrix...\n');
  64. [attAffinity] = CalcAttributesAffinity(attData, nodes, 0, 0);
  65. % save Attributes Affinity
  66. fileSuffix = strrep(file, '.txt.mat', '');
  67. out_file = sprintf('%sPropertiesData40_%s', dump_data_dir, fileSuffix);
  68. SavePropertiesData(out_file, data, attAffinity);
  69. %LogMsg(sprintf('Results for file %s,iter %d at %s',file,iter,out_file));
  70. %fprintf('Completed RunExperiment cycle - results at %s.\n',out_file);
  71. end
  72. % beep;
  73. end
  74. end
  75. end
  76. LogMsg(sprintf('%s Completed RunExperiment.',date_now));