grf-labs/sufrep

example on readme homepage is off/wrong

spinkney opened this issue · 1 comments

The example has this

train.df <- means_encoder(X = X, G = G)
print(head(train.df))

#         [,1]    [,2]    [,3]    [,4]      [,5]     [,6]
# [1,]  0.5855  0.2239 -1.4361  0.1464  0.014645 -0.21528
# [2,]  0.7095 -1.1562 -0.6293  0.1892  0.177011  0.03227
# [3,] -0.1093  0.4224  0.2435 -0.3276 -0.009544  0.06307
# [4,] -0.4535 -1.3248  1.0584  0.1464  0.014645 -0.21528
# [5,]  0.6059  0.1411  0.8313  0.4915  0.159208  0.17173
# [6,] -1.8180 -0.5360  0.1052  0.5474 -0.056997 -0.16276

But I get (using the seed set on the homepage):

# "Means" encoding
means_encoder <- make_encoder(X = X, G = G, method = "means")
train.df <- means_encoder(X = X, G = G)
print(head(train.df))

#           [,1]       [,2]       [,3]      [,4]       [,5]        [,6]
# [1,]  0.5855288  0.2239254 -1.4361457 0.1036831 -0.1872252 -0.19094847
# [2,]  0.7094660 -1.1562233 -0.6292596 0.1036831 -0.1872252 -0.19094847
# [3,] -0.1093033  0.4224185  0.2435218 0.4277212  0.2087704  0.02461108
# [4,] -0.4534972 -1.3247553  1.0583622 0.1957134 -0.2072658  0.13467584
# [5,]  0.6058875  0.1410843  0.8313488 0.1957134 -0.2072658  0.13467584
# [6,] -1.8179560 -0.5360480  0.1052118 0.1957134 -0.2072658  0.13467584

Thank you, @spinkney! We must have forgotten to change this example after updating the code last time. This is now fixed.