a5f83e8f1e29c62070333d6ce48009e2fdb323b9,inferno/net.py,NeuralNet,initialize_callbacks,#NeuralNet#,192

Before Change


        callbacks += self.callbacks or []
        names_and_cbs = self._get_callbacks_and_names(callbacks)

        names = list(zip(*names_and_cbs))[0]
        if len(names) != len(set(names)):
            // TODO: more useful message
            raise ValueError("There are callbacks with duplicate names.")

After Change


            yield name, cb

    def initialize_callbacks(self):
        names_seen = set()
        callbacks_ = []

        for name, cb in self._yield_callbacks():
            if name in names_seen:
                raise ValueError("The callback name "{}" appears more than "
                                 "once.".format(name))
            names_seen.add(name)

            params = self._get_params_for("callbacks__{}".format(name))
            if isinstance(cb, type):  // uninitialized:
                cb = cb(**params)
            else:
                cb.set_params(**params)
            cb.initialize()
            callbacks_.append((name, cb))

        self.callbacks_ = callbacks_
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: dnouri/skorch
Commit Name: a5f83e8f1e29c62070333d6ce48009e2fdb323b9
Time: 2017-07-19
Author: benjamin.bossan@ottogroup.com
File Name: inferno/net.py
Class Name: NeuralNet
Method Name: initialize_callbacks


Project Name: bokeh/bokeh
Commit Name: 5f6b5d3851d0b719f401eafbfc569420405d1ef3
Time: 2016-08-16
Author: canavandl@gmail.com
File Name: bokeh/models/formatters.py
Class Name: FuncTickFormatter
Method Name: from_py_func


Project Name: stanford-mast/nn_dataflow
Commit Name: ef4353bd24b9d781c2dfa9cd2146d9b87e63b6f1
Time: 2017-05-01
Author: mgao12@stanford.edu
File Name: nn_dataflow/Scheduling.py
Class Name: Scheduling
Method Name: schedule_search