libcity.model.road_representation.DeepWalk

class libcity.model.road_representation.DeepWalk.DeepWalk(config, data_feature)[source]

Bases: libcity.model.abstract_traffic_tradition_model.AbstractTraditionModel

run(data=None)[source]
Parameters

data – input of tradition model

Returns

output of tradition model

class libcity.model.road_representation.DeepWalk.Graph[source]

Bases: collections.defaultdict

adjacency_iter()[source]
check_self_loops()[source]
degree(nodes=None)[source]
has_edge(v1, v2)[source]
make_consistent()[source]
make_undirected()[source]
nodes()[source]
number_of_edges()[source]

Returns the number of nodes in the graph

number_of_nodes()[source]

Returns the number of nodes in the graph

order()[source]

Returns the number of nodes in the graph

random_walk(path_length, alpha=0, rand=<random.Random object>, start=None)[source]

Returns a truncated random walk. path_length: Length of the random walk. alpha: probability of restarts. start: the start node of the random walk.

remove_self_loops()[source]
subgraph(nodes={})[source]
libcity.model.road_representation.DeepWalk.build_deepwalk_corpus(G, num_paths, path_length, alpha=0, rand=<random.Random object>)[source]
libcity.model.road_representation.DeepWalk.from_numpy(x, directed=False)[source]
libcity.model.road_representation.DeepWalk.learn_embeddings(walks, dimensions, window_size, workers, iters, min_count=0, sg=1, hs=0)[source]