54ad58d10cb8a0d96507e075cdc26730b9e86e7f,bindsnet/learning/__init__.py,MSTDP,_connection_update,#MSTDP#,390

Before Change


        reward = kwargs["reward"]
        a_plus = torch.tensor(kwargs.get("a_plus", 1.0))
        a_minus = torch.tensor(kwargs.get("a_minus", -1.0))
        tc_plus = torch.tensor(kwargs.get("tc_plus", 20.0))
        tc_minus = torch.tensor(kwargs.get("tc_minus", 20.0))

        // Compute weight update based on the point eligibility value of the past timestep.

After Change


        
        // Initialize eligibility, P^+, and P^-.
        if not hasattr(self, "p_plus"):
            self.p_plus = torch.zeros(self.source.n)
        if not hasattr(self, "p_minus"):
            self.p_minus = torch.zeros(self.target.n)
        if not hasattr(self, "eligibility"):
            self.eligibility = torch.zeros(*self.connection.w.shape)

        // Reshape pre- and post-synaptic spikes.
        source_s = self.source.s.view(-1).float()
        target_s = self.target.s.view(-1).float()

        // Parse keyword arguments.
        reward = kwargs["reward"]
        a_plus = torch.tensor(kwargs.get("a_plus", 1.0))
        a_minus = torch.tensor(kwargs.get("a_minus", -1.0))

        // Compute weight update based on the point eligibility value of the past timestep.
        self.connection.w += self.nu[0] * reward * self.eligibility

        // Update P^+ and P^- values.
        self.p_plus *= torch.exp(-self.connection.dt / self.tc_plus)
        self.p_plus += a_plus * source_s
        self.p_minus *= torch.exp(-self.connection.dt / self.tc_minus)
        self.p_minus += a_minus * target_s
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: BindsNET/bindsnet
Commit Name: 54ad58d10cb8a0d96507e075cdc26730b9e86e7f
Time: 2019-04-01
Author: danjsaund@gmail.com
File Name: bindsnet/learning/__init__.py
Class Name: MSTDP
Method Name: _connection_update


Project Name: dpressel/mead-baseline
Commit Name: 7a4f4148317f7274c0c88095c037e93f95b1d00d
Time: 2018-09-25
Author: dpressel@gmail.com
File Name: python/baseline/tf/embeddings.py
Class Name: TensorFlowCharBoWEmbeddings
Method Name: __init__


Project Name: BindsNET/bindsnet
Commit Name: 8e044f8c0bbe1a95a95b36feb16dbf97f82bb6d3
Time: 2019-03-27
Author: jessehagenaars@gmail.com
File Name: bindsnet/learning/__init__.py
Class Name: MSTDPET
Method Name: __init__