class_docstr: Heteregeneous Intrinsic Dimensionality Algorithm (Hidalgo) model.
  
  Hidalgo is a robust approach in discriminating regions with
  different local intrinsic dimensionality (topological feature
  measuring complexity). Hidalgo offers unsupervised segmentation
  of high-dimensional data.
  
  Parameters
  ----------
  metric : str, or callable, optional, default="euclidean"
      directly passed to sklearn KNearestNeighbors,
      must be str or callable that can be passed to KNearestNeighbors
      distance used in the nearest neighbors part of the algorithm
  K : int, optional, default=2
      number of manifolds used in algorithm
  zeta : float, optional, default=0.8
      "local homogeneity level" used in the algorithm, see equation (4)
  q : int, optional, default=3
      number of points for local Z interaction, "local homogeneity range"
      see equation (4)
  n_iter : int, optional, default=1000
      number of Gibbs sampling iterations
  n_replicas : int, optional, default=1
      number of random starts to run Gibbs sampling
  burn_in : float, optional, default=0.9
      percentage of Gibbs sampling iterations discarded, "burn-in fraction"
  fixed_Z : bool, optional, default=False
      estimate parameters with fixed z (joint posterior approximation via Gibbs)
      z = (z_1, ..., z_K) is a latent variable introduced, where z_i = k
      indicates point i belongs to manifold K
  use_Potts : bool, optional, default=True
      if using local interaction between z, see equation (4)
  estimate_zeta : bool, optional, default=False
      update zeta in the sampling
  sampling_rate: int, optional, default=10
      rate at which to save samples for each n_iter
  a : np.ArrayLike, optional, default=None
      prior parameters of d, the dimensionality of manifold k
  b : np.ArrayLike, optional, default=None
      prior parameters of d, the dimensionality of manifold k
  c : np.ArrayLike, optional, default=None
      prior parameters of p, the probability that point belongs to manifold k
  f : np.ArrayLike, optional, default=None
      parameters of zeta
  seed : int, optional, default = 1
      generate random numbers with seed
  
  References
  ----------
  Allegra, Michele, et al. "Data segmentation based on the local
  intrinsic dimension." Scientific reports 10.1 (2020): 1-12.
  https://www.nature.com/articles/s41598-020-72222-0
  
  
  Examples
  --------
  >>> from sktime.transformations.series.hidalgo import Hidalgo
  >>> import numpy as np
  >>> np.random.seed(123)
  >>> X = np.random.rand(10,3)
  >>> X[:6, 1:] += 10
  >>> X[6:, 1:] = 0
  >>> model = Hidalgo(K=2, burn_in=0.8, n_iter=100, seed=10)
  >>> fitted_model = model.fit(X)
  >>> Z = fitted_model.transform(X)
  >>> Z.tolist()
  [1, 1, 1, 1, 1, 1, 0, 0, 0, 0]
class_docstr_tok: ["Heteregeneous","Intrinsic","Dimensionality","Algorithm","(","Hidalgo",")","model",".","Hidalgo","is","a","robust","approach","in","discriminating","regions","with","different","local","intrinsic","dimensionality","(","topological","feature","measuring","complexity",")",".","Hidalgo","offers","unsupervised","segmentation","of","high-dimensional","data",".","Parameters","--","--","--","--","--","metric",":","str",",","or","callable",",","optional",",","default=","''","euclidean","''","directly","passed","to","sklearn","KNearestNeighbors",",","must","be","str","or","callable","that","can","be","passed","to","KNearestNeighbors","distance","used","in","the","nearest","neighbors","part","of","the","algorithm","K",":","int",",","optional",",","default=2","number","of","manifolds","used","in","algorithm","zeta",":","float",",","optional",",","default=0.8","``","local","homogeneity","level","''","used","in","the","algorithm",",","see","equation","(","4",")","q",":","int",",","optional",",","default=3","number","of","points","for","local","Z","interaction",",","``","local","homogeneity","range","''","see","equation","(","4",")","n_iter",":","int",",","optional",",","default=1000","number","of","Gibbs","sampling","iterations","n_replicas",":","int",",","optional",",","default=1","number","of","random","starts","to","run","Gibbs","sampling","burn_in",":","float",",","optional",",","default=0.9","percentage","of","Gibbs","sampling","iterations","discarded",",","``","burn-in","fraction","''","fixed_Z",":","bool",",","optional",",","default=False","estimate","parameters","with","fixed","z","(","joint","posterior","approximation","via","Gibbs",")","z","=","(","z_1",",","...",",","z_K",")","is","a","latent","variable","introduced",",","where","z_i","=","k","indicates","point","i","belongs","to","manifold","K","use_Potts",":","bool",",","optional",",","default=True","if","using","local","interaction","between","z",",","see","equation","(","4",")","estimate_zeta",":","bool",",","optional",",","default=False","update","zeta","in","the","sampling","sampling_rate",":","int",",","optional",",","default=10","rate","at","which","to","save","samples","for","each","n_iter","a",":","np.ArrayLike",",","optional",",","default=None","prior","parameters","of","d",",","the","dimensionality","of","manifold","k","b",":","np.ArrayLike",",","optional",",","default=None","prior","parameters","of","d",",","the","dimensionality","of","manifold","k","c",":","np.ArrayLike",",","optional",",","default=None","prior","parameters","of","p",",","the","probability","that","point","belongs","to","manifold","k","f",":","np.ArrayLike",",","optional",",","default=None","parameters","of","zeta","seed",":","int",",","optional",",","default","=","1","generate","random","numbers","with","seed","References","--","--","--","--","--","Allegra",",","Michele",",","et","al",".","``","Data","segmentation","based","on","the","local","intrinsic","dimension",".","''","Scientific","reports","10.1","(","2020",")",":","1-12.","https",":","\/\/www.nature.com\/articles\/s41598-020-72222-0","Examples","--","--","--","--",">",">",">","from","sktime.transformations.series.hidalgo","import","Hidalgo",">",">",">","import","numpy","as","np",">",">",">","np.random.seed","(","123",")",">",">",">","X","=","np.random.rand","(","10,3",")",">",">",">","X","[",":6",",","1",":","]","+=","10",">",">",">","X","[","6",":",",","1",":","]","=","0",">",">",">","model","=","Hidalgo","(","K=2",",","burn_in=0.8",",","n_iter=100",",","seed=10",")",">",">",">","fitted_model","=","model.fit","(","X",")",">",">",">","Z","=","fitted_model.transform","(","X",")",">",">",">","Z.tolist","(",")","[","1",",","1",",","1",",","1",",","1",",","1",",","0",",","0",",","0",",","0","]"]
docstr: Run the Hidalgo algorithm.
  
  Find parameter estimates as distributions in sampling.
  Iterate through n_replicas random starts and get posterior
  samples with best max likelihood.
  
  Notes
  -----
  Writes to self
  _d : 1D np.ndarray of length K
      posterior mean of d, from posterior sample in gibbs_sampling
  _derr : 1D np.ndarray of length K
      posterior std of d, from posterior sample in gibbs_sampling
  _p : 1D np.ndarray of length K
      posterior mean of p, from posterior sample in gibbs_sampling
  _perr : 1D np.ndarray of length K
      posterior std of p, from posterior sample in gibbs_sampling
  _lik : float
      mean of likelihood, from sample in gibbs_sampling
  _likerr : float
      std of likelihood, from sample in gibbs_sampling
  _Pi : 2D np.ndarray of shape (K, N)
      probability of posterior of z_i = k, point i can be safely
      assigned to manifold k if Pi > 0.8
  _Z : 1D np.ndarray of length N
      base-zero integer values corresponding to segment (manifold k)
  
  Parameters
  ----------
  X : 2D np.ndarray of shape (N, dim), where dim > 1
      data to fit the algorithm to
  
  Returns
  -------
  self
docstr_tok: ["Run","the","Hidalgo","algorithm",".","Find","parameter","estimates","as","distributions","in","sampling",".","Iterate","through","n_replicas","random","starts","and","get","posterior","samples","with","best","max","likelihood",".","Notes","--","--","-","Writes","to","self","_d",":","1D","np.ndarray","of","length","K","posterior","mean","of","d",",","from","posterior","sample","in","gibbs_sampling","_derr",":","1D","np.ndarray","of","length","K","posterior","std","of","d",",","from","posterior","sample","in","gibbs_sampling","_p",":","1D","np.ndarray","of","length","K","posterior","mean","of","p",",","from","posterior","sample","in","gibbs_sampling","_perr",":","1D","np.ndarray","of","length","K","posterior","std","of","p",",","from","posterior","sample","in","gibbs_sampling","_lik",":","float","mean","of","likelihood",",","from","sample","in","gibbs_sampling","_likerr",":","float","std","of","likelihood",",","from","sample","in","gibbs_sampling","_Pi",":","2D","np.ndarray","of","shape","(","K",",","N",")","probability","of","posterior","of","z_i","=","k",",","point","i","can","be","safely","assigned","to","manifold","k","if","Pi",">","0.8","_Z",":","1D","np.ndarray","of","length","N","base-zero","integer","values","corresponding","to","segment","(","manifold","k",")","Parameters","--","--","--","--","--","X",":","2D","np.ndarray","of","shape","(","N",",","dim",")",",","where","dim",">","1","data","to","fit","the","algorithm","to","Returns","--","--","--","-","self"]
code: def _fit(self, X, y=None):
      """Run the Hidalgo algorithm.
  
      Find parameter estimates as distributions in sampling.
      Iterate through n_replicas random starts and get posterior
      samples with best max likelihood.
  
      Notes
      -----
      Writes to self
      _d : 1D np.ndarray of length K
          posterior mean of d, from posterior sample in gibbs_sampling
      _derr : 1D np.ndarray of length K
          posterior std of d, from posterior sample in gibbs_sampling
      _p : 1D np.ndarray of length K
          posterior mean of p, from posterior sample in gibbs_sampling
      _perr : 1D np.ndarray of length K
          posterior std of p, from posterior sample in gibbs_sampling
      _lik : float
          mean of likelihood, from sample in gibbs_sampling
      _likerr : float
          std of likelihood, from sample in gibbs_sampling
      _Pi : 2D np.ndarray of shape (K, N)
          probability of posterior of z_i = k, point i can be safely
          assigned to manifold k if Pi > 0.8
      _Z : 1D np.ndarray of length N
          base-zero integer values corresponding to segment (manifold k)
  
      Parameters
      ----------
      X : 2D np.ndarray of shape (N, dim), where dim > 1
          data to fit the algorithm to
  
      Returns
      -------
      self
      """
      K = self.K
      n_replicas = self.n_replicas
      n_iter = self.n_iter
      sampling_rate = self.sampling_rate
      burn_in = self.burn_in
      seed = self.seed
  
      _rng = check_random_state(seed)
  
      (
          N,
          mu,
          Iin,
          Iout,
          Iout_count,
          Iout_track,
      ) = self._get_neighbourhood_params(X)
      V, NN, a1, b1, c1, Z, f1, N_in = self._initialise_params(
          N, mu, Iin, _rng
      )
  
      Npar = N + 2 * K + 2 + 1
      bestsampling = np.zeros(shape=0)
      maxlik = -1e10
  
      for _ in range(n_replicas):
          sampling = self._gibbs_sampling(
              N,
              mu,
              Iin,
              Iout,
              Iout_count,
              Iout_track,
              V,
              NN,
              a1,
              b1,
              c1,
              Z,
              f1,
              N_in,
              _rng,
          )
          sampling = np.reshape(sampling, (n_iter, Npar))
  
          idx = [
              it
              for it in range(n_iter)
              if it % sampling_rate == 0 and it >= n_iter * burn_in
          ]
          sampling = sampling[idx,]
  
          lik = np.mean(sampling[:, -1], axis=0)
  
          if lik > maxlik:
              bestsampling = sampling
              maxlik = lik
  
      self._d = np.mean(bestsampling[:, :K], axis=0)
      self._derr = np.std(bestsampling[:, :K], axis=0)
      self._p = np.mean(bestsampling[:, K : 2 * K], axis=0)
      self._perr = np.std(bestsampling[:, K : 2 * K], axis=0)
      self._lik = np.mean(bestsampling[:, -1], axis=0)
      self._likerr = np.std(bestsampling[:, -1], axis=0)
  
      Pi = np.zeros((K, N))
  
      for k in range(K):
          Pi[k, :] = np.sum(
              bestsampling[:, (2 * K) + 1 : 2 * K + N + 1] == k, axis=0
          )
  
      Pi = Pi / len(idx)
      self._Pi = Pi
  
      Z = np.argmax(Pi, axis=0)
      pZ = np.max(Pi, axis=0)
      Z[np.where(pZ < 0.8)] = -1
      self._Z = Z
  
      return self
  
file_path: sktime/sktime/transformations/series/hidalgo.py
imports: from functools import reduce
  import numpy
  from sklearn.neighbors import NearestNeighbors
  from sklearn.utils.validation import check_random_state
  from sktime.transformations.base import BaseTransformer
label_desc: Use image node_id 6 for calling the Hidalgo obj's underlying member method code with example usage: obj._fit(X, y) and returns: self