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
{{ message }}
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.
I still get error when using sci-kit learn RBF for sci-kit optimize gp_minimize, any idea how to solve it?
here is the code to reproduce it
from numpy import mean
from pandas import read_csv
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import RepeatedStratifiedKFold
from sklearn.svm import SVC
from skopt.space import Integer
from skopt.space import Real
from skopt.space import Categorical
from skopt.utils import use_named_args
from skopt import gp_minimize
from skopt import gp_minimize, dummy_minimize
from sklearn.gaussian_process.kernels import RBF
import time
import numpy as np
from skopt.learning import GaussianProcessRegressor
from skopt.learning.gaussian_process.kernels import Matern
# define the space of hyperparameters to search
search_space = list()
# search_space.append(Real(1e-6, 100.0, 'log-uniform', name='C'))
# search_space.append(Categorical(['linear', 'poly', 'rbf', 'sigmoid'], name='kernel'))
# search_space.append(Integer(1, 5, name='degree'))
search_space.append(Real(1e-6, 100.0, 'log-uniform', name='gamma'))
other_kernel = RBF(length_scale=1.0)
base_estimator = GaussianProcessRegressor(
kernel= other_kernel,
normalize_y=True, noise="gaussian",
n_restarts_optimizer=0)
# define the function used to evaluate a given configuration
@use_named_args(search_space)
def evaluate_model(**params):
return 0.7
# load dataset
url = 'https://raw.githubusercontent.com/jbrownlee/Datasets/master/ionosphere.csv'
dataframe = read_csv(url, header=None)
# split into input and output elements
data = dataframe.values
X, y = data[:, :-1], data[:, -1]
print(X.shape, y.shape)
# perform optimization
result = gp_minimize(evaluate_model, search_space,base_estimator=base_estimator)
# summarizing finding:
print('Best Accuracy: %.3f' % (1.0 - result.fun))
print('Best Parameters: %s' % (result.x))
I still get error when using sci-kit learn RBF for sci-kit optimize gp_minimize, any idea how to solve it?
here is the code to reproduce it
The error log
package versions
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
The text was updated successfully, but these errors were encountered: