beacon-biosignals / LighthouseFlux.jl

An adapter package that implements Lighthouse's framework interface for Flux
MIT License
1 stars 1 forks source link

add weight and gradient logging #35

Closed ericphanson closed 2 years ago

ericphanson commented 2 years ago

Needs Lighthouse v0.14.6 and tests!

This PR uses the new log_arrays! Lighthouse logging interface function in order to log out weights and gradients during the course of training. The default for log_arrays! is to simply log the means, but that is up to the logger to implement based on what they can accomodate.

This uses a function fforeach_keys which I based on Functors.fmap, and discussed here: https://julialang.zulipchat.com/#narrow/stream/238249-machine-learning/topic/.60fmap.60.20with.20keys.3F.

Functors.jl provides an @functor macro which is the way Flux models declare their structure. This defines a children function to walk the model. We use that here in order to find the weights and gradients to log.

Closes https://github.com/beacon-biosignals/LighthouseFlux.jl/issues/33 incidentally