Skip to content

Commit fdab34f

Browse files
authored
fix: fix batch size parameters in qdax (#231)
1 parent 2c595f3 commit fdab34f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/nsga2_spea2.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@
9898
"proportion_mutation = 0.80 #@param {type:\"number\"}\n",
9999
"minval = -5.12 #@param {type:\"number\"}\n",
100100
"maxval = 5.12 #@param {type:\"number\"}\n",
101-
"batch_size = 100 #@param {type:\"integer\"}\n",
102101
"genotype_dim = 6 #@param {type:\"integer\"}\n",
103102
"lag = 2.2 #@param {type:\"number\"}\n",
104103
"base_lag = 0 #@param {type:\"number\"}\n",
@@ -184,7 +183,7 @@
184183
"key = jax.random.key(0)\n",
185184
"key, subkey = jax.random.split(key)\n",
186185
"genotypes = jax.random.uniform(\n",
187-
" subkey, (batch_size, genotype_dim), minval=minval, maxval=maxval, dtype=jnp.float32\n",
186+
" subkey, (population_size, genotype_dim), minval=minval, maxval=maxval, dtype=jnp.float32\n",
188187
")\n",
189188
"\n",
190189
"# Mutation & Crossover\n",
@@ -202,11 +201,12 @@
202201
")\n",
203202
"\n",
204203
"# Define the emitter\n",
204+
"# NSGA-II and SPEA2 use batch size = population size\n",
205205
"mixing_emitter = MixingEmitter(\n",
206206
" mutation_fn=mutation_function, \n",
207207
" variation_fn=crossover_function, \n",
208208
" variation_percentage=1-proportion_mutation, \n",
209-
" batch_size=batch_size\n",
209+
" batch_size=population_size, \n",
210210
")"
211211
]
212212
},

0 commit comments

Comments
 (0)