Esempio n. 1
0
        private static List <List <double> > formFeatureVector(eigens input)
        {
            List <List <double> > output = new List <List <double> >();

            //!! Concern, do eigen values of a greater absolute value while negative supersede positive values?

            // Alglib eigenVectors and values are sorted in ascending order, so last 3 entries will be the 3 highest vectors
            //eigenVector   [dimension, vector]
            //              [row,col]
            //  Vector1 Vector2 Vector3 ... Vector 12
            //  dim 1   dim 1   dim 1
            //  dim 2   dim 2   dim 2
            //  dim 3   dim 3   dim 3
            //  dim 4   dim 4   dim 4
            //  dim 5   dim 5   dim 5
            //  ...     ...     ...
            //  dim 12  dim 12  dim 12

            //this makes the feature vector matrix with 3 rows of one eigenvector per
            //it is used like this when translating the data to new dimensions in pca
            for (int i = width - 1; i > width - 4; i--)
            {
                List <double> line = new List <double>();
                for (int j = 0; j < width; j++)
                {
                    line.Add(input.eigenVectors[j, i]);
                }
                output.Add(line);
            }
            return(output);
        }
Esempio n. 2
0
 private static void listToDouble(List <List <adder> > inputMatrix, eigens output)
 {
     for (int i = 0; i < inputMatrix.Count; i++)
     {
         for (int j = 0; j < inputMatrix.Count; j++)
         {
             output.matrix[i, j] = inputMatrix[i][j].Value;
         }
     }
 }
Esempio n. 3
0
        static private void findEigenVectors(List <List <adder> > inputMatrix, eigens output)
        {
            //create a matrix array from the list<list<double>>
            double[] valuesOut;
            double[,] vectorsOut;
            output.matrix = new double[width, width];
            listToDouble(inputMatrix, output);

            alglib.smatrixevd(output.matrix, width, 1, false, out valuesOut, out vectorsOut);

            output.eigenValues  = valuesOut;
            output.eigenVectors = vectorsOut;
        }
Esempio n. 4
0
 public static void clear()
 {
     //resets all the data
     //simple fix for errors created by opening files.
     //could be coded better that data isnt left over from
     //previous files
     size               = new int();
     width              = new int();
     means              = new List <double>();
     zeroData           = new List <List <double> >();
     zeroDataTransposed = new List <List <double> >();
     finalData          = new List <List <double> >(); // this will be the new data that is under 3 dimensions and is plot-able
     finalDataRealigned.Clear();
     zeroMeans     = new List <double>();
     zeroVariance  = new List <double>();
     zeroCoVar     = new List <List <adder> >();
     zeroEigens    = new eigens();
     featureVector = new List <List <double> >();
 }