Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hint mechanism different in the paper? #2

Closed
rcamino opened this issue Aug 6, 2018 · 11 comments
Closed

Hint mechanism different in the paper? #2

rcamino opened this issue Aug 6, 2018 · 11 comments

Comments

@rcamino
Copy link

rcamino commented Aug 6, 2018

In the paper the hint mechanism is generated by first selecting one feature by row in a vector called k.

Then a matrix b with the same size of the mask m is created, with a one per row according to k and the rest set to zero.

Then the hint is created with the equation:

h = b * m + 0.5 * (1.0 - b)

Which means that the hint is almost a copy of m but has exactly one 0.5 per row.

In your implementation, the hint is created by removing ones of the mask m with a probability of 0.9 (or a probability of keeping them of 0.1). There are no 0.5 values in the hint.

# 1. Mini batch size
mb_size = 128
# 2. Missing rate
p_miss = 0.5
# 3. Hint rate
p_hint = 0.9
# 4. Loss Hyperparameters
alpha = 10
# 5. Imput Dim (Fixed)
Dim = 784
def sample_M(m, n, p):
    A = np.random.uniform(0., 1., size = [m, n])
    B = A > p
    C = 1.*B
    return C
M_mb = sample_M(mb_size, Dim, p_miss)
H_mb1 = sample_M(mb_size, Dim, 1-p_hint)
H_mb = M_mb * H_mb1

Am I understanding something wrong?
Thank you.

@jsyoon0823
Copy link
Owner

In practice, providing 90% of the mask vector as the hints make the best performance. (Hint is only given to the known features)
In theory (in the paper), providing one feature as a hint converges to the optimal solution with MCAR setting.

@rcamino
Copy link
Author

rcamino commented Aug 6, 2018

Thank you for the quick answer.

Besides the convergence question, I still have the doubt about the 0.5.

In the paper I understood that the hint was indicating:

  • 1 -> known original value
  • 0 -> known imputed value
  • 0.5 -> unknown

And the discriminator has to define if the 0.5 is an original or an inputed value.

But in this implementation, the hint shows:

  • 1 -> known original value
  • 0 -> unknown

So the hint is only helping in the known original values, but giving no hint about the missing values?

@jsyoon0823
Copy link
Owner

Yes.
In this code, the hint is only provided to the known variables.
Therefore, the discriminator has to determine if the 0 is an original or an imputed value.
We don't provide the imputed variables as the hint; therefore, we don't need to introduce 0.5 here.
Thanks.

@ElApseR
Copy link

ElApseR commented Jan 1, 2019

I have tested two types of hint : original paper vs. this code
and I found out that the performance of these two models were almost the same.
Although the variance of MSE test loss designed by the original paper(using 0.5 for hint) was bit higher, it didn't seem that meaningful.
2019-01-01 7 32 32

@jsyoon0823
Copy link
Owner

Usually, on missing completely at random setting, hint does not have a big impact on the results.

@guoliangxie123
Copy link

1.The Imputed Matrix is equal to the Hat_New_X?
2.when i try to print the Hat_New_X, I find that some 0 positions are not imputed ,Is it 0 in the original data?
look forward to your reply

@jsyoon0823
Copy link
Owner

  1. Yes. G_sample is the output of the generator and Hat_New_X is the matrix that only missing values are replaced by G_sample.
  2. Yes. some of them have 0 as the original values.
    Thanks!

@guoliangxie123
Copy link

Thank you for the quick answer.

  1. Is the letter data in your codes containing missing values? And has been filled with 0.
  2. I can't compare the imputed data with the original dataset because there is no raw dataset
    I recently wrote a paper to quote your paper to impute the data, but the effect is not ideal

@jsyoon0823
Copy link
Owner

  1. No. The letter data is complete data.
  • I introduce the missing in line 51-59 and 210.
  • Please check those lines.
  1. The original raw data is always there that you can compare.
  • Please see line 233 and 186.

@ainilaha
Copy link

In the paper, Figure 1 shows, you feed three matrixes, including data matrix, random matrix, mask matrix, but I do not see you feeding random matrix to the generator. What is the random matrix?

@jsyoon0823
Copy link
Owner

You can see how we use random matrix in this link (https://github.com/jsyoon0823/GAIN/blob/master/gain.py#L168-L169)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants