Comments (7)
Hi Matthias,
Yes, thanks for catching this bug! I will be committing a fix in a few minutes and perhaps generating a new NuGet package. In the meantime, do you think it would be possible for you to use the multidimensional version instead? If you need you can convert to and from jagged and multidimensional arrays using the extension methods ToMatrix and ToArray.
Hope it helps!
Cesar
from framework.
hi cesar,
thanks for your quick reply and fix! using the extension methods to convert to a matrix suffices as well.
there is one more thing that might be a bug (and is maybe related):
when applying a PCA to the data above, i will get 2 eigenvectors with 2 dimensions (as expected).
doing the same with a KPCA (and linear kernel) results in 10 eigenvectors with 2 dimensions each (which i don't expect as the results should be the same). maybe there is some kind of matrix dimension mismatch in the background?
matthias
from framework.
Hi Matthias!
Sorry, I missed your follow up to the question. In this case, the KPCA with a linear kernel will generate the same projection, but it doesn't use the same internal procedures. With KPCA, the PCA is done using the Kernel matrix, and the kernel matrix is always N x N where N is the number of samples. As such, the Eigenvalues/Eigenvector matrices are thus based on the Kernel matrix instead of the original samples, meaning we will be able to find up to N Eigenvectors and Eigenvalues during the transform. Now, for the linear kernel the extra Eigenvectors can be discarded, but this might not be true for other kernels.
In any case, you can also use the Threshold property of KPCA to discard unnecessary vectors after the transformation.
I will let the issue open until I check the original papers again (it has been some time!) if this is indeed correct. Thanks for reporting the issue!
Best regards,
Cesar
from framework.
Yes, this is the expected behavior. Again, the kpca.Threshold property can be used to cut some of the eigenvectors that don't contribute much to the variance.
from framework.
Dear Cesàr,
I am trying to use the following code to filter out the noise and calculate the pre-image.
public static void Main (string[] args)
{
double[,] dataset = {{-75.089, -75.003, -75.489, -67.669, -70.752, -80.788}, {-83.768, -74.948, -75.414, -67.628, -70.563, -80.531}, {-83.0, -74.901, -75.32, -67.605, -70.471, -80.278}, {-82.838, -74.78, -75.309, -67.693, -70.277, -79.944}, {-82.761, -74.745, -75.27, -67.772, -70.131, -79.667}, {-82.549, -74.928, -75.189, -67.85, -70.004, -79.337}, {-82.406, -75.107, -75.102, -71.859, -69.875, -79.06}, {-82.241, -74.967, -75.041, -73.0, -69.777, -78.81}, {-82.087, -71.605, -74.966, -72.947, -69.701, -78.547}, {-82.125, -80.0, -74.901, -72.79, -69.556, -78.307}, {-82.142, -79.98, -74.852, -72.626, -69.54, -78.062}, {-83.768, -79.921, -74.82, -72.494, -69.561, -77.843}, {-83.768, -79.813, -74.801, -72.425, -69.491, -77.597}, {-83.768, -71.605, -74.805, -72.329, -69.397, -77.371}, {-83.768, -84.0, -74.775, -72.171, -69.309, -77.106}, {-83.768, -83.784, -74.715, -72.052, -69.269, -76.915}, {-84.0, -71.605, -74.665, -72.012, -69.218, -76.707}, {-83.763, -71.527, -74.601, -71.896, -69.12, -76.514}, {-83.768, -71.605, -74.55, -71.859, -69.077, -76.301}};
IKernel kernel = new Gaussian(0.5);
var kpca = new KernelPrincipalComponentAnalysis(dataset, kernel);
kpca.Compute();
double[,] forward = kpca.Result;
double[,] projection = kpca.Transform(dataset,kpca.GetNumberOfComponents(0.9f));
double[,] reversion = kpca.Revert(projection);
//double[,] reversion = kpca.Revert(forward);
Console.WriteLine ("Hello World!");
}
The problem is that the values I get in the reversion are in magnitude very different form the initial dataset and also sometimes they have an opposite sign. So they are completely wrong in my opinion.
Maybe is my mistake....
Any suggestion?
Thanks
from framework.
It happens only when centerInFeatureSpace is true.
Thanks
from framework.
This seems to have been fixed somewhere in 2016. Sorry for the delay in updating/closing the issue.
from framework.
Related Issues (20)
- Could not load file or assembly 'CoreCompat.System.Drawing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null HOT 2
- Add an Example for GaussianClusterCollection Class
- Add an Example for HypothesisTest(TDistribution).CriticalValue Property
- Add an Example for NpyFormat Class
- Add an Example for CsvReader Class
- Using Accord.Video.FFMPEG to receive RTSP stream
- Add an Example for HoughLineTransformation Class
- Add an Example for NonlinearConstraint Constructor (IObjectiveFunction, Expression(Func(Double[], Boolean)), Func(Double[], Double[]))
- Can I run Accord.NET on mobile devices using Xamarin?
- Add an Example for Linear Structure
- Add an Example for NonNegativeLeastSquares Class
- Add an Example for IndependentComponentAnalysis Constructor (Double[,])
- [Accord.Video.FFMPEG] Is there any controls over quality and compression of images in file produced?
- Add an Example for Matrix.PseudoInverse Method (Decimal[,])
- Add an C# Example for VideoFileWriter Constructor
- The collected audio and video are not synchronized after being written into the file
- Add an Example for RandomForestLearning Class
- How to use ActivationNetwork of Accord.NET properly to do machine learning tasks such as BackPropagationLearning
- Add an Example for Blob Class
- Add an Example for TrapezoidalRule Constructor (Func(Double, Double))
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from framework.