dotnet / machinelearning

ML.NET is an open source and cross-platform machine learning framework for .NET.
https://dot.net/ml
MIT License
9.02k stars 1.88k forks source link

Need a supported way to get Eigenvectors from PrincipalComponentAnalysisTransformer #6812

Open andrewtek opened 1 year ago

andrewtek commented 1 year ago

I am wanting to evaluate the Eigenvectors when performing Principal Component Analysis. Unfortunately, these appear to locked away inside a private field of PrincipalComponentAnalysisTransformer.

Using reflection, I can get the private _transformInfos field from my fitted instance of PrincipalComponentAnalysisTransformer. This provides me with an array of the private internal class TransformInfo. From here, I can use reflection to get the first array entry's Eigenvectors field which will return my float[][] array.

Would it be possible to add a "GetEigenvectors" method to PrincipalComponentAnalysisTransformer that returns this float[][] data?

andrewtek commented 1 year ago

As info, I am using version 3.0.0-preview.23266.6 of the Microsoft.ML library.