How to using Linear Discriminant Analysis for classify training and testing dataset?
7 ビュー (過去 30 日間)
古いコメントを表示
I have a little confused about using Linear Discriminant Analysis (LDA) algorithm for classification after reading some articles.
1. Based on my understanding, for classification, training data and testing data should be separated. When reducing the dimension by LDA, I should combine training data and testing data together to reduce dimension, or just reduce training data dimension, and use eigenvector W to map testing data to lower dimension?
2. For standardized dataset mentioned in some article, I should standardize the whole data (training and testing) together, or just standardized the training data, and use the same scale mapping the testing data?
0 件のコメント
回答 (1 件)
Prantik Chatterjee
2024 年 3 月 21 日
1. Your second approach is the correct one. While reducing dimensionality using LDA, you should first fit the LDA model only on the training data and then use the transformation (eigenvector (W)) learned from the training data to map both the training and testing data to a lower dimension.
2. The same answer applies for data standardization as well. You should first standardize the training data and then use the standardization scale from the training data to scale the test data.
The reason for both of the above cases, is to avoid issues such as data leakage. Combining training and test data before any kind of transformation may lead to data leakage, where information from the testing data influences the model training process. This can result in overly optimistic performance metrics and a model that doesn't generalize well to unseen data.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Discriminant Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!