| nmf.ffb.ecv | R Documentation |
Step 1 of the NMF-FFB workflow: select Q by element-wise
cross-validation of the feed-forward fit. Held-out entries of
Y_1 are predicted from the remaining ones, so the criterion measures how
well a Q-factor non-negative basis describes the outcomes, which is what
Q is for.
nmf.ffb.ecv(
Y1,
Y2,
rank = NULL,
X.init = "nndsvd",
X.L2.ortho = 100,
epsilon = 1e-06,
maxit = 5000,
...
)
Y1, Y2 |
Endogenous and exogenous matrices (variables in rows, units in columns). |
rank |
Candidate values of |
X.init |
Stage-1 initialization, passed to |
X.L2.ortho |
Orthogonality penalty on the basis in stage 1. Keep the
value that will be used in |
epsilon, maxit |
Convergence tolerance and iteration cap for stage 1. |
... |
Passed to |
Feedback cannot be cross-validated, and that is not a limitation of the
implementation. By the reduced-form equivalence, the equilibrium mapping
M = (I - X\Theta_1)^{-1}X\Theta_2 is reproduced exactly by a
feed-forward model with the exogenous matrix L_Q\Theta_2: the two models
predict Y_1 from Y_2 identically, so no prediction criterion –
column-wise CV, element-wise CV, or a test-sample error – can prefer one over
the other. Feedback is identified by the conditional covariance, not by
prediction, which is why it is addressed by nmf.ffb.test and not
here.
The object returned by nmfkc.ecv: the held-out error by
rank, with the selected rank.
ecv <- nmf.ffb.ecv(Y1, Y2, rank = 1:5) # 1. choose Q <- this function fit <- nmf.ffb(Y1, Y2, rank = ecv$rank) # 2. estimate; BIC selects the support tst <- nmf.ffb.test(fit, Y1, Y2) # 3. test the feed-forward null dgn <- nmf.ffb.diagnostics(fit) # 4. cycles, spectral radius, identifiability inf <- nmf.ffb.inference(fit, Y1, Y2) # 5. intervals for the retained entries
nmf.ffb, nmf.ffb.test,
nmfkc.ecv
set.seed(1)
Y <- t(as.matrix(iris[, 1:4]))
Y1 <- Y[1:2, ]; Y2 <- Y[3:4, ]
ecv <- nmf.ffb.ecv(Y1, Y2, rank = 1:2, nfolds = 3)
ecv$rank
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.