def __init__(self, kernel="linear", min_size=2, jump=1, params=None):
        r"""Creates a KernelCPD instance.

        Available kernels:

        - `linear`: $k(x,y) = x^T y$.
        - `rbf`: $k(x, y) = exp(\gamma \|x-y\|^2)$ where $\gamma>0$
        (`gamma`) is a user-defined parameter.
        - `cosine`: $k(x,y)= (x^T y)/(\|x\|\|y\|)$.

        Args:
            kernel (str, optional): name of the kernel, ["linear", "rbf", "cosine"]
            min_size (int, optional): minimum segment length.
            jump (int, optional): not considered, set to 1.
            params (dict, optional): a dictionary of parameters for the kernel instance

        Raises:
            AssertionError: if the kernel is not implemented.
        """
        self.kernel_name = kernel
        err_msg = "Kernel not found: {}.".format(self.kernel_name)
        assert self.kernel_name in ["linear", "rbf", "cosine"], err_msg
        self.model_name = "l2" if self.kernel_name == "linear" else self.kernel_name
        self.params = params
        # load the associated cost function
        if self.params is None:
            self.cost = cost_factory(model=self.model_name)
        else:
            self.cost = cost_factory(model=self.model_name, **self.params)
        self.min_size = max(min_size, self.cost.min_size)

        self.jump = 1  # set to 1
        self.n_samples = None
        self.segmentations_dict = dict()  # {n_bkps: bkps_list}
Creates a KernelCPD instance.

        Available kernels:

        - `linear`: $k(x,y) = x^T y$.
        - `rbf`: $k(x, y) = exp(\gamma \|x-y\|^2)$ where $\gamma>0$
        (`gamma`) is a user-defined parameter.
        - `cosine`: $k(x,y)= (x^T y)/(\|x\|\|y\|)$.

        Args:
            kernel (str, optional): name of the kernel, ["linear", "rbf", "cosine"]
            min_size (int, optional): minimum segment length.
            jump (int, optional): not considered, set to 1.
            params (dict, optional): a dictionary of parameters for the kernel instance

        Raises:
            AssertionError: if the kernel is not implemented.
        
src/ruptures/detection/kernelcpd.py