def mixed_weight_particle_list(): p_list = [ Particle({ 'a': 1, 'b': 2 }, i, -.2) for i in np.arange(.1, .5, .1) ] return p_list
def particle(): particle = Particle({'a': 1, 'b': 2}, 0.2, -0.2) return particle
def when_wrong_weight_type(self): bad_weight_type = 'bad' return Particle(self.params, bad_weight_type, self.log_like)
def when_zero_log_like(self): edge_case_log_like = 0.0 return Particle(self.params, self.log_weight, edge_case_log_like)
def when_pos_log_like(self): pos_log_like = 0.1 return Particle(self.params, self.log_weight, pos_log_like)
def when_wrong_param_type(self): bad_param_type = [1, 2] return Particle(bad_param_type, self.log_weight, self.log_like)
def when_good_particle(self): return Particle(self.params, self.log_weight, self.log_like)
def particle_list(): particle = Particle({'a': 1, 'b': 2}, 0.2, -0.2) return 5 * [particle]
def linear_particle_list(): a = np.arange(0, 20) b = [2 * val + np.random.normal(0, 1) for val in a] w = 0.1 p_list = [Particle({'a': a[i], 'b': b[i]}, w, -.2) for i in a] return p_list
def mixed_particle_list(): particle_1 = Particle({'a': 1, 'b': 2}, -0.2, -0.2) particle_2 = Particle({'a': 2, 'b': 4}, -0.2, -0.2) list_1 = [particle_1.copy() for i in range(3)] list_2 = [particle_2.copy() for i in range(2)] return list_1 + list_2
def particle_list(): particle = Particle({'a': 1, 'b': 2}, 0.2, -0.2) return [particle.copy() for i in range(5)]