class_docstr: Base pairwise transformer for panel data template class.
  
  The base pairwise transformer specifies the methods and method signatures that all
  pairwise transformers have to implement.
  
  Specific implementations of these methods is deferred to concrete classes.
class_docstr_tok: ["Base","pairwise","transformer","for","panel","data","template","class",".","The","base","pairwise","transformer","specifies","the","methods","and","method","signatures","that","all","pairwise","transformers","have","to","implement",".","Specific","implementations","of","these","methods","is","deferred","to","concrete","classes","."]
docstr: Compute diagonal of distance/kernel matrix.
  
  Behaviour: returns diagonal of distance/kernel matrix for samples in X
  
  Parameters
  ----------
  X : Series or Panel, any supported mtype, of n instances
      Data to transform, of python type as follows:
          Series: pd.Series, pd.DataFrame, or np.ndarray (1D or 2D)
          Panel: pd.DataFrame with 2-level MultiIndex, list of pd.DataFrame,
              nested pd.DataFrame, or pd.DataFrame in long/wide format
          subject to sktime mtype format specifications, for further details see
              examples/AA_datatypes_and_datasets.ipynb
  
  Returns
  -------
  diag: np.array of shape [n]
      i-th entry contains distance/kernel between X[i] and X[i]
docstr_tok: ["Compute","diagonal","of","distance\/kernel","matrix",".","Behaviour",":","returns","diagonal","of","distance\/kernel","matrix","for","samples","in","X","Parameters","--","--","--","--","--","X",":","Series","or","Panel",",","any","supported","mtype",",","of","n","instances","Data","to","transform",",","of","python","type","as","follows",":","Series",":","pd.Series",",","pd.DataFrame",",","or","np.ndarray","(","1D","or","2D",")","Panel",":","pd.DataFrame","with","2-level","MultiIndex",",","list","of","pd.DataFrame",",","nested","pd.DataFrame",",","or","pd.DataFrame","in","long\/wide","format","subject","to","sktime","mtype","format","specifications",",","for","further","details","see","examples\/AA_datatypes_and_datasets.ipynb","Returns","--","--","--","-","diag",":","np.array","of","shape","[","n","]","i-th","entry","contains","distance\/kernel","between","X","[","i","]","and","X","[","i","]"]
code: def transform_diag(self, X):
      """Compute diagonal of distance/kernel matrix.
  
      Behaviour: returns diagonal of distance/kernel matrix for samples in X
  
      Parameters
      ----------
      X : Series or Panel, any supported mtype, of n instances
          Data to transform, of python type as follows:
              Series: pd.Series, pd.DataFrame, or np.ndarray (1D or 2D)
              Panel: pd.DataFrame with 2-level MultiIndex, list of pd.DataFrame,
                  nested pd.DataFrame, or pd.DataFrame in long/wide format
              subject to sktime mtype format specifications, for further details see
                  examples/AA_datatypes_and_datasets.ipynb
  
      Returns
      -------
      diag: np.array of shape [n]
          i-th entry contains distance/kernel between X[i] and X[i]
      """
      import numpy as np
  
      from sktime.datatypes._vectorize import VectorizedDF
  
      X = self._pairwise_panel_x_check(X)
      X_spl = VectorizedDF(X, iterate_as="Series")
  
      diag = np.zeros(len(X_spl))
  
      for i, X_instance in enumerate(X_spl):
          diag[i] = self.transform(X=X_instance)
  
      return diag
  
imports: from sktime.base import BaseEstimator
  from sktime.datatypes import check_is_scitype, convert_to
  from sktime.datatypes._series_as_panel import convert_Series_to_Panel
label_desc: Use image node_id 9 for calling the BasePairwiseTransformerPanel obj's underlying member method code with example usage: obj.transform_diag(X) and returns: diag