This commit is contained in:
Alejandro Moreo Fernandez 2024-09-25 11:33:51 +02:00
parent ac4f81918e
commit 4a3b18b3a3
1 changed files with 5 additions and 3 deletions

View File

@ -315,10 +315,11 @@ class KDEyMLauto2(KDEyML):
return loss_accum
bounds = [tuple((0.0001, np.log10(0.2)))]
init_bandwidth = 0.1
bounds = [tuple((0.0001, 0.2))]
init_bandwidth = 0.05
r = optimize.minimize(neg_loglikelihood_band_, x0=[init_bandwidth], method='SLSQP', bounds=bounds)
best_band = r.x[0]
nit = r.nit
else:
best_band = None
@ -347,6 +348,7 @@ class KDEyMLauto2(KDEyML):
if best_loss_val is None or loss_accum < best_loss_val:
best_loss_val = loss_accum
best_band = bandwidth
nit=20
print(f'found bandwidth={best_band:.4f}') # (loss_val={best_loss_val:.5f})')
print(f'found bandwidth={best_band:.4f} after {nit=} iterations') # (loss_val={best_loss_val:.5f})')
self.bandwidth_ = best_band