class_docstr: Markov Transition Field.
  
  Parameters
  ----------
  image_size : int or float (default = 1.)
      Shape of the output images. If float, it represents a percentage
      of the size of each time series and must be between 0 and 1. Output
      images are square, thus providing the size of one dimension is enough.
  
  n_bins : int (default = 5)
      Number of bins (also known as the size of the alphabet)
  
  strategy : 'uniform', 'quantile' or 'normal' (default = 'quantile')
      Strategy used to define the widths of the bins:
  
      - 'uniform': All bins in each sample have identical widths
      - 'quantile': All bins in each sample have the same number of points
      - 'normal': Bin edges are quantiles from a standard normal distribution
  
  
  overlapping : bool (default = False)
      If False, reducing the image with the blurring kernel
      will be applied on non-overlapping rectangles. If True,
      it will be applied on possibly overlapping squares.
  
  flatten : bool (default = False)
      If True, images are flattened to be one-dimensional.
  
  References
  ----------
  .. [1] Z. Wang and T. Oates, "Encoding Time Series as Images for Visual
         Inspection and Classification Using Tiled Convolutional Neural
         Networks." AAAI Workshop (2015).
  
  Examples
  --------
  >>> from pyts.datasets import load_gunpoint
  >>> from pyts.image import MarkovTransitionField
  >>> X, _, _, _ = load_gunpoint(return_X_y=True)
  >>> transformer = MarkovTransitionField()
  >>> X_new = transformer.transform(X)
  >>> X_new.shape
  (50, 150, 150)
class_docstr_tok: ["Markov","Transition","Field",".","Parameters","--","--","--","--","--","image_size",":","int","or","float","(","default","=","1",".",")","Shape","of","the","output","images",".","If","float",",","it","represents","a","percentage","of","the","size","of","each","time","series","and","must","be","between","0","and","1",".","Output","images","are","square",",","thus","providing","the","size","of","one","dimension","is","enough",".","n_bins",":","int","(","default","=","5",")","Number","of","bins","(","also","known","as","the","size","of","the","alphabet",")","strategy",":","'uniform","'",",","'quantile","'","or","'normal","'","(","default","=","'quantile","'",")","Strategy","used","to","define","the","widths","of","the","bins",":","-","'uniform","'",":","All","bins","in","each","sample","have","identical","widths","-","'quantile","'",":","All","bins","in","each","sample","have","the","same","number","of","points","-","'normal","'",":","Bin","edges","are","quantiles","from","a","standard","normal","distribution","overlapping",":","bool","(","default","=","False",")","If","False",",","reducing","the","image","with","the","blurring","kernel","will","be","applied","on","non-overlapping","rectangles",".","If","True",",","it","will","be","applied","on","possibly","overlapping","squares",".","flatten",":","bool","(","default","=","False",")","If","True",",","images","are","flattened","to","be","one-dimensional",".","References","--","--","--","--","--","..","[","1","]","Z.","Wang","and","T.","Oates",",","``","Encoding","Time","Series","as","Images","for","Visual","Inspection","and","Classification","Using","Tiled","Convolutional","Neural","Networks",".","''","AAAI","Workshop","(","2015",")",".","Examples","--","--","--","--",">",">",">","from","pyts.datasets","import","load_gunpoint",">",">",">","from","pyts.image","import","MarkovTransitionField",">",">",">","X",",","_",",","_",",","_","=","load_gunpoint","(","return_X_y=True",")",">",">",">","transformer","=","MarkovTransitionField","(",")",">",">",">","X_new","=","transformer.transform","(","X",")",">",">",">","X_new.shape","(","50",",","150",",","150",")"]
docstr: Transform each time series into a MTF image.
  
  Parameters
  ----------
  X : array-like, shape = (n_samples, n_timestamps)
      Input data
  
  Returns
  -------
  X_new : array-like, shape = (n_samples, image_size, image_size)
      Transformed data. If ``flatten=True``, the shape is
      `(n_samples, image_size * image_size)`.
docstr_tok: ["Transform","each","time","series","into","a","MTF","image",".","Parameters","--","--","--","--","--","X",":","array-like",",","shape","=","(","n_samples",",","n_timestamps",")","Input","data","Returns","--","--","--","-","X_new",":","array-like",",","shape","=","(","n_samples",",","image_size",",","image_size",")","Transformed","data",".","If","``","flatten=True","``",",","the","shape","is","`","(","n_samples",",","image_size","*","image_size",")","`","."]
code: def transform(self, X):
      """Transform each time series into a MTF image.
  
      Parameters
      ----------
      X : array-like, shape = (n_samples, n_timestamps)
          Input data
  
      Returns
      -------
      X_new : array-like, shape = (n_samples, image_size, image_size)
          Transformed data. If ``flatten=True``, the shape is
          `(n_samples, image_size * image_size)`.
  
      """
      X = check_array(X)
      n_samples, n_timestamps = X.shape
      image_size = self._check_params(n_timestamps)
  
      discretizer = KBinsDiscretizer(
          n_bins=self.n_bins, strategy=self.strategy
      )
      X_binned = discretizer.fit_transform(X)
  
      X_mtm = _markov_transition_matrix(
          X_binned, n_samples, n_timestamps, self.n_bins
      )
      sum_mtm = X_mtm.sum(axis=2)
      np.place(sum_mtm, sum_mtm == 0, 1)
      X_mtm /= sum_mtm[:, :, None]
  
      X_mtf = _markov_transition_field(
          X_binned, X_mtm, n_samples, n_timestamps, self.n_bins
      )
  
      window_size, remainder = divmod(n_timestamps, image_size)
      if remainder == 0:
          X_amtf = np.reshape(
              X_mtf,
              (
                  n_samples,
                  image_size,
                  window_size,
                  image_size,
                  window_size,
              ),
          ).mean(axis=(2, 4))
      else:
          window_size += 1
          start, end, _ = segmentation(
              n_timestamps, window_size, self.overlapping, image_size
          )
          X_amtf = _aggregated_markov_transition_field(
              X_mtf, n_samples, image_size, start, end
          )
      if self.flatten:
          return X_amtf.reshape(n_samples, -1)
      return X_amtf
  
file_path: pyts/pyts/image/mtf.py
imports: import numpy
  from math import ceil
  from numba import njit, prange
  from sklearn.base import BaseEstimator
  from sklearn.utils.validation import check_array
  from ..base import UnivariateTransformerMixin
  from ..preprocessing import KBinsDiscretizer
  from ..utils import segmentation
label_desc: Use image node_id 3 for calling the MarkovTransitionField obj's underlying member method code with example usage: obj.transform(X) and returns: X_amtf, X_amtf