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

Test failures on master #461

@amueller

Description

@amueller
surrogate = 'gp', n_jobs = 1

    @pytest.mark.parametrize("surrogate", ['gp', None])
    @pytest.mark.parametrize("n_jobs", [1, -1])  # test sequential and parallel
    def test_searchcv_runs(surrogate, n_jobs):
        """
        Test whether the cross validation search wrapper around sklearn
        models runs properly with available surrogates and with single
        or multiple workers.
    
        Parameters
        ----------
    
        * `surrogate` [str or None]:
            A class of the scikit-optimize surrogate used. None means
            to use default surrogate.
    
        * `n_jobs` [int]:
            Number of parallel processes to use for computations.
    
        """
    
        X, y = load_iris(True)
        X_train, X_test, y_train, y_test = train_test_split(
            X, y, train_size=0.75, random_state=0
        )
    
        # None search space is only supported when only `step` function is used
        assert_raises(ValueError, BayesSearchCV(SVC(), None).fit, (X, y))
    
        # check if invalid dimensions are raising errors
        with pytest.raises(ValueError):
            BayesSearchCV(SVC(), {'C': '1 ... 100.0'})
    
        with pytest.raises(TypeError):
            BayesSearchCV(SVC(), ['C', (1.0, 1)])
    
        # create an instance of a surrogate if it is not a string
        if surrogate is not None:
            optimizer_kwargs = {'base_estimator': surrogate}
        else:
            optimizer_kwargs = None
    
        opt = BayesSearchCV(
            SVC(),
            {
                'C': Real(1e-6, 1e+6, prior='log-uniform'),
                'gamma': Real(1e-6, 1e+1, prior='log-uniform'),
                'degree': Integer(1, 8),
                'kernel': Categorical(['linear', 'poly', 'rbf']),
            },
            n_jobs=n_jobs, n_iter=11,
            optimizer_kwargs=optimizer_kwargs
        )
    
>       opt.fit(X_train, y_train)

skopt/tests/test_searchcv.py:70: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
skopt/searchcv.py:575: in fit
    groups=groups, n_jobs=n_jobs_adjusted
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = BayesSearchCV(cv=None, error_score='raise',
       estimator=SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,
...s',
       random_state=None, refit=False, return_train_score=True,
       scoring=None, search_spaces=None, verbose=0)
X = array([[ 5.9,  3. ,  4.2,  1.5],
       [ 5.8,  2.6,  4. ,  1.2],
       [ 6.8,  3. ,  5.5,  2.1],
       [ 4.7,  3.2,...  2.9,  5.6,  1.8],
       [ 5.8,  2.7,  4.1,  1. ],
       [ 7.7,  3.8,  6.7,  2.2],
       [ 4.6,  3.2,  1.4,  0.2]])
y = array([1, 1, 2, 0, 2, 0, 0, 1, 2, 2, 2, 2, 1, 2, 1, 1, 2, 2, 2, 2, 1, 2, 1,
       0, 2, 1, 1, 1, 1, 2, 0, 0, 2, 1, 0,... 0, 2, 1, 2, 1, 0, 2, 0, 2, 0, 0, 2, 0, 2, 1, 1, 1,
       2, 2, 1, 1, 0, 1, 2, 2, 0, 1, 1, 1, 1, 0, 0, 0, 2, 1, 2, 0])
space_id = range(0, 1), groups = None, n_jobs = 1

    def step(self, X, y, space_id, groups=None, n_jobs=1):
        """Generate n_jobs parameters and evaluate them in parallel.
    
            Having a separate function for a single step for search allows to
            save easily checkpoints for the parameter search and restore from
            possible failures.
    
            Parameters
            ----------
            X : array-like or sparse matrix, shape = [n_samples, n_features]
                The training input samples. Internally, it will be converted to
                ``dtype=np.float32`` and if a sparse matrix is provided
                to a sparse ``csc_matrix``.
    
            y : array-like, shape = [n_samples] or [n_samples, n_outputs]
                The target values (class labels) as integers or strings.
    
            space_id : hashable
                Identifier of parameter search space. Add search spaces with
    
            groups : array-like, with shape (n_samples,), optional
                Group labels for the samples used while splitting the dataset into
                train/test set.
    
            n_jobs : int, default=1
                Number of parameters to evaluate in parallel.
    
            Returns
            -------
            params_dict: dictionary with parameter values.
            """
    
        # convert n_jobst to int > 0 if necessary
        if n_jobs < 0:
            n_jobs = max(1, cpu_count() + n_jobs + 1)
    
        # use the cached optimizer for particular parameter space
        if space_id not in self.search_spaces_:
            raise ValueError("Unknown space %s" % space_id)
    
        # get the search space for a step
        search_space = self.search_spaces_[space_id]
        if isinstance(search_space, tuple):
            search_space, _ = search_space
    
        # create optimizer if not created already
        if space_id not in self.optimizer_:
            self.optimizer_[space_id] = self._make_optimizer(search_space)
        optimizer = self.optimizer_[space_id]
    
        # get parameter values to evaluate
        params = optimizer.ask(n_points=n_jobs)
        params_dict = [point_asdict(search_space, p) for p in params]
    
        # self.cv_results_ is reset at every call to _fit, keep current
        all_cv_results = self.cv_results_
    
        # record performances with different points
        refit = self.refit
        self.refit = False  # do not fit yet - will be fit later
>       self._fit(X, y, groups, params_dict)
E       AttributeError: 'BayesSearchCV' object has no attribute '_fit'

skopt/searchcv.py:506: AttributeError
____________________________________________________________________________________________________________________ test_searchcv_runs[1-None] _____________________________________________________________________________________________________________________

surrogate = None, n_jobs = 1

    @pytest.mark.parametrize("surrogate", ['gp', None])
    @pytest.mark.parametrize("n_jobs", [1, -1])  # test sequential and parallel
    def test_searchcv_runs(surrogate, n_jobs):
        """
        Test whether the cross validation search wrapper around sklearn
        models runs properly with available surrogates and with single
        or multiple workers.
    
        Parameters
        ----------
    
        * `surrogate` [str or None]:
            A class of the scikit-optimize surrogate used. None means
            to use default surrogate.
    
        * `n_jobs` [int]:
            Number of parallel processes to use for computations.
    
        """
    
        X, y = load_iris(True)
        X_train, X_test, y_train, y_test = train_test_split(
            X, y, train_size=0.75, random_state=0
        )
    
        # None search space is only supported when only `step` function is used
        assert_raises(ValueError, BayesSearchCV(SVC(), None).fit, (X, y))
    
        # check if invalid dimensions are raising errors
        with pytest.raises(ValueError):
            BayesSearchCV(SVC(), {'C': '1 ... 100.0'})
    
        with pytest.raises(TypeError):
            BayesSearchCV(SVC(), ['C', (1.0, 1)])
    
        # create an instance of a surrogate if it is not a string
        if surrogate is not None:
            optimizer_kwargs = {'base_estimator': surrogate}
        else:
            optimizer_kwargs = None
    
        opt = BayesSearchCV(
            SVC(),
            {
                'C': Real(1e-6, 1e+6, prior='log-uniform'),
                'gamma': Real(1e-6, 1e+1, prior='log-uniform'),
                'degree': Integer(1, 8),
                'kernel': Categorical(['linear', 'poly', 'rbf']),
            },
            n_jobs=n_jobs, n_iter=11,
            optimizer_kwargs=optimizer_kwargs
        )
    
>       opt.fit(X_train, y_train)

skopt/tests/test_searchcv.py:70: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
skopt/searchcv.py:575: in fit
    groups=groups, n_jobs=n_jobs_adjusted
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = BayesSearchCV(cv=None, error_score='raise',
       estimator=SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,
...s', random_state=None, refit=False,
       return_train_score=True, scoring=None, search_spaces=None,
       verbose=0)
X = array([[ 5.9,  3. ,  4.2,  1.5],
       [ 5.8,  2.6,  4. ,  1.2],
       [ 6.8,  3. ,  5.5,  2.1],
       [ 4.7,  3.2,...  2.9,  5.6,  1.8],
       [ 5.8,  2.7,  4.1,  1. ],
       [ 7.7,  3.8,  6.7,  2.2],
       [ 4.6,  3.2,  1.4,  0.2]])
y = array([1, 1, 2, 0, 2, 0, 0, 1, 2, 2, 2, 2, 1, 2, 1, 1, 2, 2, 2, 2, 1, 2, 1,
       0, 2, 1, 1, 1, 1, 2, 0, 0, 2, 1, 0,... 0, 2, 1, 2, 1, 0, 2, 0, 2, 0, 0, 2, 0, 2, 1, 1, 1,
       2, 2, 1, 1, 0, 1, 2, 2, 0, 1, 1, 1, 1, 0, 0, 0, 2, 1, 2, 0])
space_id = range(0, 1), groups = None, n_jobs = 1

    def step(self, X, y, space_id, groups=None, n_jobs=1):
        """Generate n_jobs parameters and evaluate them in parallel.
    
            Having a separate function for a single step for search allows to
            save easily checkpoints for the parameter search and restore from
            possible failures.
    
            Parameters
            ----------
            X : array-like or sparse matrix, shape = [n_samples, n_features]
                The training input samples. Internally, it will be converted to
                ``dtype=np.float32`` and if a sparse matrix is provided
                to a sparse ``csc_matrix``.
    
            y : array-like, shape = [n_samples] or [n_samples, n_outputs]
                The target values (class labels) as integers or strings.
    
            space_id : hashable
                Identifier of parameter search space. Add search spaces with
    
            groups : array-like, with shape (n_samples,), optional
                Group labels for the samples used while splitting the dataset into
                train/test set.
    
            n_jobs : int, default=1
                Number of parameters to evaluate in parallel.
    
            Returns
            -------
            params_dict: dictionary with parameter values.
            """
    
        # convert n_jobst to int > 0 if necessary
        if n_jobs < 0:
            n_jobs = max(1, cpu_count() + n_jobs + 1)
    
        # use the cached optimizer for particular parameter space
        if space_id not in self.search_spaces_:
            raise ValueError("Unknown space %s" % space_id)
    
        # get the search space for a step
        search_space = self.search_spaces_[space_id]
        if isinstance(search_space, tuple):
            search_space, _ = search_space
    
        # create optimizer if not created already
        if space_id not in self.optimizer_:
            self.optimizer_[space_id] = self._make_optimizer(search_space)
        optimizer = self.optimizer_[space_id]
    
        # get parameter values to evaluate
        params = optimizer.ask(n_points=n_jobs)
        params_dict = [point_asdict(search_space, p) for p in params]
    
        # self.cv_results_ is reset at every call to _fit, keep current
        all_cv_results = self.cv_results_
    
        # record performances with different points
        refit = self.refit
        self.refit = False  # do not fit yet - will be fit later
>       self._fit(X, y, groups, params_dict)
E       AttributeError: 'BayesSearchCV' object has no attribute '_fit'

skopt/searchcv.py:506: AttributeError
_____________________________________________________________________________________________________________________ test_searchcv_runs[-1-gp] _____________________________________________________________________________________________________________________

surrogate = 'gp', n_jobs = -1

    @pytest.mark.parametrize("surrogate", ['gp', None])
    @pytest.mark.parametrize("n_jobs", [1, -1])  # test sequential and parallel
    def test_searchcv_runs(surrogate, n_jobs):
        """
        Test whether the cross validation search wrapper around sklearn
        models runs properly with available surrogates and with single
        or multiple workers.
    
        Parameters
        ----------
    
        * `surrogate` [str or None]:
            A class of the scikit-optimize surrogate used. None means
            to use default surrogate.
    
        * `n_jobs` [int]:
            Number of parallel processes to use for computations.
    
        """
    
        X, y = load_iris(True)
        X_train, X_test, y_train, y_test = train_test_split(
            X, y, train_size=0.75, random_state=0
        )
    
        # None search space is only supported when only `step` function is used
        assert_raises(ValueError, BayesSearchCV(SVC(), None).fit, (X, y))
    
        # check if invalid dimensions are raising errors
        with pytest.raises(ValueError):
            BayesSearchCV(SVC(), {'C': '1 ... 100.0'})
    
        with pytest.raises(TypeError):
            BayesSearchCV(SVC(), ['C', (1.0, 1)])
    
        # create an instance of a surrogate if it is not a string
        if surrogate is not None:
            optimizer_kwargs = {'base_estimator': surrogate}
        else:
            optimizer_kwargs = None
    
        opt = BayesSearchCV(
            SVC(),
            {
                'C': Real(1e-6, 1e+6, prior='log-uniform'),
                'gamma': Real(1e-6, 1e+1, prior='log-uniform'),
                'degree': Integer(1, 8),
                'kernel': Categorical(['linear', 'poly', 'rbf']),
            },
            n_jobs=n_jobs, n_iter=11,
            optimizer_kwargs=optimizer_kwargs
        )
    
>       opt.fit(X_train, y_train)

skopt/tests/test_searchcv.py:70: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
skopt/searchcv.py:575: in fit
    groups=groups, n_jobs=n_jobs_adjusted
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = BayesSearchCV(cv=None, error_score='raise',
       estimator=SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,
...s',
       random_state=None, refit=False, return_train_score=True,
       scoring=None, search_spaces=None, verbose=0)
X = array([[ 5.9,  3. ,  4.2,  1.5],
       [ 5.8,  2.6,  4. ,  1.2],
       [ 6.8,  3. ,  5.5,  2.1],
       [ 4.7,  3.2,...  2.9,  5.6,  1.8],
       [ 5.8,  2.7,  4.1,  1. ],
       [ 7.7,  3.8,  6.7,  2.2],
       [ 4.6,  3.2,  1.4,  0.2]])
y = array([1, 1, 2, 0, 2, 0, 0, 1, 2, 2, 2, 2, 1, 2, 1, 1, 2, 2, 2, 2, 1, 2, 1,
       0, 2, 1, 1, 1, 1, 2, 0, 0, 2, 1, 0,... 0, 2, 1, 2, 1, 0, 2, 0, 2, 0, 0, 2, 0, 2, 1, 1, 1,
       2, 2, 1, 1, 0, 1, 2, 2, 0, 1, 1, 1, 1, 0, 0, 0, 2, 1, 2, 0])
space_id = range(0, 1), groups = None, n_jobs = 4

    def step(self, X, y, space_id, groups=None, n_jobs=1):
        """Generate n_jobs parameters and evaluate them in parallel.
    
            Having a separate function for a single step for search allows to
            save easily checkpoints for the parameter search and restore from
            possible failures.
    
            Parameters
            ----------
            X : array-like or sparse matrix, shape = [n_samples, n_features]
                The training input samples. Internally, it will be converted to
                ``dtype=np.float32`` and if a sparse matrix is provided
                to a sparse ``csc_matrix``.
    
            y : array-like, shape = [n_samples] or [n_samples, n_outputs]
                The target values (class labels) as integers or strings.
    
            space_id : hashable
                Identifier of parameter search space. Add search spaces with
    
            groups : array-like, with shape (n_samples,), optional
                Group labels for the samples used while splitting the dataset into
                train/test set.
    
            n_jobs : int, default=1
                Number of parameters to evaluate in parallel.
    
            Returns
            -------
            params_dict: dictionary with parameter values.
            """
    
        # convert n_jobst to int > 0 if necessary
        if n_jobs < 0:
            n_jobs = max(1, cpu_count() + n_jobs + 1)
    
        # use the cached optimizer for particular parameter space
        if space_id not in self.search_spaces_:
            raise ValueError("Unknown space %s" % space_id)
    
        # get the search space for a step
        search_space = self.search_spaces_[space_id]
        if isinstance(search_space, tuple):
            search_space, _ = search_space
    
        # create optimizer if not created already
        if space_id not in self.optimizer_:
            self.optimizer_[space_id] = self._make_optimizer(search_space)
        optimizer = self.optimizer_[space_id]
    
        # get parameter values to evaluate
        params = optimizer.ask(n_points=n_jobs)
        params_dict = [point_asdict(search_space, p) for p in params]
    
        # self.cv_results_ is reset at every call to _fit, keep current
        all_cv_results = self.cv_results_
    
        # record performances with different points
        refit = self.refit
        self.refit = False  # do not fit yet - will be fit later
>       self._fit(X, y, groups, params_dict)
E       AttributeError: 'BayesSearchCV' object has no attribute '_fit'

skopt/searchcv.py:506: AttributeError
____________________________________________________________________________________________________________________ test_searchcv_runs[-1-None] ____________________________________________________________________________________________________________________

surrogate = None, n_jobs = -1

    @pytest.mark.parametrize("surrogate", ['gp', None])
    @pytest.mark.parametrize("n_jobs", [1, -1])  # test sequential and parallel
    def test_searchcv_runs(surrogate, n_jobs):
        """
        Test whether the cross validation search wrapper around sklearn
        models runs properly with available surrogates and with single
        or multiple workers.
    
        Parameters
        ----------
    
        * `surrogate` [str or None]:
            A class of the scikit-optimize surrogate used. None means
            to use default surrogate.
    
        * `n_jobs` [int]:
            Number of parallel processes to use for computations.
    
        """
    
        X, y = load_iris(True)
        X_train, X_test, y_train, y_test = train_test_split(
            X, y, train_size=0.75, random_state=0
        )
    
        # None search space is only supported when only `step` function is used
        assert_raises(ValueError, BayesSearchCV(SVC(), None).fit, (X, y))
    
        # check if invalid dimensions are raising errors
        with pytest.raises(ValueError):
            BayesSearchCV(SVC(), {'C': '1 ... 100.0'})
    
        with pytest.raises(TypeError):
            BayesSearchCV(SVC(), ['C', (1.0, 1)])
    
        # create an instance of a surrogate if it is not a string
        if surrogate is not None:
            optimizer_kwargs = {'base_estimator': surrogate}
        else:
            optimizer_kwargs = None
    
        opt = BayesSearchCV(
            SVC(),
            {
                'C': Real(1e-6, 1e+6, prior='log-uniform'),
                'gamma': Real(1e-6, 1e+1, prior='log-uniform'),
                'degree': Integer(1, 8),
                'kernel': Categorical(['linear', 'poly', 'rbf']),
            },
            n_jobs=n_jobs, n_iter=11,
            optimizer_kwargs=optimizer_kwargs
        )
    
>       opt.fit(X_train, y_train)

skopt/tests/test_searchcv.py:70: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
skopt/searchcv.py:575: in fit
    groups=groups, n_jobs=n_jobs_adjusted
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = BayesSearchCV(cv=None, error_score='raise',
       estimator=SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,
...s', random_state=None,
       refit=False, return_train_score=True, scoring=None,
       search_spaces=None, verbose=0)
X = array([[ 5.9,  3. ,  4.2,  1.5],
       [ 5.8,  2.6,  4. ,  1.2],
       [ 6.8,  3. ,  5.5,  2.1],
       [ 4.7,  3.2,...  2.9,  5.6,  1.8],
       [ 5.8,  2.7,  4.1,  1. ],
       [ 7.7,  3.8,  6.7,  2.2],
       [ 4.6,  3.2,  1.4,  0.2]])
y = array([1, 1, 2, 0, 2, 0, 0, 1, 2, 2, 2, 2, 1, 2, 1, 1, 2, 2, 2, 2, 1, 2, 1,
       0, 2, 1, 1, 1, 1, 2, 0, 0, 2, 1, 0,... 0, 2, 1, 2, 1, 0, 2, 0, 2, 0, 0, 2, 0, 2, 1, 1, 1,
       2, 2, 1, 1, 0, 1, 2, 2, 0, 1, 1, 1, 1, 0, 0, 0, 2, 1, 2, 0])
space_id = range(0, 1), groups = None, n_jobs = 4

    def step(self, X, y, space_id, groups=None, n_jobs=1):
        """Generate n_jobs parameters and evaluate them in parallel.
    
            Having a separate function for a single step for search allows to
            save easily checkpoints for the parameter search and restore from
            possible failures.
    
            Parameters
            ----------
            X : array-like or sparse matrix, shape = [n_samples, n_features]
                The training input samples. Internally, it will be converted to
                ``dtype=np.float32`` and if a sparse matrix is provided
                to a sparse ``csc_matrix``.
    
            y : array-like, shape = [n_samples] or [n_samples, n_outputs]
                The target values (class labels) as integers or strings.
    
            space_id : hashable
                Identifier of parameter search space. Add search spaces with
    
            groups : array-like, with shape (n_samples,), optional
                Group labels for the samples used while splitting the dataset into
                train/test set.
    
            n_jobs : int, default=1
                Number of parameters to evaluate in parallel.
    
            Returns
            -------
            params_dict: dictionary with parameter values.
            """
    
        # convert n_jobst to int > 0 if necessary
        if n_jobs < 0:
            n_jobs = max(1, cpu_count() + n_jobs + 1)
    
        # use the cached optimizer for particular parameter space
        if space_id not in self.search_spaces_:
            raise ValueError("Unknown space %s" % space_id)
    
        # get the search space for a step
        search_space = self.search_spaces_[space_id]
        if isinstance(search_space, tuple):
            search_space, _ = search_space
    
        # create optimizer if not created already
        if space_id not in self.optimizer_:
            self.optimizer_[space_id] = self._make_optimizer(search_space)
        optimizer = self.optimizer_[space_id]
    
        # get parameter values to evaluate
        params = optimizer.ask(n_points=n_jobs)
        params_dict = [point_asdict(search_space, p) for p in params]
    
        # self.cv_results_ is reset at every call to _fit, keep current
        all_cv_results = self.cv_results_
    
        # record performances with different points
        refit = self.refit
        self.refit = False  # do not fit yet - will be fit later
>       self._fit(X, y, groups, params_dict)
E       AttributeError: 'BayesSearchCV' object has no attribute '_fit'

skopt/searchcv.py:506: AttributeError
_______________________________________________________________________________________________________________ test_searchcv_runs_multiple_subspaces _______________________________________________________________________________________________________________

    def test_searchcv_runs_multiple_subspaces():
        """
        Test whether the BayesSearchCV runs without exceptions when
        multiple subspaces are given.
        """
    
        X, y = load_iris(True)
        X_train, X_test, y_train, y_test = train_test_split(
            X, y, train_size=0.75, random_state=0
        )
    
        opt = BayesSearchCV(
            SVC(),
            [
                ({
                    'C': Real(1e-6, 1e+6, prior='log-uniform'),
                    'gamma': Real(1e-6, 1e+1, prior='log-uniform'),
                }, 10),
                {
                    'degree': Integer(1, 8),
                    'kernel': Categorical(['linear', 'poly', 'rbf']),
                }
            ],
            n_iter=10
        )
    
>       opt.fit(X_train, y_train)

skopt/tests/test_searchcv.py:103: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
skopt/searchcv.py:575: in fit
    groups=groups, n_jobs=n_jobs_adjusted
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = BayesSearchCV(cv=None, error_score='raise',
       estimator=SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,
...s', random_state=None, refit=False,
       return_train_score=True, scoring=None, search_spaces=None,
       verbose=0)
X = array([[ 5.9,  3. ,  4.2,  1.5],
       [ 5.8,  2.6,  4. ,  1.2],
       [ 6.8,  3. ,  5.5,  2.1],
       [ 4.7,  3.2,...  2.9,  5.6,  1.8],
       [ 5.8,  2.7,  4.1,  1. ],
       [ 7.7,  3.8,  6.7,  2.2],
       [ 4.6,  3.2,  1.4,  0.2]])
y = array([1, 1, 2, 0, 2, 0, 0, 1, 2, 2, 2, 2, 1, 2, 1, 1, 2, 2, 2, 2, 1, 2, 1,
       0, 2, 1, 1, 1, 1, 2, 0, 0, 2, 1, 0,... 0, 2, 1, 2, 1, 0, 2, 0, 2, 0, 0, 2, 0, 2, 1, 1, 1,
       2, 2, 1, 1, 0, 1, 2, 2, 0, 1, 1, 1, 1, 0, 0, 0, 2, 1, 2, 0])
space_id = range(0, 2), groups = None, n_jobs = 1

    def step(self, X, y, space_id, groups=None, n_jobs=1):
        """Generate n_jobs parameters and evaluate them in parallel.
    
            Having a separate function for a single step for search allows to
            save easily checkpoints for the parameter search and restore from
            possible failures.
    
            Parameters
            ----------
            X : array-like or sparse matrix, shape = [n_samples, n_features]
                The training input samples. Internally, it will be converted to
                ``dtype=np.float32`` and if a sparse matrix is provided
                to a sparse ``csc_matrix``.
    
            y : array-like, shape = [n_samples] or [n_samples, n_outputs]
                The target values (class labels) as integers or strings.
    
            space_id : hashable
                Identifier of parameter search space. Add search spaces with
    
            groups : array-like, with shape (n_samples,), optional
                Group labels for the samples used while splitting the dataset into
                train/test set.
    
            n_jobs : int, default=1
                Number of parameters to evaluate in parallel.
    
            Returns
            -------
            params_dict: dictionary with parameter values.
            """
    
        # convert n_jobst to int > 0 if necessary
        if n_jobs < 0:
            n_jobs = max(1, cpu_count() + n_jobs + 1)
    
        # use the cached optimizer for particular parameter space
        if space_id not in self.search_spaces_:
            raise ValueError("Unknown space %s" % space_id)
    
        # get the search space for a step
        search_space = self.search_spaces_[space_id]
        if isinstance(search_space, tuple):
            search_space, _ = search_space
    
        # create optimizer if not created already
        if space_id not in self.optimizer_:
            self.optimizer_[space_id] = self._make_optimizer(search_space)
        optimizer = self.optimizer_[space_id]
    
        # get parameter values to evaluate
        params = optimizer.ask(n_points=n_jobs)
        params_dict = [point_asdict(search_space, p) for p in params]
    
        # self.cv_results_ is reset at every call to _fit, keep current
        all_cv_results = self.cv_results_
    
        # record performances with different points
        refit = self.refit
        self.refit = False  # do not fit yet - will be fit later
>       self._fit(X, y, groups, params_dict)
E       AttributeError: 'BayesSearchCV' object has no attribute '_fit'

skopt/searchcv.py:506: AttributeError
________________________________________________________________________________________________________________________ test_dump_and_load _________________________________________________________________________________________________________________________

    @pytest.mark.fast_test
    def test_dump_and_load():
        res = gp_minimize(bench3,
                          [(-2.0, 2.0)],
                          x0=[0.],
                          acq_func="LCB",
                          n_calls=2,
                          n_random_starts=0,
                          random_state=1)
    
        # Test normal dumping and loading
        with tempfile.TemporaryFile() as f:
            dump(res, f)
>           res_loaded = load(f)

skopt/tests/test_utils.py:48: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
skopt/utils.py:172: in load
    return load_(filename, **kwargs)
../scikit-learn/sklearn/externals/joblib/numpy_pickle.py:568: in load
    obj = _unpickle(fobj)
../scikit-learn/sklearn/externals/joblib/numpy_pickle.py:508: in _unpickle
    obj = unpickler.load()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sklearn.externals.joblib.numpy_pickle.NumpyUnpickler object at 0x7f012a1f2828>

    def load(self):
        """Read a pickled object representation from the open file.
    
            Return the reconstituted object hierarchy specified in the file.
            """
        # Check whether Unpickler was initialized correctly. This is
        # only needed to mimic the behavior of _pickle.Unpickler.dump().
        if not hasattr(self, "_file_read"):
            raise UnpicklingError("Unpickler.__init__() was not called by "
                                  "%s.__init__()" % (self.__class__.__name__,))
        self._unframer = _Unframer(self._file_read, self._file_readline)
        self.read = self._unframer.read
        self.readline = self._unframer.readline
        self.metastack = []
        self.stack = []
        self.append = self.stack.append
        self.proto = 0
        read = self.read
        dispatch = self.dispatch
        try:
            while True:
                key = read(1)
                if not key:
>                   raise EOFError
E                   EOFError

../../anaconda3/lib/python3.6/pickle.py:1048: EOFError
___________________________________________________________________________________________________________________ test_dump_and_load_optimizer ____________________________________________________________________________________________________________________

    @pytest.mark.fast_test
    def test_dump_and_load_optimizer():
        base_estimator = ExtraTreesRegressor(random_state=2)
        opt = Optimizer([(-2.0, 2.0)], base_estimator, n_random_starts=1,
                        acq_optimizer="sampling")
    
        opt.run(bench1, n_iter=3)
    
        with tempfile.TemporaryFile() as f:
            dump(opt, f)
>           load(f)

skopt/tests/test_utils.py:78: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
skopt/utils.py:172: in load
    return load_(filename, **kwargs)
../scikit-learn/sklearn/externals/joblib/numpy_pickle.py:568: in load
    obj = _unpickle(fobj)
../scikit-learn/sklearn/externals/joblib/numpy_pickle.py:508: in _unpickle
    obj = unpickler.load()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sklearn.externals.joblib.numpy_pickle.NumpyUnpickler object at 0x7f010f9d73c8>

    def load(self):
        """Read a pickled object representation from the open file.
    
            Return the reconstituted object hierarchy specified in the file.
            """
        # Check whether Unpickler was initialized correctly. This is
        # only needed to mimic the behavior of _pickle.Unpickler.dump().
        if not hasattr(self, "_file_read"):
            raise UnpicklingError("Unpickler.__init__() was not called by "
                                  "%s.__init__()" % (self.__class__.__name__,))
        self._unframer = _Unframer(self._file_read, self._file_readline)
        self.read = self._unframer.read
        self.readline = self._unframer.readline
        self.metastack = []
        self.stack = []
        self.append = self.stack.append
        self.proto = 0
        read = self.read
        dispatch = self.dispatch
        try:
            while True:
                key = read(1)
                if not key:
>                   raise EOFError
E                   EOFError

There's also many

  /home/andy/checkout/scikit-learn/sklearn/utils/deprecation.py:75: DeprecationWarning: Function y_train_mean is deprecated; Attribute y_train_mean was deprecated in version 0.19 and will be removed in 0.21.

messages, that basically make the whole test output unreadable :-/

The BayesSearchCV (and the deprecation) is probably because I'm running scikit-learn master, not sure about the rest. (I'm surprised the other people here are not running scikit-learn master?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions