Logistic regression classifier for factor embeddings
Source:R/classifier_metrics.R
classify_logistic.RdTrains a multinomial logistic regression on factor embeddings using
stats::glm (one-vs-rest for > 2 classes) and evaluates on test
samples with the same comprehensive metrics as classify_embedding.
Arguments
- embedding
Numeric matrix where rows are samples and columns are features (e.g.,
t(result$H)for sample embeddings).- labels
Integer or factor vector of class labels. Length must equal
nrow(embedding).- test_fraction
Fraction of samples held out for testing (default 0.2).
- test_idx
Optional integer vector of test indices. If provided,
test_fractionis ignored.- seed
Random seed for train/test split reproducibility.