def flat_prior(self, state):
""" Evaluate log-probability of each primitive in the population.
Return value is properly normalized.
"""
raw_phylogeny_weights = self.rule_population.flat_variable_weights
phylogeny_weights = scipy.stats.norm.logpdf(
np.log(raw_phylogeny_weights),
loc = state.phylogeny_mean,
scale = state.phylogeny_std
)
total_duration = float(self.data.experiment_end - self.data.experiment_start)
durations = (self.rule_population.flat_durations /
((1.0+self.window_duration_epsilon)*total_duration)
)
window_a = (
state.window_concentration *
state.window_typical_fraction
)
window_b = (
state.window_concentration *
(1.0-state.window_typical_fraction)
)
window_weights = scipy.stats.beta.logpdf(
durations,
window_a,
window_b
)
weights = phylogeny_weights + window_weights
normalization = logsumexp(weights)
return weights - normalization
评论列表
文章目录