semanticfa

Semantic Factor Analysis of Language Model Embeddings.

semanticfa performs exploratory factor analysis on language model embeddings of psychological scale items, recovering latent factor structure entirely from item text — no human response data required.

Installation

# install.packages("devtools")
devtools::install_github("devon7y/semanticfa")

Quick start

library(semanticfa)
data(big5)

fit <- sfa(
  big5$items,
  nfactors   = 5,
  embeddings = big5$embeddings,
  scoring    = big5$scoring
)
print(fit)
plot(fit, type = "scree")

Features

Encoding methods

Method Description
"atomic_reversed" Sign-flip by keying, L2-normalize, cosine similarity
"atomic" L2-normalize, cosine similarity (no sign-flip)
"squid" Subtract questionnaire-mean embedding, then cosine
"mean_centered_pearson" Mean-center → cosine = Pearson correlation

References

License

GPL (>= 3)

mirror server hosted at Truenetwork, Russian Federation.