diff options
author | Thomas Mesnard <thomas.mesnard@ens.fr> | 2015-12-28 20:51:50 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2016-04-21 10:21:42 +0200 |
commit | 072d26e766931007a0f243674f7dfdff5c3104e9 (patch) | |
tree | ae3639f4ff3f8e0e3e9767c15322171aa6f2169e /ext_param_info.py | |
parent | e8e37dee0c5c846b1aa2dd24dc99095191f72a9b (diff) | |
download | pgm-ctc-072d26e766931007a0f243674f7dfdff5c3104e9.tar.gz pgm-ctc-072d26e766931007a0f243674f7dfdff5c3104e9.zip |
Add plot
More TIMIT ; log domain
TIMIT: more complexity
Nice poster
Beautify code (mostly, add comments)
Add final stuff.
Diffstat (limited to 'ext_param_info.py')
-rw-r--r-- | ext_param_info.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/ext_param_info.py b/ext_param_info.py new file mode 100644 index 0000000..a60f9d7 --- /dev/null +++ b/ext_param_info.py @@ -0,0 +1,24 @@ +import logging + +import numpy + +import cPickle + +from blocks.extensions import SimpleExtension + +logging.basicConfig(level='INFO') +logger = logging.getLogger('extensions.ParamInfo') + +class ParamInfo(SimpleExtension): + def __init__(self, model, **kwargs): + super(ParamInfo, self).__init__(**kwargs) + + self.model = model + + def do(self, which_callback, *args): + print("---- PARAMETER INFO ----") + print("\tmin\tmax\tmean\tvar\tdim\t\tname") + for k, v in self.model.get_parameter_values().iteritems(): + print("\t%.4f\t%.4f\t%.4f\t%.4f\t%13s\t%s"% + (v.min(), v.max(), v.mean(), ((v-v.mean())**2).mean(), 'x'.join([repr(x) for x in v.shape]), k)) + |