Modularization as Estimators
I promised to share a repo with modularized estimators in notebooks:
https://github.com/wendli01/abres_gcn is not perfect but it does two things:
The LinkPredictor
class LinkPredictor(GCNEstimator):
def __init__(self, nb_epochs=200, loss_criterion=cross_entropy_loss, optimizer_cls=th.optim.Adam, lr: float = 0.01,
weight_decay: float = 0.02, verbose: bool = False, device: Optional[str] = 'cuda',
scoring: callable = average_precision_score, node_feat_attr: str = 'type',
random_state: Union[int, np.random.RandomState, int] = 42, neg_ratio: int = 1,
lr_scheduler_cls=th.optim.lr_scheduler.ExponentialLR, lr_scheduler_kwargs=dict(gamma=1.0),
dense_layer_sizes=(), decoder=LinkDecoderModule(), full_negative_sampling: bool = False,
validation_size: float = 0, **model_kwargs):
has modules for e.g. the decoder, and it is pretty easy to use in a notebook (with some kwargs
magic to change the conv layer class):
a_gcn = LinkPredictor(node_feat_attr='feat', dropout=0, conv_cls=dgl.nn.GraphConv, skip_connections=False)
a_gcn_scores = cv_score_link_prediction(a_gcn, citeseer);