Adaptative sampling fails with more than one objective
Hi, I'm trying to use adaptative sampling with more than one objective
for and EPProblem
.
objectives = ['DistrictHeating:Facility','DistrictCooling:Facility']
problem=EPProblem(parameters, objectives)
But I get the following error:
TypeError Traceback (most recent call last)
TypeError: only size-1 arrays can be converted to Python scalars
The above exception was the direct cause of the following exception:
ValueError Traceback (most recent call last)
Input In [17], in <cell line: 13>()
1 numiter = 10
2 AS = adaptive_sampler_lv(
3 train_in.values,
4 train_out.values,
(...)
11 verbose=True,
12 )
---> 13 AS.run(numiter)
File ~/ict4bd/lib/python3.8/site-packages/besos/sampling.py:163, in adaptive_sampler_lv.run(self, no_iter)
160 self.score[0] = self.reg.score(self.test_in, self.test_out)
162 self.N_P, self.S_P = init_Neighborhood(self.P)
--> 163 self.pick_new_samples()
164 self.update_model()
166 for i in range(no_iter):
File ~/ict4bd/lib/python3.8/site-packages/besos/sampling.py:193, in adaptive_sampler_lv.pick_new_samples(self)
191 def pick_new_samples(self):
192 # 2) Compute nonlinearity measure and Voronoi Cell
--> 193 E = LOLA_estimate(
194 self.N_P, self.P, self.reg, scaler=self.scaler, scaler_out=self.scaler_out
195 )
196 V_P, samples = MC_Voronoi_estimate(self.P, self.problem)
197 H = hybrid_score(E, V_P)
File ~/ict4bd/lib/python3.8/site-packages/besos/sampling.py:281, in LOLA_estimate(N_P, P, model, scaler, scaler_out)
275 E = np.empty(
276 [
277 n,
278 ]
279 )
280 for p_r in P:
--> 281 grad = Gradient_estimation(
282 N_P[:, :, ind], p_r, model, scaler=scaler, scaler_out=scaler_out
283 )
284 E[ind] = Nonlinearity_measure(
285 grad, N_P[:, :, ind], p_r, model, scaler=scaler, scaler_out=scaler_out
286 )
287 ind = ind + 1
File ~/ict4bd/lib/python3.8/site-packages/besos/sampling.py:439, in Gradient_estimation(N, p_r, model, scaler, scaler_out)
437 P_mat[i, :] = N[i, :] - p_r
438 if scaler == None:
--> 439 F_mat[i] = model.predict([N[i, :]])
440 else:
441 F_mat[i] = scaler_out.inverse_transform(
442 model.predict(scaler.transform([N[i, :]]))
443 )
ValueError: setting an array element with a sequence.
Any chance to solve it?
Edited by LorenzoBottaccioli