@@ -26,9 +26,6 @@ function applyfeat(transform::LogRatio, feat, prep)
26
26
names = Tables. columnnames (cols)
27
27
vars = collect (names)
28
28
29
- # perform closure for full revertibility
30
- cfeat, ccache = apply (Closure (), feat)
31
-
32
29
# reference variable
33
30
rvar = refvar (transform, vars)
34
31
_assert (rvar ∈ vars, " invalid reference variable" )
@@ -41,9 +38,9 @@ function applyfeat(transform::LogRatio, feat, prep)
41
38
pfeat = if perm
42
39
popat! (vars, rind)
43
40
push! (vars, rvar)
44
- cfeat |> Select (vars)
41
+ feat |> Select (vars)
45
42
else
46
- cfeat
43
+ feat
47
44
end
48
45
49
46
# apply transform
@@ -57,20 +54,22 @@ function applyfeat(transform::LogRatio, feat, prep)
57
54
𝒯 = (; zip (newnames, eachcol (Y))... )
58
55
newfeat = 𝒯 |> Tables. materializer (feat)
59
56
60
- newfeat, (ccache, perm, rind, vars)
57
+ newfeat, (perm, rind, vars)
61
58
end
62
59
63
60
function revertfeat (transform:: LogRatio , newfeat, fcache)
64
61
# retrieve cache
65
- ccache, perm, rind, vars = fcache
62
+ perm, rind, vars = fcache
66
63
67
64
# revert transform
68
65
Y = Tables. matrix (newfeat)
69
66
X = revertmatrix (transform, Y)
67
+
68
+ # reinsert variable names
70
69
pfeat = (; zip (vars, eachcol (X))... )
71
70
72
71
# revert the permutation if necessary
73
- cfeat = if perm
72
+ feat = if perm
74
73
n = length (vars)
75
74
inds = collect (1 : (n - 1 ))
76
75
insert! (inds, rind, n)
@@ -79,11 +78,8 @@ function revertfeat(transform::LogRatio, newfeat, fcache)
79
78
pfeat
80
79
end
81
80
82
- # revert closure for full revertibility
83
- 𝒯 = revert (Closure (), cfeat, ccache)
84
-
85
81
# return same table type
86
- 𝒯 |> Tables. materializer (newfeat)
82
+ feat |> Tables. materializer (newfeat)
87
83
end
88
84
89
85
# ----------------
0 commit comments