

def step_up(self, cable_activities):
    ' Train the daisychain using the current cable_activities '
    self.num_cables = np.maximum(self.num_cables, cable_activities.size)
    cable_activities = tools.pad(cable_activities, (self.max_num_cables, 0))
    self.pre = self.cable_activities.copy()
    self.cable_activities = cable_activities.copy()
    self.post = self.cable_activities.copy()
    chain_activities = (self.pre * self.post.T)
    self.count += chain_activities
    self.count -= (1 / ((self.AGING_TIME_CONSTANT * self.count) + tools.EPSILON))
    self.count = np.maximum(self.count, 0)
    update_rate_raw_post = (self.pre * (((1 - self.CHAIN_UPDATE_RATE) / (self.pre_count + tools.EPSILON)) + self.CHAIN_UPDATE_RATE))
    update_rate_post = np.minimum(0.5, update_rate_raw_post)
    self.pre_count += self.pre
    self.pre_count -= (1 / ((self.AGING_TIME_CONSTANT * self.pre_count) + tools.EPSILON))
    self.pre_count = np.maximum(self.pre_count, 0)
    post_difference = np.abs(((self.pre * self.post.T) - self.expected_cable_activities))
    self.expected_cable_activities += (update_rate_post * ((self.pre * self.post.T) - self.expected_cable_activities))
    self.post_uncertainty += ((post_difference - self.post_uncertainty) * update_rate_post)
    self.reaction = tools.weighted_average(self.expected_cable_activities, self.pre)
    surprise_weights = ((self.pre / (self.post_uncertainty + tools.EPSILON)) + tools.EPSILON)
    self.surprise = tools.weighted_average(np.abs((self.post.T - self.expected_cable_activities)), surprise_weights)
    return chain_activities.ravel()[:, np.newaxis]

dataset/ETHPy150Open matt2000/becca/core/daisychain.py DaisyChain.step_up/original