skdim.id.MLE#
- class skdim.id.MLE(dnoise=None, sigma=0, n=None, integral_approximation='Haro', unbiased=False, neighborhood_based=True, K=5)[source]#
Intrinsic dimension estimation using the Maximum Likelihood algorithm. [Haro2008] [Hill1975] [Levina2005] [IDJohnsson]
The estimators are based on the referenced paper by Haro et al. (2008), using the assumption that there is a single manifold. The estimator in the paper is obtained using default parameters and dnoise = ‘dnoiseGaussH’.
With integral.approximation = ‘Haro’ the Taylor expansion approximation of r^(m-1) that Haro et al. (2008) used are employed.
With integral.approximation = ‘guaranteed.convergence’, r is factored out and kept and r^(m-2) is approximated with the corresponding Taylor expansion.
This guarantees convergence of the integrals. Divergence might be an issue when the noise is not sufficiently small in comparison to the smallest distances. With integral.approximation = ‘iteration’, five iterations is used to determine m.
- Parameters:
dnoise (None or 'dnoiseGaussH') – Vector valued function giving the transition density. ‘dnoiseGaussH’ is the one used in Haro
sigma (float, default=0) – Estimated standard deviation for the noise.
n (int, default='None') – Dimension of the noise (at least data.shape[1])
integral.approximation (str, default='Haro') – Can take values ‘Haro’, ‘guaranteed.convergence’, ‘iteration’
unbiased (bool, default=False) – Whether to correct bias or not
neighborhood.based (bool, default=True) – Means that estimation is made for each neighborhood, otherwise the estimation is based on distances in the entire data set.
comb (str, default='mle') – How to aggregate the pointwise estimates. Possible values ‘mle’, ‘mean’, ‘median’
K (int, default=5) – Number of neighbors per data point that is considered, only used for neighborhood.based = FALSE
Methods
fit(X[, y, precomputed_knn_arrays, smooth, ...])Fitting method for local ID estimators :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 :param precomputed_knn_arrays: Provide two precomputed arrays: (sorted nearest neighbor distances, sorted nearest neighbor indices) :type precomputed_knn_arrays: tuple[ np.array (n_samples x n_dims), np.array (n_samples x n_dims) ] :param n_neighbors: Number of nearest neighbors to use (ignored when using precomputed_knn) :type n_neighbors: int, default=self._N_NEIGHBORS :param n_jobs: Number of processes :type n_jobs: int :param smooth: 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_ :type smooth: bool, default = False.fit_once(X)fit_predict(X[, y, precomputed_knn_arrays, ...])Fit-predict method for local ID estimators :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 :param precomputed_knn_arrays: Provide two precomputed arrays: (sorted nearest neighbor distances, sorted nearest neighbor indices) :type precomputed_knn_arrays: tuple[ np.array (n_samples x n_dims), np.array (n_samples x n_dims) ] :param n_neighbors: Number of nearest neighbors to use (ignored when using precomputed_knn) :type n_neighbors: int, default=self._N_NEIGHBORS :param n_jobs: Number of processes :type n_jobs: int :param smooth: 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_ :type smooth: bool, default = False.fit_transform(X[, y, ...])Fit-transform method for local ID estimators
fit_transform_pw(X[, ...])Returns an array of pointwise ID estimates by fitting the estimator in kNN of each point.
Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
set_fit_request(*[, comb, n_jobs, ...])Configure whether metadata should be requested to be passed to the
fitmethod.set_params(**params)Set the parameters of this estimator.
transform([X])Predict ID 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