josejimenezluna / pyGPGO

Bayesian optimization for Python
http://pygpgo.readthedocs.io
MIT License
241 stars 61 forks source link

SVM optimization with GPGO: objective function not improving after several iterations and different config of acq funct and surrogate model #15

Closed camillascf closed 5 years ago

camillascf commented 5 years ago

`from pyGPGO.covfunc import squaredExponential from pyGPGO.surrogates.GaussianProcess import GaussianProcess from pyGPGO.surrogates.RandomForest import RandomForest from pyGPGO.GPGO import GPGO from pyGPGO.acquisition import Acquisition

from sklearn import datasets from sklearn import svm from sklearn.model_selection import cross_val_score

from sklearn.datasets import load_wine import collections df=load_wine()

collections.Counter(df['target']) xtrain, xtest, ytrain, ytest = train_test_split(df['data'],df['target'],test_size=0.24,random_state=seed)

def accuracy_SVC(C,coef0,gamma): clf = svm.SVC(C=C,coef0=coef0,gamma=gamma,kernel='sigmoid') scores = cross_val_score(clf, xtrain, ytrain, cv=10) return (scores.mean())

from pyGPGO.covfunc import matern32 from pyGPGO.covfunc import gammaExponential

covf=gammaExponential() covf2=matern32()

GP = GaussianProcess(covf) RF = RandomForest()

acq = Acquisition(mode='ProbabilityImprovement') acq3= Acquisition(mode='UCB')

import numpy as np

bo = GPGO(GP,acq,accuracy_SVC,param) bo.run(init_evals=30,max_iter=120)

bo6=GPGO(RF,acq3,accuracy_SVC,param) bo6.run(init_evals=30,max_iter=120)`

josejimenezluna commented 5 years ago

Hello @camillascf, this is not fully reproduceable code. Please provide a minimal working issue example.

camillascf commented 5 years ago

Hello @hawk31. Thanks a lot for your reply. I can't understand why the 'best seen' does not improve over iterations. SMO.pdf