| sfa_load_npz | R Documentation |
Reads a NumPy .npz archive of pre-computed item embeddings (and, if
present, the item codes, factor labels, scoring, and item text) into a tidy
object that sfa, sfa_similarity, and
sfa_corplot accept directly — so loading saved embeddings is
one line instead of hand-rolling reticulate/NumPy calls.
sfa_load_npz(
path,
embeddings_key = "embeddings",
codes_key = "codes",
items_key = "items",
factors_key = "factors",
scoring_key = "scoring"
)
path |
Path to a |
embeddings_key |
Name of the embeddings array in the archive
(default |
codes_key, items_key, factors_key, scoring_key |
Names of the optional metadata arrays (codes, item text, factor labels, +1/-1 scoring). Missing keys are silently skipped. |
The archive is expected to contain a 2-D embeddings array; the other fields are optional and matched by name.
An object of class "sfa_embeddings": a list with
embeddings (numeric matrix, n_items x dim, with item codes as
rownames when available) and any of codes, items,
factors, scoring found in the archive.
sfa, sfa_similarity,
sfa_corplot
## Not run:
emb <- sfa_load_npz("DASS_items_8B.npz")
emb # summary of what was loaded
sfa_corplot(sfa_similarity(emb)) # grouped heatmap, two lines total
fit <- sfa(emb) # or run the full analysis
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.