cogdl.models.nn.dgi

Module Contents

Functions

preprocess_features(features)

Row-normalize feature matrix and convert to tuple representation

normalize_adj(adj)

Symmetrically normalize adjacency matrix.

sparse_mx_to_torch_sparse_tensor(sparse_mx)

Convert a scipy sparse matrix to a torch sparse tensor.

class cogdl.models.nn.dgi.GCN(in_ft, out_ft, act, bias=True)[source]

Bases: torch.nn.Module

weights_init(self, m)[source]
forward(self, seq, adj, sparse=False)[source]
class cogdl.models.nn.dgi.AvgReadout[source]

Bases: torch.nn.Module

forward(self, seq, msk)[source]
class cogdl.models.nn.dgi.Discriminator(n_h)[source]

Bases: torch.nn.Module

weights_init(self, m)[source]
forward(self, c, h_pl, h_mi, s_bias1=None, s_bias2=None)[source]
class cogdl.models.nn.dgi.LogReg(ft_in, nb_classes)[source]

Bases: torch.nn.Module

weights_init(self, m)[source]
forward(self, seq)[source]
class cogdl.models.nn.dgi.LogRegTrainer[source]

Bases: object

train(self, data, labels, opt)[source]
class cogdl.models.nn.dgi.DGIModel(n_in, n_h, activation)[source]

Bases: torch.nn.Module

forward(self, seq1, seq2, adj, sparse, msk, samp_bias1, samp_bias2)[source]
embed(self, seq, adj, sparse, msk)[source]
cogdl.models.nn.dgi.preprocess_features(features)[source]

Row-normalize feature matrix and convert to tuple representation

cogdl.models.nn.dgi.normalize_adj(adj)[source]

Symmetrically normalize adjacency matrix.

cogdl.models.nn.dgi.sparse_mx_to_torch_sparse_tensor(sparse_mx)[source]

Convert a scipy sparse matrix to a torch sparse tensor.

class cogdl.models.nn.dgi.DGI(nfeat, nhid, nclass, max_epochs)[source]

Bases: cogdl.models.BaseModel

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, data)[source]