def _extract_params(self, kwargs, hyperparameters):
        """Extract init, fit and produce params from kwargs.

        The `init_params`, `fit_params` and `produce_params` are extracted
        from the passed `kwargs` taking the metadata hyperparameters as a
        reference.

        During this extraction, make sure that all the required hyperparameters
        have been given and that nothing unexpected exists in the input.

        Args:
            kwargs (dict): dict containing the Keyword arguments that have
                           been passed to the `__init__` method upon
                           initialization.
            hyperparameters (dict): hyperparameters dictionary, as found in
                                    the JSON annotation.

        Raises:
            TypeError: A `TypeError` is raised if a required argument is not
                       found in the `kwargs` dict, or if an unexpected
                       argument has been given.
        """
        init_params = dict()
        fit_params = dict()
        produce_params = dict()

        for name, param in hyperparameters.get('fixed', dict()).items():
            if name in kwargs:
                value = kwargs.pop(name)

            elif 'default' in param:
                value = param['default']

            else:
                raise TypeError("{} required argument '{}' not found".format(self.name, name))

            init_params[name] = value

        for name, param in hyperparameters.get('tunable', dict()).items():
            if name in kwargs:
                init_params[name] = kwargs.pop(name)

        fit_args = [arg['name'] for arg in self.fit_args]
        produce_args = [arg['name'] for arg in self.produce_args]

        for name in list(kwargs.keys()):
            if name in fit_args:
                fit_params[name] = kwargs.pop(name)

            elif name in produce_args:
                produce_params[name] = kwargs.pop(name)

        if kwargs:
            error = "Unexpected hyperparameters '{}'".format(', '.join(kwargs.keys()))
            raise TypeError(error)

        return init_params, fit_params, produce_params
Extract init, fit and produce params from kwargs.

        The `init_params`, `fit_params` and `produce_params` are extracted
        from the passed `kwargs` taking the metadata hyperparameters as a
        reference.

        During this extraction, make sure that all the required hyperparameters
        have been given and that nothing unexpected exists in the input.

        Args:
            kwargs (dict): dict containing the Keyword arguments that have
                           been passed to the `__init__` method upon
                           initialization.
            hyperparameters (dict): hyperparameters dictionary, as found in
                                    the JSON annotation.

        Raises:
            TypeError: A `TypeError` is raised if a required argument is not
                       found in the `kwargs` dict, or if an unexpected
                       argument has been given.