Exemplo n.º 1
0
 def compute_metrics(self, embeddings, data, split):
     idx = data[f'idx_{split}']
     output = self.decode(embeddings, data['adj_train_norm'], idx)
     loss = F.nll_loss(output, data['labels'][idx], self.weights)
     acc, f1 = acc_f1(output, data['labels'][idx], average=self.f1_average)
     metrics = {'loss': loss, 'acc': acc, 'f1': f1}
     return metrics
Exemplo n.º 2
0
 def compute_metrics(self, embeddings, data, split):
     idx = data[f'idx_{split}']
     output = self.decode(embeddings, data['adj_train_norm'], idx)
     loss = cb_loss(
         data['labels'][idx], output, self.beta, self.gamma,
         data['labels'][idx].unique(return_counts=True)[1].tolist())
     acc, f1, recall = acc_f1(output,
                              data['labels'][idx],
                              split,
                              average=self.f1_average)
     metrics = {'loss': loss, 'acc': acc, 'f1': f1, 'recall': recall}
     return metrics