File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -162,15 +162,18 @@ function MLJTuning.models(
162
162
tuning:: ParticleSwarm ,
163
163
model,
164
164
history,
165
- state,
165
+ state:: ParticleSwarmState{T} ,
166
166
n_remaining,
167
167
verbosity
168
- )
168
+ ) where {T}
169
169
n_particles = tuning. n_particles
170
170
if ! isnothing (history)
171
171
sig = MLJTuning. signature (first (history). measure)
172
- pbest! (state, tuning, map (h -> sig * h. measurement[1 ],
173
- history[end - n_particles+ 1 : end ]))
172
+ measurements = Vector {T} (undef, n_particles)
173
+ map (history[end - n_particles+ 1 : end ]) do h
174
+ measurements[h. metadata] = sig * h. measurement[1 ]
175
+ end
176
+ pbest! (state, tuning, measurements)
174
177
gbest! (state, tuning)
175
178
move! (state, tuning)
176
179
end
@@ -181,7 +184,7 @@ function MLJTuning.models(
181
184
for (field, param) in zip (fields, getindex .(state. parameters, i))
182
185
recursive_setproperty! (clone, field, param)
183
186
end
184
- clone
187
+ ( clone, i)
185
188
end
186
189
return new_models, state
187
190
end
You can’t perform that action at this time.
0 commit comments