Пример #1
0
    def data(self):
        """
        Create AMiner Papers sFrame from the AMiner text files.
        After creating the SFrame, it is saved to the disk
        """

        return SFrame.read_json(self._dataset_dir.joinpath("AMiner/*.txt"), orient='lines')
Пример #2
0
def combine_distinct_json_graphs(json_path_iter):
    graphs = []
    c = 0
    sf = SFrame.read_json('starwars.json')
    for json_path in json_path_iter:
        with open(json_path) as f:
            g = json_graph.node_link_graph(json.load(f))
            for v in g.nodes:
                g.node[v]["year"] = str(g.graph["movie_year"])
                try:
                    g.node[v]["image_url"] = sf[sf["title"] == v]["base_images"][0]['desktop']['ratio_1x1']
                except IndexError:
                    g.node[v]["image_url"] = ""
            g = nx.convert_node_labels_to_integers(g, first_label=c, label_attribute="name")
            c += len(g.nodes)
            graphs.append(g)
    joined_graph = nx.compose_all(graphs)
    nx.write_graphml(joined_graph, f"joined_graph.graphml")