

def setup(self, model, dataset, algorithm):
    '\n        Add WMAPE Numerator channels for monitoring dataset(s) to\n        model.monitor.\n\n        Parameters\n        ----------\n        model : object\n            The model being trained.\n        dataset : object\n            Training dataset.\n        algorithm : object\n            Training algorithm.\n        '
    (m_space, m_source) = model.get_monitoring_data_specs()
    (state, target) = m_space.make_theano_batch()
    y = target[:, 0]
    y_hat = model.fprop(state)[:, 0]
    wmape_numerator = abs((y - y_hat)).sum()
    wmape_numerator = T.cast(wmape_numerator, config.floatX)
    for (dataset_name, dataset) in algorithm.monitoring_dataset.items():
        if dataset_name:
            channel_name = '{0}_{1}'.format(dataset_name, self.channel_name_suffix)
        else:
            channel_name = self.channel_name_suffix
        model.monitor.add_channel(name=channel_name, ipt=(state, target), val=wmape_numerator, data_specs=(m_space, m_source), dataset=dataset)

dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/train_extensions/wmape_channel.py WMapeNumeratorChannel.setup/original