Closed kroscek closed 6 years ago
Hi @wa1618i,
The parameter you are trying to optimize is the damping coefficient C. Assuming 'model' is defined as your SVR estimator, your cost function should be declared this way:
def MAE_func(val):
model.set_params(C = val)
model.fit(train, y_train)
# rest of the code
return -best_score
Also, as you have only one parameter to optimize, 'lower' and 'upper' must be lists of length 1, therefore:
lower = [ left ]
upper = [ right ]
This should do the trick. However, using an evolutionary algorithm to solve this problem may not be suitable. It will work, but I think a simple grid search or a golden section search is more appropriate for this problem.
Hope it helps!
Hi. Can stochOpy be used for hyper-parameters just like in the Bayesian-Optimization package? For example I want to find the optimal C parameter from SVR regression sklearn that can minimize MAE objective function. So the example is as follows:
But it returns an error:
Not sure what went wrong with this?