Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions contextualized/dags/losses.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ def dag_loss_dagma(W, s=1, alpha=0.0, **kwargs):

def dag_loss_poly_indiv(w):
d = w.shape[-1]
return torch.trace(torch.eye(d) + (1 / d) * torch.matmul(w, w)) - d
return torch.trace((torch.eye(d) + (1 / d) * torch.matmul(w, w))^d) - d


def dag_loss_poly(W, **kwargs):
"""DAG loss on batched networks W using the
h_poly form: h_poly(W) = Tr((I + 1/d(W*W)^d) - d
h_poly form: h_poly(W) = Tr((I + 1/d(W*W))^d) - d
"""
return torch.mean(torch.Tensor([dag_loss_poly_indiv(w) for w in W]))

Expand Down