fuzzyclust.incomplete.make_mcar#
- fuzzyclust.incomplete.make_mcar(X, missing_rate=0.2, random_state=None, return_mask=False)[source]#
Remove values missing completely at random (MCAR) from a data matrix.
Every entry is deleted independently with probability
missing_rateand replaced byNaN. Two repairs keep the result usable by every strategy ofIncompleteFCM: a sample that would lose all its features keeps one randomly chosen value, and a feature that would be lost everywhere keeps one randomly chosen sample. The deletion mechanism is the one of the experiments of Hathaway and Bezdek (2001).- Parameters:
- Xarray_like
ofshape(n_samples,n_features) Complete data.
- missing_rate
float, default=0.2 Probability of every entry being missing, in
[0, 1).- random_state
int,RandomStateinstanceorNone - return_maskbool, default=False
Also return the boolean mask of the deleted entries.
- Xarray_like
- Returns:
Examples
>>> import numpy as np >>> from fuzzyclust.incomplete import make_mcar >>> X = np.arange(20.0).reshape(10, 2) >>> Xm, mask = make_mcar(X, missing_rate=0.3, random_state=0, return_mask=True) >>> bool(np.isnan(Xm).sum() == mask.sum()), bool((~mask).any(axis=1).all()) (True, True)
Examples using fuzzyclust.incomplete.make_mcar#
Clustering incomplete data: the four strategies of Hathaway and Bezdek
Clustering incomplete data: the four strategies of Hathaway and Bezdek
Imputation by clustering: accuracy of the completed values
Imputation by clustering: accuracy of the completed values