skdim.id.CorrInt

class skdim.id.CorrInt(k1=10, k2=20, DM=False)[source]

Intrinsic dimension estimation using the Correlation Dimension. [Grassberger1983] [IDHino]

Parameters:
k1 : int

First neighborhood size considered

k2 : int

Last neighborhood size considered

DM : bool, default=False

Is the input a precomputed distance matrix (dense)

Methods

fit(X[, y]) A reference implementation of a fitting function.
fit_pw(X[, precomputed_knn, smooth, …]) Creates an array of pointwise ID estimates (self.dimension_pw_) by fitting the estimator in kNN of each point.
fit_transform(X[, y]) Fit estimator and return ID
fit_transform_pw(X[, precomputed_knn, …]) Returns an array of pointwise ID estimates by fitting the estimator in kNN of each point.
get_params([deep]) Get parameters for this estimator.
set_params(**params) Set the parameters of this estimator.
transform([X]) Predict dimension after a previous call to self.fit
transform_pw([X]) Return an array of pointwise ID estimates after a previous call to self.fit_pw
fit(X, y=None)[source]

A reference implementation of a fitting function. :param X: The training input samples. :type X: {array-like}, shape (n_samples, n_features) :param y: :type y: dummy parameter to respect the sklearn API

Returns:self (object) – Returns self.
fit_pw(X, precomputed_knn=None, smooth=False, n_neighbors=100, n_jobs=1)

Creates an array of pointwise ID estimates (self.dimension_pw_) by fitting the estimator in kNN of each point.

Parameters:
X : np.array (n_samples x n_neighbors)

Dataset to fit

precomputed_knn : np.array (n_samples x n_dims)

An array of precomputed (sorted) nearest neighbor indices

n_neighbors

Number of nearest neighbors to use (ignored when using precomputed_knn)

n_jobs : int

Number of processes

smooth : bool, default = False

Additionally computes a smoothed version of pointwise estimates by

taking the ID of a point as the average ID of each point in its neighborhood (self.dimension_pw_)

smooth_

Returns:

self (object) – Returns self

fit_transform(X, y=None)

Fit estimator and return ID

Parameters:
X : {array-like}, shape (n_samples, n_features)

The training input samples.

Returns:

dimension_ ({int, float}) – The estimated intrinsic dimension

fit_transform_pw(X, precomputed_knn=None, smooth=False, n_neighbors=100, n_jobs=1)

Returns an array of pointwise ID estimates by fitting the estimator in kNN of each point.

Parameters:
X : np.array (n_samples x n_neighbors)

Dataset to fit

precomputed_knn : bool

An array of precomputed (sorted) nearest neighbor indices

n_neighbors

Number of nearest neighbors to use (ignored when using precomputed_knn)

n_jobs : int

Number of processes

smooth : bool, default = False

Additionally computes a smoothed version of pointwise estimates by

taking the ID of a point as the average ID of each point in its neighborhood (self.dimension_pw_)

smooth_

Returns:

  • dimension_pw_ (np.array with dtype {int, float}) – Pointwise ID estimates
  • dimension_pw_smooth_ (np.array with dtype float) – Smoothed pointwise ID estimates returned if self.fit_pw(smooth=True)

get_params(deep=True)

Get parameters for this estimator.

Parameters:
deep : bool, default=True

If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns:

params (dict) – Parameter names mapped to their values.

set_params(**params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Parameters:
**params : dict

Estimator parameters.

Returns:

self (estimator instance) – Estimator instance.

transform(X=None)

Predict dimension after a previous call to self.fit

Parameters:
X : Dummy parameter

Returns:

dimension_ ({int, float}) – The estimated ID

transform_pw(X=None)

Return an array of pointwise ID estimates after a previous call to self.fit_pw

Parameters:
X : Dummy parameter

Returns:

  • dimension_pw_ (np.array with dtype {int, float}) – Pointwise ID estimates
  • dimension_pw_smooth_ (np.array with dtype float) – Smoothed pointwise ID estimates returned if self.fit_pw(smooth=True)