Created
July 26, 2015 00:20
-
-
Save kgadek/d3d3b6c087ce607dc804 to your computer and use it in GitHub Desktop.
some weird gauss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
target_diffusion = 0.1 | |
population=[[0,8,4], [2,7,2]] | |
pop_diffusion=[abs(0.1*max(x)) for x in zip(*population)] | |
individual=population[0] | |
while True: | |
rand_diffusion=[random.gauss(0, v) for v in diffusion] | |
if sum(rand_diffusion) != 0.0: | |
break # :) | |
individual_diffused = [random.gauss(x_val, v * target_diffusion * sum(individual) / sum(rand_diffusion)) for x_val, v in zip(individual, rand_diffusion)] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment