src.cmfsapy.dimension package

Submodules

src.cmfsapy.dimension.cmfsa module

src.cmfsapy.dimension.cmfsa.calibrate(n=2500, myk=20, emb_dims=array([2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80]), N_realiz=100, powers=[- 1, 1, 2, 3], box=None, load_data=False, save_data=False)

Computes regression coefs on calibration dataset with known intrinsic dimensionality

Parameters
  • n (int) – sample size per realization

  • myk (int) – maximal neighborhood size

  • of int emb_dims (numpy.ndarray) – embedding dimensions to estimate dimension

  • N_realiz (int) – number of realizations per embedding dimension

  • of in powers (list) – powers to be used in the polynomial basis

  • or float box (None) – box size for periodic boundary (default=None)

  • or str load_data (bool) – if a string, then took as path to data

  • or str save_data (bool) – if a string then took as path to save

Returns

regression coefficients

Return type

list of float

src.cmfsapy.dimension.cmfsa.cmfsa(X, k, powers=None, alphas=None, boxsize=None)

Computes corrigated dimension estimations on dataset @todo: Hard-wire default values from the article

Parameters
  • of float X (numpy.ndarray) – data

  • k (int) –

  • of float powers (list) – powers

  • of float alphas (list) – regression coeffitients

  • boxsize (float) –

Returns

src.cmfsapy.dimension.correction module

src.cmfsapy.dimension.correction.compute_mFSA_correction_coef(d, E, powers=[1, 2])

Compute the regression coefficients with Orthogonal Distance Regression

Parameters
  • of float d (numpy.ndarray) – dimension values

  • of float E (numpy.ndarray) – relative error

  • of float powers (numpy.ndarray) – the powers of the polynomial to include in the regression

Returns

regression coefficients

Return type

numpy.ndarray of float

src.cmfsapy.dimension.correction.correct_estimates(d, alpha, powers)

Correct mFSA estimates given rergression coefficients and the coresponding powers of the polynomial

Parameters
  • d (float) – measured mFSA value(s)

  • of float alpha (numpy.ndarray) – regression coefs

  • of float powers (numpy.ndarray) – powers of the polynomial

Returns

corrigated-mFSA value(s)

Return type

float

src.cmfsapy.dimension.correction.correct_mFSA(d, E, powers)

Correct mFSA values given the relative error of the measurements fit

Parameters
  • of float d (numpy.ndarray) – mFSA values

  • of float E (numpy.ndarray) – relative error of mFSA values

  • of float powers (numpy.ndarray) –

Returns

corrected estimates

Return type

numpy.ndarray of float

src.cmfsapy.dimension.correction.polynom_func(p, x, powers=[1, 2, 3])

Computes the value of polynomial expression with given mixing coefficients and powers

Parameters
  • of float p (list) – mixing coefficients (length has to match the length of powers)

  • or numpy.ndarray of float x (float) – the value of the variable

  • of float powers (list) – the powers of (length has to match the length of p)

Returns

the value of the polynomial at the place x

Return type

float or numpy.ndarray of float

src.cmfsapy.dimension.fsa module

src.cmfsapy.dimension.fsa.fsa(X, k, boxsize=None)

Measure local Szepesvari-Farahmand dimension, distances are computed by the cKDTree algoritm

Parameters
  • X (arraylike) – data series [n x dim] shape

  • k – maximum k value

  • boxsize – apply d-toroidal distance computation with edge-size =boxsize, see ckdtree class for more

Returns

local estimates, distances, indicees

src.cmfsapy.dimension.fsa.get_dists_inds_ck(X, k, boxsize)

computes the kNN distances and indices

Parameters
  • X (numpy.ndarray) – 2D array with data shape: (ndata, n_vars)

  • k (int) – neighborhood size

  • boxsize (float) – circular boundary condition to [0, boxsice] interval for all input dimensions if not None.

Returns

KNN distances and indices

src.cmfsapy.dimension.fsa.ml_dims(X, k2, k1=1)

Maximum likelihood estimator af intrinsic dimension (Levina-Bickel)

src.cmfsapy.dimension.fsa.ml_estimator(normed_dists)
src.cmfsapy.dimension.fsa.szepes_ml(local_d)

maximum likelihood estimator from local FSA estimates (for k=1)

Parameters

of float local_d (numpy.ndarray) – local FSA estimates

Returns

global ML-FSA estimate

src.cmfsapy.dimension.fsa.szepesvari_dimensionality(dists)

Compute szepesvari dimensions from kNN distances

Parameters

dists

Returns

Module contents