Skip to content

Commit

Permalink
adds FIM helper for regression (a.k.a. Gauss Newton)
Browse files Browse the repository at this point in the history
  • Loading branch information
tfjgeorge committed Jul 29, 2020
1 parent 280ba08 commit 815bb1c
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions nngeometry/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,18 @@ def function(*d):
probs = softmax(logits, dim=1).detach()
return (logits * probs**.5 * (1 - probs))

generator = Jacobian(layer_collection=layer_collection,
model=model,
loader=loader,
function=function,
n_output=n_output)
return representation(generator)
elif variant == 'regression':

def function(*d):
inputs = d[0].to(device)
estimates = model(inputs)
return estimates
else:
raise NotImplementedError

generator = Jacobian(layer_collection=layer_collection,
model=model,
loader=loader,
function=function,
n_output=n_output)
return representation(generator)

0 comments on commit 815bb1c

Please sign in to comment.