Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

Conversation

@holgern
Copy link
Contributor

@holgern holgern commented Jan 17, 2020

Fixes #790 and adds a new dtype parameter to Integer. When using dtype=int for Integer, the np.array is converted to a list.

import keras
from keras.layers import Convolution1D
from skopt.space import Integer
from skopt.utils import use_named_args
from keras.optimizers import Adam
from skopt import plots, gp_minimize
import random
import numpy as np


space = [Integer(2, 4, name='kernel_size', dtype=int)]

@use_named_args(space)
def objective_function(kernel_size):
    model = keras.Sequential()
    model.add(Convolution1D(filters=64, kernel_size=kernel_size))
    model.compile(optimizer=Adam(), loss='binary_crossentropy',
                  metrics=['acc'])
    return random.randint(0, 100)

res = gp_minimize(objective_function, space, n_calls=10, verbose=True)

@pep8speaks
Copy link

pep8speaks commented Jan 17, 2020

Hello @holgern! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 19:1: E302 expected 2 blank lines, found 1

Comment last updated at 2020-02-01 16:51:27 UTC

@holgern holgern added this to the 0.7.1 milestone Jan 31, 2020
@holgern holgern changed the title [WIP] Set dtype integer [MRG] Set dtype integer Jan 31, 2020
@holgern holgern merged commit c04f065 into scikit-optimize:master Feb 1, 2020
@holgern holgern deleted the set_dtype_integer branch February 1, 2020 19:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using Integer search space dimension with Tensorflow

2 participants