You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (4,) + inhomogeneous part.
happens here in the package
self._bounds: NDArray[Float] = np.array( [item[1] for item in sorted(pbounds.items(), key=lambda x: x[0])], dtype=float
When I am testing to optimize hyperparameter with the code
Not sure if there's function in the package to set it, but what I retraced and found the possible reason is when including int, the array become inhomogeneous shape and cannot be set as a np.array. Alternatively set float to object works in my code. Or is there any other way which can simply solve the error?
The text was updated successfully, but these errors were encountered:
I met a ValueError:
setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (4,) + inhomogeneous part.
happens here in the package
self._bounds: NDArray[Float] = np.array( [item[1] for item in sorted(pbounds.items(), key=lambda x: x[0])], dtype=float
When I am testing to optimize hyperparameter with the code
define the optimizer
hyper_optimizer = BayesianOptimization(
f=clf,
pbounds=hyperparameter_grid,
acquisition_function=acquisition.ExpectedImprovement(xi=1e-2, random_state=1),
random_state=1,
)
hyper_optimizer.maximize(
init_points=3,
n_iter=50,
)
define a search space
hyperparameter_grid = {
'hidden_size': [16,32,int],
'batch_size' : [32,256,int],
'lr' : [0.001,0.0001],
'epochs' : [10,50,int]
}
Not sure if there's function in the package to set it, but what I retraced and found the possible reason is when including int, the array become inhomogeneous shape and cannot be set as a np.array. Alternatively set float to object works in my code. Or is there any other way which can simply solve the error?
The text was updated successfully, but these errors were encountered: