(self, study: Study, ordered_dict: bool = False)
return copy.deepcopy(search_space)
Returns the intersection search space of the :class:`~optuna.study.Study`.

        Args:
            study:
                A study with completed trials.
            ordered_dict:
                A boolean flag determining the return type.
                If :obj:`False`, the returned object will be a :obj:`dict`.
                If :obj:`True`, the returned object will be an :obj:`collections.OrderedDict`
                sorted by keys, i.e. parameter names.

        Returns:
            A dictionary containing the parameter names and parameter's distributions.

        Raises:
            ValueError:
                If different studies are passed into this method.
Returns the intersection search space of the :class:`~optuna.study.Study`.
Returns the intersection search space of the : class : ~optuna . study . Study .
def calculate(self, study: Study, ordered_dict: bool = False) -> Dict[str, BaseDistribution]:
        """Returns the intersection search space of the :class:`~optuna.study.Study`.

        Args:
            study:
                A study with completed trials.
            ordered_dict:
                A boolean flag determining the return type.
                If :obj:`False`, the returned object will be a :obj:`dict`.
                If :obj:`True`, the returned object will be an :obj:`collections.OrderedDict`
                sorted by keys, i.e. parameter names.

        Returns:
            A dictionary containing the parameter names and parameter's distributions.

        Raises:
            ValueError:
                If different studies are passed into this method.
        """

        if self._study_id is None:
            self._study_id = study._study_id
        else:
            # Note that the check below is meaningless when `InMemoryStorage` is used
            # because `InMemoryStorage.create_new_study` always returns the same study ID.
            if self._study_id != study._study_id:
                raise ValueError("`IntersectionSearchSpace` cannot handle multiple studies.")

        states_of_interest = [optuna.trial.TrialState.COMPLETE]

        if self._include_pruned:
            states_of_interest.append(optuna.trial.TrialState.PRUNED)

        next_cursor = self._cursor
        for trial in reversed(study.get_trials(deepcopy=False)):
            if self._cursor > trial.number:
                break

            if not trial.state.is_finished():
                next_cursor = trial.number

            if trial.state not in states_of_interest:
                continue

            if self._search_space is None:
                self._search_space = copy.copy(trial.distributions)
                continue

            delete_list = []
            for param_name, param_distribution in self._search_space.items():
                if param_name not in trial.distributions:
                    delete_list.append(param_name)
                elif trial.distributions[param_name] != param_distribution:
                    delete_list.append(param_name)

            for param_name in delete_list:
                del self._search_space[param_name]

        self._cursor = next_cursor
        search_space = self._search_space or {}

        if ordered_dict:
            search_space = OrderedDict(sorted(search_space.items(), key=lambda x: x[0]))

        return copy.deepcopy(search_space)
def calculate ( self , study : Study , ordered_dict : bool = False ) -> Dict [ str , BaseDistribution ] : if self . _study_id is None : self . _study_id = study . _study_id else : # Note that the check below is meaningless when `InMemoryStorage` is used # because `InMemoryStorage.create_new_study` always returns the same study ID. if self . _study_id != study . _study_id : raise ValueError ( "`IntersectionSearchSpace` cannot handle multiple studies." ) states_of_interest = [ optuna . trial . TrialState . COMPLETE ] if self . _include_pruned : states_of_interest . append ( optuna . trial . TrialState . PRUNED ) next_cursor = self . _cursor for trial in reversed ( study . get_trials ( deepcopy = False ) ) : if self . _cursor > trial . number : break if not trial . state . is_finished ( ) : next_cursor = trial . number if trial . state not in states_of_interest : continue if self . _search_space is None : self . _search_space = copy . copy ( trial . distributions ) continue delete_list = [ ] for param_name , param_distribution in self . _search_space . items ( ) : if param_name not in trial . distributions : delete_list . append ( param_name ) elif trial . distributions [ param_name ] != param_distribution : delete_list . append ( param_name ) for param_name in delete_list : del self . _search_space [ param_name ] self . _cursor = next_cursor search_space = self . _search_space or { } if ordered_dict : search_space = OrderedDict ( sorted ( search_space . items ( ) , key = lambda x : x [ 0 ] ) ) return copy . deepcopy ( search_space )