0
$\begingroup$

I built a logistic regression model to classify a corpus of documents. The dependent variable is the type of document (eg A or B) while the dependent variables, because of dimensionality, are the first 2 components obtained by performing a Principal Component Analysis (PCA) (or a Single Value Decomposition (SVD)) on the columns (terms) of the document/term matrix.

The question is: on a new corpus of documents (and therefore a different document/terms matrix), is it methodologically correct to use the same model if the first 2 components are obtained from a different set of variables (terms)?

$\endgroup$

1 Answer 1

0
$\begingroup$

Nope. Should instead use the transform matrix obtained from the first dataset.

e.g.

transformer = PCA.fit(data_train)
PCA_train = transformer.transform(data_train)
PCA_test = transformer.transform(data_test)
$\endgroup$
1
  • $\begingroup$ Thank you very much, Kotri! Unfortunately, the two datasets do not have the same variables... $\endgroup$
    – Alfredo
    Dec 11, 2019 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.