erdogant / pca

pca: A Python Package for Principal Component Analysis.
https://erdogant.github.io/pca
MIT License
284 stars 42 forks source link

Allow train/infer mode for outlier detection in Hotelling's T2 and SPE? #15

Closed hovinh closed 3 years ago

hovinh commented 3 years ago

Hi erdogant,

Firstly, I use your package in daily work and feel grateful for your sharing of this cool package with the community.

I'm employing Hotelling's T2 and SPE in form of a quality control chart, in which each product attribute is plotted as a single data point, those deviates above a certain threshold will be flagged out and intervened. Given this context, I have a training dataset to extract required parameter during train mode, i.e. mean(X) & var(X) in Hotelling's T2 and g_ell_center & cov in SPE, then reuse them to transform new coming data in infer mode.

I have implemented this feature in the compute_outliers() function and wonder if I can contribute this to the pca package?

Sincerely, Vinh

nightvision04 commented 3 years ago

I'm curious about your approach. Could you include this feature in a public fork of erdogant/pca?

erdogant commented 3 years ago

Nice. This seems like a useful addition. Can you push it? A new branch or fork is a good suggestion.

hovinh commented 3 years ago

Great. I will do it this weekend and let you two know :)

hovinh commented 3 years ago

Thank you for reviewing and approving my PR.

erdogant commented 3 years ago

Yes great, some minor changes I made are described in #16

hovinh commented 3 years ago

I have checked out the latest commit. Yes, that looks neat. Thank you :D I guess the issue can now be closed.