cogdl.models.emb.hin2vec

Module Contents

Classes

Hin2vec_layer

RWgraph

Hin2vec

The Hin2vec model from the `”HIN2Vec: Explore Meta-paths in Heterogeneous Information Networks for Representation Learning”

class cogdl.models.emb.hin2vec.Hin2vec_layer(num_node, num_relation, hidden_size, cpu)[source]

Bases: torch.nn.Module

regulartion(self, embr)[source]
forward(self, x, y, r, l)[source]
get_emb(self)[source]
class cogdl.models.emb.hin2vec.RWgraph(nx_G, node_type=None)[source]
_walk(self, start_node, walk_length)[source]
_simulate_walks(self, walk_length, num_walks)[source]
data_preparation(self, walks, hop, negative)[source]
class cogdl.models.emb.hin2vec.Hin2vec(hidden_dim, walk_length, walk_num, batch_size, hop, negative, epochs, lr, cpu=True)[source]

Bases: cogdl.models.BaseModel

The Hin2vec model from the “HIN2Vec: Explore Meta-paths in Heterogeneous Information Networks for Representation Learning” paper.

Args:

hidden_size (int) : The dimension of node representation. walk_length (int) : The walk length. walk_num (int) : The number of walks to sample for each node. batch_size (int) : The batch size of training in Hin2vec. hop (int) : The number of hop to construct training samples in Hin2vec. negative (int) : The number of nagative samples for each meta2path pair. epochs (int) : The number of training iteration. lr (float) : The initial learning rate of SGD. cpu (bool) : Use CPU or GPU to train hin2vec.

static add_args(parser)[source]

Add model-specific arguments to the parser.

classmethod build_model_from_args(cls, args)[source]

Build a new model instance.

train(self, G, node_type)[source]