Python utils.graph_reader() Examples

The following are 7 code examples of utils.graph_reader(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module utils , or try the search function .
Example #1
Source File: main.py    From GraphWaveletNeuralNetwork with GNU General Public License v3.0 7 votes vote down vote up
def main():
    """
    Parsing command line parameters, reading data.
    Doing sparsification, fitting a GWNN and saving the logs.
    """
    args = parameter_parser()
    tab_printer(args)
    graph = graph_reader(args.edge_path)
    features = feature_reader(args.features_path)
    target = target_reader(args.target_path)
    sparsifier = WaveletSparsifier(graph, args.scale, args.approximation_order, args.tolerance)
    sparsifier.calculate_all_wavelets()
    trainer = GWNNTrainer(args, sparsifier, features, target)
    trainer.fit()
    trainer.score()
    save_logs(args, trainer.logs) 
Example #2
Source File: main.py    From MixHop-and-N-GCN with GNU General Public License v3.0 6 votes vote down vote up
def main():
    """
    Parsing command line parameters, reading data.
    Fitting an NGCN and scoring the model.
    """
    args = parameter_parser()
    torch.manual_seed(args.seed)
    tab_printer(args)
    graph = graph_reader(args.edge_path)
    features = feature_reader(args.features_path)
    target = target_reader(args.target_path)
    trainer = Trainer(args, graph, features, target, True)
    trainer.fit()
    if args.model == "mixhop":
        trainer.evaluate_architecture()
        args = trainer.reset_architecture()
        trainer = Trainer(args, graph, features, target, False)
        trainer.fit() 
Example #3
Source File: main.py    From EgoSplitting with GNU General Public License v3.0 5 votes vote down vote up
def main():
    """
    Parsing command line parameters, creating EgoNets.
    Creating a partition of the persona graph. Saving the memberships.
    """
    args = parameter_parser()
    tab_printer(args)
    graph = graph_reader(args.edge_path)
    splitter = EgoNetSplitter(args.resolution)
    splitter.fit(graph)
    membership_saver(args.output_path, splitter.overlapping_partitions) 
Example #4
Source File: main.py    From Splitter with GNU General Public License v3.0 5 votes vote down vote up
def main():
    """
    Parsing command line parameters.
    Reading data, embedding base graph, creating persona graph and learning a splitter.
    Saving the persona mapping and the embedding.
    """
    args = parameter_parser()
    torch.manual_seed(args.seed)
    tab_printer(args)
    graph = graph_reader(args.edge_path)
    trainer = SplitterTrainer(graph, args)
    trainer.fit()
    trainer.save_embedding()
    trainer.save_persona_graph_mapping() 
Example #5
Source File: main.py    From ClusterGCN with GNU General Public License v3.0 5 votes vote down vote up
def main():
    """
    Parsing command line parameters, reading data, graph decomposition, fitting a ClusterGCN and scoring the model.
    """
    args = parameter_parser()
    torch.manual_seed(args.seed)
    tab_printer(args)
    graph = graph_reader(args.edge_path)
    features = feature_reader(args.features_path)
    target = target_reader(args.target_path)
    clustering_machine = ClusteringMachine(args, graph, features, target)
    clustering_machine.decompose()
    gcn_trainer = ClusterGCNTrainer(args, clustering_machine)
    gcn_trainer.train()
    gcn_trainer.test() 
Example #6
Source File: main.py    From APPNP with GNU General Public License v3.0 5 votes vote down vote up
def main():
    """
    Parsing command line parameters, reading data, fitting an APPNP/PPNP and scoring the model.
    """
    args = parameter_parser()
    torch.manual_seed(args.seed)
    tab_printer(args)
    graph = graph_reader(args.edge_path)
    features = feature_reader(args.features_path)
    target = target_reader(args.target_path)
    trainer = APPNPTrainer(args, graph, features, target)
    trainer.fit() 
Example #7
Source File: main.py    From EdMot with GNU General Public License v3.0 5 votes vote down vote up
def main():
    """
    Parsing command line parameters, reading data, fitting EdMot and scoring the model.
    """
    args = parameter_parser()
    tab_printer(args)
    graph = graph_reader(args.edge_path)
    model = EdMot(graph, args.components, args.cutoff)
    memberships = model.fit()
    membership_saver(args.membership_path, memberships)