Example #1
0
 def do_load_synthetic_data(self, filePath, evaluate=False):
     """
     Load synthetic data
     :param filePath: the path of the folder where
     :param evaluate: boolean operator whether to evaluate data or not
     :return:
     """
     if not filePath:
         filePath = "/home/lias/Dropbox/Msc/thesis/src/NEW/synthetic-data-generator/src/expand/"
         #filePath = "data/synthetic/expand"
     sd = SyntheticDataConverter(filePath)
     self.graphs = sd.graphs
     self.ground_comms = sd.comms
     self.timeFrames = sd.timeFrames
     self.timeline = sd.get_timeline()
     self.type = sd.type
     print "Synthetic data have been successfully loaded!"
     if evaluate:
         Evaluation(sd)
     return
Example #2
0
    pprint.pprint(mutu3.dynamic_coms, stream=f, width=150)
    f.close()
    return all_res


if __name__ == "__main__":
    import sys
    if len(sys.argv) > 1:
        folder = sys.argv[1]
    else:
        folder = "merge_split_data"
    from os.path import expanduser
    home = expanduser("~")
    path_full = home + "/Dropbox/Msc/thesis/data/synthetic_generator/data/" + folder
    results_file = "results_synthetic_" + path_full.split("/")[-1] + ".txt"
    sd = SyntheticDataConverter(path_full, remove_redundant_nodes=True)
    # nodes = sd.graphs[0].nodes()
    # # edges_1 = random.sample(list(combinations_with_replacement(nodes, 2)), 50)
    # # edges_2 = random.sample(list(combinations_with_replacement(nodes, 2)), 207)
    #  ---------------------------------
    #Dynamic Network Generator data (50 nodes/3 tfs)
    number_of_dynamic_communities = len(sd.graphs[0])
    data = Data(comms=sd.comms,
                graphs=sd.graphs,
                timeFrames=len(sd.graphs),
                number_of_dynamic_communities=len(sd.dynamic_truth),
                dynamic_truth=sd.dynamic_truth)
    #  ---------------------------------
    #Dynamic Network Generator data (50 nodes/3 tfs) - Same network everywhere except one tf
    # dict = {
    #     0: sd.graphs[0],