docs: def binned_entropy(x, max_bins):
      """
      First bins the values of x into max_bins equidistant bins.
      Then calculates the value of
  
      .. math::
  
          - \\sum_{k=0}^{min(max\\_bins, len(x))} p_k log(p_k) \\cdot \\mathbf{1}_{(p_k > 0)}
  
      where :math:`p_k` is the percentage of samples in bin :math:`k`.
  
      :param x: the time series to calculate the feature of
      :type x: numpy.ndarray
      :param max_bins: the maximal number of bins
      :type max_bins: int
      :return: the value of this feature
      :return type: float
      """
      if not isinstance(x, (np.ndarray, pd.Series)):
          x = np.asarray(x)
      hist, bin_edges = np.histogram(x, bins=max_bins)
      probs = hist / x.size
      return - np.sum(p * np.math.log(p) for p in probs if p != 0)