From 072d26e766931007a0f243674f7dfdff5c3104e9 Mon Sep 17 00:00:00 2001 From: Thomas Mesnard Date: Mon, 28 Dec 2015 20:51:50 +0100 Subject: Add plot More TIMIT ; log domain TIMIT: more complexity Nice poster Beautify code (mostly, add comments) Add final stuff. --- ext_param_info.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 ext_param_info.py (limited to 'ext_param_info.py') 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)) + -- cgit v1.2.3