You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@ Documenting your change
46
46
-----------------------
47
47
48
48
If you're adding a class or a function, then you'll need to add a docstring with a doctest. We follow the `numpy docstring convention <https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html>`_, so please do too.
49
-
Any estimator should follow the [scikit-learn API](https://scikit-learn.org/stable/developers/develop.html), so please follow these guidelines.
49
+
Any estimator should follow the `scikit-learn API<https://scikit-learn.org/stable/developers/develop.html>`_, so please follow these guidelines.
Copy file name to clipboardExpand all lines: HISTORY.rst
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ History
5
5
0.1.10 (2024-??-??)
6
6
------------------
7
7
* Long EM and RPCA operations wrapped with tqdm progress bars
8
-
* Readme code sample updated, and results table made consistant
8
+
* Readme code sample updated, and results table made consistent
9
9
10
10
0.1.9 (2024-08-29)
11
11
------------------
@@ -41,7 +41,7 @@ History
41
41
* RPCA algorithms now start with a normalizing scaler
42
42
* The EM algorithms now include a gradient projection step to be more robust to colinearity
43
43
* The EM algorithm based on the Gaussian model is now initialized using a robust estimation of the covariance matrix
44
-
* A bug in the EM algorithm has been patched: the normalizing matrix gamma was creating a sampling biais
44
+
* A bug in the EM algorithm has been patched: the normalizing matrix gamma was creating a sampling bias
45
45
* Speed up of the EM algorithm likelihood maximization, using the conjugate gradient method
46
46
* The ImputeRegressor class now handles the nans by `row` by default
47
47
* The metric `frechet` was not correctly called and has been patched
@@ -67,9 +67,9 @@ History
67
67
-------------------
68
68
69
69
* VAR(p) EM sampler implemented, founding on a VAR(p) modelization such as the one described in `Lütkepohl (2005) New Introduction to Multiple Time Series Analysis`
70
-
* EM and RPCA matrices transposed in the low-level impelmentation, however the API remains unchanged
70
+
* EM and RPCA matrices transposed in the low-level implementation, however the API remains unchanged
71
71
* Sparse matrices introduced in the RPCA implementation so as to speed up the execution
72
-
* Implementation of SoftImpute, which provides a fast but less robust alterantive to RPCA
72
+
* Implementation of SoftImpute, which provides a fast but less robust alternative to RPCA
73
73
* Implementation of TabDDPM and TsDDPM, which are diffusion-based models for tabular data and time-series data, based on Denoising Diffusion Probabilistic Models. Their implementations follow the work of Tashiro et al., (2021) and Kotelnikov et al., (2023).
74
74
* ImputerDiffusion is an imputer-wrapper of these two models TabDDPM and TsDDPM.
75
75
* Docstrings and tests improved for the EM sampler
@@ -100,7 +100,7 @@ been changed into tuple attributes so that all are not immutable
Copy file name to clipboardExpand all lines: docs/analysis.rst
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ Then Qolmat proposes two tests to determine whether the missing data mechanism i
16
16
2. How to use the results
17
17
-------------------------
18
18
19
-
At the end of the MCAR test, it can then be assumed whether the missing data mechanism is MCAR or not. This serves three differents purposes:
19
+
At the end of the MCAR test, it can then be assumed whether or not the missing data mechanism is MCAR. This serves three different purposes:
20
20
21
21
a. Diagnosis
22
22
^^^^^^^^^^^^
@@ -45,7 +45,7 @@ The MCAR missing-data mechanism means that there is independence between the pre
45
45
a. Little's Test
46
46
^^^^^^^^^^^^^^^^
47
47
48
-
The best-known MCAR test is the :ref:`Little [1]<Little-article>` test, and it has been implemented in :class:`LittleTest`. Keep in mind that the Little's test is designed to test the homogeneity of means across the missing patterns and won't be efficient to detect the heterogeneity of covariance accross missing patterns.
48
+
The best-known MCAR test is the :ref:`Little [1]<Little-article>` test, and it has been implemented in :class:`LittleTest`. Keep in mind that the Little's test is designed to test the homogeneity of means across the missing patterns and won't be efficient to detect the heterogeneity of covariance across missing patterns.
Copy file name to clipboardExpand all lines: docs/explanation.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -117,7 +117,7 @@ The observations are said to be Missing at Random (MAR) if the probability of an
117
117
118
118
Finally, the observations are said to be Missing Not at Random (MNAR) in all other cases, i.e. if :math:`P(M | X_{obs}, X_{mis}, \psi)` does not simplify.
119
119
120
-
Qolmat allows to generate new missing values on a an existing dataset, but only in the MCAR case.
120
+
Qolmat allows to generate new missing values on an existing dataset, but only in the MCAR case.
121
121
122
122
Here are the different classes to generate missing data. We recommend the last 3 for time series.
Copy file name to clipboardExpand all lines: docs/imputers.rst
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ See the :class:`~qolmat.imputations.imputers.ImputerRpcaPcp` class for implement
42
42
43
43
**Noisy RPCA** [2, 3, 4]
44
44
45
-
The class :class:`RpcaNoisy` implements an recommanded improved version, which relies on a decomposition :math:`\mathbf{D} = \mathbf{M} + \mathbf{A} + \mathbf{E}`. The additionnal term encodes a Gaussian noise and makes the numerical convergence more reliable. This class also implements a time-consistency penalization for time series, parametrized by the :math:`\eta_k`and :math:`H_k`. By defining :math:`\Vert\mathbf{MH_k} \Vert_p` is either :math:`\Vert\mathbf{MH_k} \Vert_1` or :math:`\Vert\mathbf{MH_k} \Vert_F^2`, the optimisation problem is the following
45
+
The class :class:`RpcaNoisy` implements a recommended improved version, which relies on a decomposition :math:`\mathbf{D} = \mathbf{M} + \mathbf{A} + \mathbf{E}`. The additional term encodes a Gaussian noise and makes the numerical convergence more reliable. This class also implements a time-consistency penalization for time series, parametrized by the :math:`\eta_k`and :math:`H_k`. By defining :math:`\Vert\mathbf{MH_k} \Vert_p` is either :math:`\Vert\mathbf{MH_k} \Vert_1` or :math:`\Vert\mathbf{MH_k} \Vert_F^2`, the optimisation problem is the following
@@ -71,15 +71,15 @@ Suppose the data :math:`\mathbf{X}` has a density :math:`p_\theta` parametrized
71
71
72
72
**Expectation**
73
73
74
-
Draw samples of :math:`\mathbf{X}` assuming a fixed :math:`\theta`, conditionnaly on the values of :math:`\mathbf{X}_\mathrm{obs}`. This is done by MCMC using a projected Langevin algorithm.
74
+
Draw samples of :math:`\mathbf{X}` assuming a fixed :math:`\theta`, conditionally on the values of :math:`\mathbf{X}_\mathrm{obs}`. This is done by MCMC using a projected Langevin algorithm.
75
75
This process is characterized by a time step :math:`h`. Given an initial station :math:`X_0`, one can update the state at iteration *t* as
76
76
77
77
.. math::
78
78
\widetilde X_n = X_{n-1} + \Gamma\nabla L_X(X_{n-1}, \theta_n) (X_{n-1} - \mu) h + (2 h \Gamma)^{1/2} Z_n,
79
79
80
-
where :math:`Z_n` is a vector of independant standard normal random variables and :math:`L` is the log-likelihood.
80
+
where :math:`Z_n` is a vector of independent standard normal random variables and :math:`L` is the log-likelihood.
81
81
The sampled distribution tends to the target one in the limit :math:`h \rightarrow0` and the number of iterations :math:`n \rightarrow\infty`.
82
-
Sampling from the conditionnal distribution :math:`p(\mathbf{X}_{mis} \vert\mathbf{X}_{obs} ; \theta^{(n)})` (see MCEM [6]) is achieved by projecting the samples at each step.
82
+
Sampling from the conditional distribution :math:`p(\mathbf{X}_{mis} \vert\mathbf{X}_{obs} ; \theta^{(n)})` (see MCEM [6]) is achieved by projecting the samples at each step.
83
83
84
84
.. math::
85
85
X_n = Proj_{obs} \left( \widetilde X_n \right),
@@ -113,7 +113,7 @@ Two parametric distributions are implemented:
113
113
114
114
:class:`~qolmat.imputations.diffusions.ddpms.TabDDPM` is a deep learning imputer based on Denoising Diffusion Probabilistic Models (DDPMs) [8] for handling multivariate tabular data. Our implementation mainly follows the works of [8, 9]. Diffusion models focus on modeling the process of data transitions from noisy and incomplete observations to the underlying true data. They include two main processes:
115
115
116
-
* Forward process perturbs observed data to noise until all the original data structures are lost. The pertubation is done over a series of steps. Let :math:`X_{obs}` be observed data, :math:`T` be the number of steps that noises :math:`\epsilon\sim N(0,I)` are added into the observed data. Therefore, :math:`X_{obs}^t = \bar{\alpha}_t \times X_{obs} + \sqrt{1-\bar{\alpha}_t} \times\epsilon` where :math:`\bar{\alpha}_t` controls the right amount of noise.
116
+
* Forward process perturbs observed data to noise until all the original data structures are lost. The perturbation is done over a series of steps. Let :math:`X_{obs}` be observed data, :math:`T` be the number of steps that noises :math:`\epsilon\sim N(0,I)` are added into the observed data. Therefore, :math:`X_{obs}^t = \bar{\alpha}_t \times X_{obs} + \sqrt{1-\bar{\alpha}_t} \times\epsilon` where :math:`\bar{\alpha}_t` controls the right amount of noise.
117
117
* Reverse process removes noise and reconstructs the observed data. At each step :math:`t`, we train an autoencoder :math:`\epsilon_\theta` based on ResNet [10] to predict the added noise :math:`\epsilon_t` based on the rest of the observed data. The objective function is the error between the noise added in the forward process and the noise predicted by :math:`\epsilon_\theta`.
118
118
119
119
In training phase, we use the self-supervised learning method of [9] to train incomplete data. In detail, our model randomly masks a part of observed data and computes loss from these masked data. Moving on to the inference phase, (1) missing data are replaced by Gaussian noises :math:`\epsilon\sim N(0,I)`, (2) at each noise step from :math:`T` to 0, our model denoises these missing data based on :math:`\epsilon_\theta`.
Copy file name to clipboardExpand all lines: examples/benchmark.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ jupyter:
17
17
In Qolmat, a few data imputation methods are implemented as well as a way to evaluate their performance.**
18
18
19
19
20
-
First, import some useful librairies
20
+
First, import some useful libraries
21
21
22
22
```python tags=[]
23
23
import warnings
@@ -54,7 +54,7 @@ from qolmat.utils import data, utils, plot
54
54
55
55
56
56
The dataset `Beijing` is the Beijing Multi-Site Air-Quality Data Set. It consists in hourly air pollutants data from 12 chinese nationally-controlled air-quality monitoring sites and is available at https://archive.ics.uci.edu/ml/machine-learning-databases/00501/.
This part is devoted to the imputation methods. The idea is to try different algorithms and compare them.
99
99
100
100
<u>**Methods**</u>:
101
-
All presented methods are group-wise: here each station is imputed independently. For example ImputerMean computes the mean of each variable in each station and uses the result for imputation; ImputerInterpolation interpolates termporal signals corresponding to each variable on each station.
101
+
All presented methods are group-wise: here each station is imputed independently. For example ImputerMean computes the mean of each variable in each station and uses the result for imputation; ImputerInterpolation interpolates temporal signals corresponding to each variable on each station.
102
102
103
103
<u>**Hyperparameters' search**</u>:
104
104
Some methods require hyperparameters. The user can directly specify them, or rather determine them through an optimization step using the `search_params` dictionary. The keys are the imputation method's name and the values are a dictionary specifying the minimum, maximum or list of categories and type of values (Integer, Real, Category or a dictionary indexed by the variable names) to search.
105
-
In pratice, we rely on a cross validation to find the best hyperparams values minimizing an error reconstruction.
105
+
In practice, we rely on a cross validation to find the best hyperparams values minimizing an error reconstruction.
106
106
107
107
```python tags=[]
108
108
ratio_masked =0.1
@@ -476,7 +476,7 @@ plt.show()
476
476
477
477
478
478
We first check the covariance. We simply plot one variable versus one another.
479
-
One observes the methods provide similar visual resuls: it's difficult to compare them based on this criterion.
479
+
One observes the methods provide similar visual results: it's difficult to compare them based on this criterion.
We are now interested in the auto-correlation function (ACF). As seen before, time series display seaonal patterns.
497
+
We are now interested in the auto-correlation function (ACF). As seen before, time series display seasonal patterns.
498
498
[Autocorrelation](https://en.wikipedia.org/wiki/Autocorrelation) is the correlation of a signal with a delayed copy of itself as a function of delay. It measures the similarity between observations of a random variable as a function of the time lag between them. The objective is to have an ACF to be similar between the original dataset and the imputed one.
0 commit comments