Exemplo n.º 1
0
 public void TestFindBestNMotifsMultipleProfiles()
 {
     float[,] tss =
     {
         { 10, 10, 10, 10, 10, 10, 9, 10, 10, 10, 10, 10, 11, 10, 9 },
         { 10, 10, 10, 10, 10, 10, 9, 10, 10, 10, 10, 10, 11, 10, 9 }
     };
     float[,] tss2 = { { 10, 11, 10, 9 }, { 10, 11, 10, 9 } };
     using (KhivaArray arr = KhivaArray.Create(tss), arr2 = KhivaArray.Create(tss2))
     {
         var(pArr, iArr) = Matrix.Stomp(arr, arr2, 3);
         using (pArr)
             using (iArr)
             {
                 var(distancesArr, indicesArr, subsequenceArr) = Matrix.FindBestNMotifs(pArr, iArr, 3, 1);
                 using (distancesArr)
                     using (indicesArr)
                         using (subsequenceArr)
                         {
                             var indices     = indicesArr.GetData3D <uint>();
                             var subsequence = subsequenceArr.GetData3D <uint>();
                             Assert.AreEqual(new uint[, , ] {
                                 { { 12 }, { 12 } }, { { 12 }, { 12 } }
                             }, indices);
                             Assert.AreEqual(new uint[, , ] {
                                 { { 1 }, { 1 } }, { { 1 }, { 1 } }
                             }, subsequence);
                         }
             }
     }
 }
Exemplo n.º 2
0
        public void TestAggregatedLinearTrendMean()
        {
            var tss = new float[] { 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5 };

            using (var arr = KhivaArray.Create(tss))
            {
                var(slopeArr, interceptArr, rvalueArr, pValueArr, stderrestArr) =
                    Features.AggregatedLinearTrend(arr, 3, 0);
                using (slopeArr)
                    using (interceptArr)
                        using (rvalueArr)
                            using (pValueArr)
                                using (stderrestArr)
                                {
                                    var slope     = slopeArr.GetData1D <float>();
                                    var intercept = interceptArr.GetData1D <float>();
                                    var rvalue    = rvalueArr.GetData1D <float>();
                                    var pvalue    = pValueArr.GetData1D <float>();
                                    var stderrest = stderrestArr.GetData1D <float>();
                                    Assert.AreEqual(1, slope[0], Delta);
                                    Assert.AreEqual(2, intercept[0], Delta);
                                    Assert.AreEqual(1, rvalue[0], Delta);
                                    Assert.AreEqual(0, pvalue[0], Delta);
                                    Assert.AreEqual(0, stderrest[0], Delta);
                                }
            }
        }
Exemplo n.º 3
0
        public void TestQuantileCut3()
        {
            float[,] tss = { { 0, 1, 2, 3, 4, 5 }, { 6, 7, 8, 9, 10, 11 } };
            using (var arr = KhivaArray.Create(tss))
            {
                var quantile = Statistics.QuantilesCutStatistics(arr, 3);
                float[,,] expected =
                {
                    {
                        { -0.0000F, -0.0000F, 1.6667F, 1.6667F,  3.3333F,  3.3333F },
                        {  1.6667F,  1.6667F, 3.3333F, 3.3333F,  5.0000F,  5.0000F }
                    },
                    {
                        {  6.0000F,  6.0000F, 7.6667F, 7.6667F,  9.3333F,  9.3333F },
                        {  7.6667F,  7.6667F, 9.3333F, 9.3333F, 11.0000F, 11.0000F }
                    }
                };

                using (quantile)
                {
                    var result = quantile.GetData3D <float>();
                    Check3DArray(expected, result);
                }
            }
        }
Exemplo n.º 4
0
        public void TestFftCoefficient()
        {
            double[,] tss = { { 0, 1, 2, 3, 4, 5 }, { 6, 7, 8, 9, 10, 11 } };
            using (var arr = KhivaArray.Create(tss))
            {
                var(realArr, imagArr, absoluteArr, angleArr) = Features.FftCoefficient(arr, 0);
                using (realArr)
                    using (imagArr)
                        using (absoluteArr)
                            using (angleArr)
                            {
                                var real     = realArr.GetData2D <double>();
                                var imag     = imagArr.GetData2D <double>();
                                var absolute = absoluteArr.GetData2D <double>();
                                var angle    = angleArr.GetData2D <double>();
                                Assert.AreEqual(15, real[0, 0], Delta);
                                Assert.AreEqual(51, real[1, 0], Delta);

                                Assert.AreEqual(0, imag[0, 0], Delta);
                                Assert.AreEqual(0, imag[1, 0], Delta);

                                Assert.AreEqual(15, absolute[0, 0], Delta);
                                Assert.AreEqual(51, absolute[1, 0], Delta);

                                Assert.AreEqual(0, angle[0, 0], Delta);
                                Assert.AreEqual(0, angle[1, 0], Delta);
                            }
            }
        }
Exemplo n.º 5
0
        public void TestQuantileCut7()
        {
            float[,] tss = { { 0, 1, 2, 3, 4, 5 }, { 6, 7, 8, 9, 10, 11 } };
            using (var arr = KhivaArray.Create(tss))
            {
                var quantile = Statistics.QuantilesCutStatistics(arr, 7);
                float[,,] expected =
                {
                    {
                        { -0.0000F, 0.7143F, 1.4286F, 2.8571F,  3.5714F,  4.2857F },
                        {  0.7143F, 1.4286F, 2.1429F, 3.5714F,  4.2857F,  5.0000F }
                    },
                    {
                        {  6.0000F, 6.7143F, 7.4286F, 8.8571F,  9.5714F, 10.2857F },
                        {  6.7143F, 7.4286F, 8.1429F, 9.5714F, 10.2857F, 11.0000F }
                    }
                };

                using (quantile)
                {
                    var result = quantile.GetData3D <float>();
                    Check3DArray(expected, result);
                }
            }
        }
Exemplo n.º 6
0
        public void TestCrossCovariance()
        {
            var tss = new float[, ] {
                { 0, 1, 2, 3 }, { 10, 11, 12, 13 }
            };
            var tss2 = new float[, ] {
                { 4, 6, 8, 10, 12 }, { 14, 16, 18, 20, 22 }
            };

            using (KhivaArray xss = KhivaArray.Create(tss),
                   yss = KhivaArray.Create(tss2),
                   approximateEntropy = Features.CrossCovariance(xss, yss, false))
            {
                var result  = approximateEntropy.GetData3D <float>();
                var flatten = new float[result.Length];
                Flatten3D(ref flatten, result);
                for (var i = 0; i < 4; i++)
                {
                    Assert.AreEqual(2.5, flatten[i * 5], Delta);
                    Assert.AreEqual(2.5, flatten[i * 5 + 1], Delta);
                    Assert.AreEqual(0.25, flatten[i * 5 + 2], Delta);
                    Assert.AreEqual(-1.25, flatten[i * 5 + 3], Delta);
                    Assert.AreEqual(-1.5, flatten[i * 5 + 4], Delta);
                }
            }
        }
Exemplo n.º 7
0
 public void TestFriedrichCoefficients()
 {
     double[,] tss =
     {
         { 0, 1, 2, 3, 4, 5 },
         { 0, 1, 2, 3, 4, 5 }
     };
     using (KhivaArray arr = KhivaArray.Create(tss), friedrichCoeff = Features.FriedrichCoefficients(arr, 4, 2))
     {
         var result = friedrichCoeff.GetData2D <double>();
         double[,] expected =
         {
             {
                 -0.0009912563255056738, -0.0027067768387496471, -0.00015192681166809052,
                 0.10512571036815643, 0.89872437715530396
             },
             {
                 -0.0009912563255056738, -0.0027067768387496471, -0.00015192681166809052,
                 0.10512571036815643, 0.89872437715530396
             }
         };
         for (var i = 0; i < result.GetLength(0); i++)
         {
             for (var j = 0; j < result.GetLength(1); j++)
             {
                 Assert.AreEqual(expected[i, j], result[i, j], Delta);
             }
         }
     }
 }
Exemplo n.º 8
0
 public void TestFindBestNMotifsMirror()
 {
     float[] tss = { 10.1F, 11, 10.2F, 10.15F, 10.775F, 10.1F, 11, 10.2F };
     using (var arr = KhivaArray.Create(tss))
     {
         var(pArr, iArr) = Matrix.StompSelfJoin(arr, 3);
         using (pArr)
             using (iArr)
             {
                 var(distancesArr, indicesArr, subsequenceArr) = Matrix.FindBestNMotifs(pArr, iArr, 3, 2, true);
                 using (distancesArr)
                     using (indicesArr)
                         using (subsequenceArr)
                         {
                             var indices     = indicesArr.GetData2D <uint>();
                             var subsequence = subsequenceArr.GetData2D <uint>();
                             Assert.AreEqual(new uint[, ] {
                                 { 0, 0 }
                             }, indices);
                             Assert.AreEqual(new uint[, ] {
                                 { 5, 3 }
                             }, subsequence);
                         }
             }
     }
 }
Exemplo n.º 9
0
 public void TestStompSelfJoin()
 {
     float[,] tss =
     {
         { 10, 10, 11, 11, 10, 11, 10, 10, 11, 11, 10, 11, 10, 10 },
         { 11, 10, 10, 11, 10, 11, 11, 10, 11, 11, 10, 10, 11, 10 }
     };
     using (var arr = KhivaArray.Create(tss))
     {
         var(p, i) = Matrix.StompSelfJoin(arr, 3);
         using (p)
             using (i)
             {
                 float[] expectedIndex =
                 { 6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 9, 10, 11, 6, 7, 8, 3, 4, 5, 0, 1, 2 };
                 var pVal = p.GetData2D <float>();
                 var iVal = i.GetData2D <uint>();
                 for (var index = 0; index < 6; index++)
                 {
                     Assert.AreEqual(0.0, pVal[0, index], 1e-2);
                     Assert.AreEqual(expectedIndex[index], iVal[0, index]);
                 }
             }
     }
 }
Exemplo n.º 10
0
 public void TestFindBestNMotifs()
 {
     float[] tss  = { 10, 10, 10, 10, 10, 10, 9, 10, 10, 10, 10, 10, 11, 10, 9 };
     float[] tss2 = { 10, 11, 10, 9 };
     using (KhivaArray arr = KhivaArray.Create(tss), arr2 = KhivaArray.Create(tss2))
     {
         var(pArr, iArr) = Matrix.Stomp(arr, arr2, 3);
         using (pArr)
             using (iArr)
             {
                 var(distancesArr, indicesArr, subsequenceArr) = Matrix.FindBestNMotifs(pArr, iArr, 3, 1);
                 using (distancesArr)
                     using (indicesArr)
                         using (subsequenceArr)
                         {
                             var indices     = indicesArr.GetData1D <uint>();
                             var subsequence = subsequenceArr.GetData1D <uint>();
                             for (var i = 0; i < indices.Length; i++)
                             {
                                 Assert.AreEqual(12, indices[i]);
                                 Assert.AreEqual(1, subsequence[i]);
                             }
                         }
             }
     }
 }
Exemplo n.º 11
0
 public void TestFindBestNDiscordsConsecutive()
 {
     float[] tss = { 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 9.999F, 9.998F };
     using (var arr = KhivaArray.Create(tss))
     {
         var(pArr, iArr) = Matrix.StompSelfJoin(arr, 3);
         using (pArr)
             using (iArr)
             {
                 var(distancesArr, indicesArr, subsequenceArr) = Matrix.FindBestNDiscords(pArr, iArr, 3, 2, true);
                 using (distancesArr)
                     using (indicesArr)
                         using (subsequenceArr)
                         {
                             var subsequence = subsequenceArr.GetData1D <uint>();
                             Assert.AreEqual(12, subsequence[0]);
                             var travis = Environment.GetEnvironmentVariable("TRAVIS");
                             if (travis != null)
                             {
                                 Assert.AreEqual(11, subsequence[1]);
                             }
                             else
                             {
                                 Assert.AreNotEqual(11, subsequence[1]);
                             }
                         }
             }
     }
 }
Exemplo n.º 12
0
 public void TestFindBestNDiscordsMirror()
 {
     float[] tss = { 10, 11, 10, 10, 11, 10 };
     using (var arr = KhivaArray.Create(tss))
     {
         var(pArr, iArr) = Matrix.StompSelfJoin(arr, 3);
         using (pArr)
             using (iArr)
             {
                 var(distancesArr, indicesArr, subsequenceArr) = Matrix.FindBestNDiscords(pArr, iArr, 3, 1, true);
                 using (distancesArr)
                     using (indicesArr)
                         using (subsequenceArr)
                         {
                             var indices     = indicesArr.GetData1D <uint>();
                             var subsequence = subsequenceArr.GetData1D <uint>();
                             for (var i = 0; i < indices.Length; i++)
                             {
                                 Assert.AreEqual(3, indices[i]);
                                 Assert.AreEqual(1, subsequence[i]);
                             }
                         }
             }
     }
 }
Exemplo n.º 13
0
 public void TestFindBestNDiscordsMultipleProfiles()
 {
     double[,] tss =
     {
         { 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11 },
         { 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11 }
     };
     double[,] tss2 =
     {
         { 9, 10.1, 10.2, 10.1, 10.2, 10.1, 10.2, 10.1, 10.2, 10.1, 10.2, 10.1, 9 },
         { 9, 10.1, 10.2, 10.1, 10.2, 10.1, 10.2, 10.1, 10.2, 10.1, 10.2, 10.1, 9 }
     };
     using (KhivaArray arr = KhivaArray.Create(tss), arr2 = KhivaArray.Create(tss2))
     {
         var(pArr, iArr) = Matrix.Stomp(arr, arr2, 3);
         using (pArr)
             using (iArr)
             {
                 var(distancesArr, indicesArr, subsequenceArr) = Matrix.FindBestNDiscords(pArr, iArr, 3, 2);
                 using (distancesArr)
                     using (indicesArr)
                         using (subsequenceArr)
                         {
                             var subsequence = subsequenceArr.GetData3D <uint>();
                             Assert.AreEqual(new uint[, , ] {
                                 { { 0, 10 }, { 0, 10 } }, { { 0, 10 }, { 0, 10 } }
                             }, subsequence);
                         }
             }
     }
 }
Exemplo n.º 14
0
 public void TestSquaredEuclidean()
 {
     int[,] tss      = { { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, { 8, 9, 10, 11 } };
     int[,] expected = { { 0, 0, 0 }, { 64, 0, 0 }, { 256, 64, 0 } };
     using (KhivaArray arr = KhivaArray.Create(tss), squaredEuclidean = Distances.SquaredEuclidean(arr))
     {
         var result = squaredEuclidean.GetData2D <int>();
         Assert.AreEqual(expected, result);
     }
 }
Exemplo n.º 15
0
 public void TestHamming()
 {
     int[,] tss      = { { 1, 1, 1, 1, 1 }, { 2, 2, 2, 2, 2 }, { 3, 3, 3, 3, 3 }, { 4, 4, 4, 4, 4 }, { 5, 5, 5, 5, 5 } };
     int[,] expected = { { 0, 0, 0, 0, 0 }, { 5, 0, 0, 0, 0 }, { 5, 5, 0, 0, 0 }, { 5, 5, 5, 0, 0 }, { 5, 5, 5, 5, 0 } };
     using (KhivaArray arr = KhivaArray.Create(tss), hamming = Distances.Hamming(arr))
     {
         var result = hamming.GetData2D <int>();
         Assert.AreEqual(expected, result);
     }
 }
Exemplo n.º 16
0
 public void TestCountBellowMean()
 {
     float[,] tss = { { 0, 1, 2, 3, 4, 5 }, { 6, 7, 8, 9, 10, 11 } };
     using (KhivaArray arr = KhivaArray.Create(tss), countBellowMean = Features.CountBelowMean(arr))
     {
         var result = countBellowMean.GetData2D <uint>();
         Assert.AreEqual(3, result[0, 0], Delta);
         Assert.AreEqual(3, result[1, 0], Delta);
     }
 }
Exemplo n.º 17
0
 public void TestGroupByDoubleKeyDoubleValueColumn()
 {
     float[,] tss = { { 0, 0, 0, 2, 2 }, { 2, 2, 2, 4, 4 }, { 0, 1, 2, 3, 4 }, { 1, 1, 1, 1, 1 } };
     using (KhivaArray arr = KhivaArray.Create(tss), groupBy = Regularization.GroupBy(arr, 0, 2, 2))
     {
         float[,] expected = { { 1, 3.5F }, { 1, 1 } };
         var result = groupBy.GetData2D <float>();
         Assert.AreEqual(expected, result);
     }
 }
Exemplo n.º 18
0
 public void TestGroupBySingleColumn()
 {
     int[,] tss = { { 0, 1, 1, 2, 2, 3 }, { 0, 3, 3, 1, 1, 2 } };
     using (KhivaArray arr = KhivaArray.Create(tss), groupBy = Regularization.GroupBy(arr, 0))
     {
         int[] expected = { 0, 3, 1, 2 };
         var   result   = groupBy.GetData1D <int>();
         Assert.AreEqual(expected, result);
     }
 }
Exemplo n.º 19
0
 public void TestC3()
 {
     float[,] tss = { { 0, 1, 2, 3, 4, 5 }, { 6, 7, 8, 9, 10, 11 } };
     using (KhivaArray arr = KhivaArray.Create(tss), c3 = Features.C3(arr, 2))
     {
         var result = c3.GetData2D <float>();
         Assert.AreEqual(7.5, result[0, 0]);
         Assert.AreEqual(586.5, result[1, 0]);
     }
 }
Exemplo n.º 20
0
 public void TestEuclidean()
 {
     int[,] tss        = { { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, { 8, 9, 10, 11 } };
     float[,] expected = { { 0, 0, 0 }, { 8, 0, 0 }, { 16, 8, 0 } };
     using (KhivaArray arr = KhivaArray.Create(tss), euclidean = Distances.Euclidean(arr))
     {
         var result = euclidean.GetData2D <float>();
         Assert.AreEqual(expected, result);
     }
 }
Exemplo n.º 21
0
        public void TestAbsEnergy()
        {
            var tss = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

            using (KhivaArray arr = KhivaArray.Create(tss), absEnergy = Features.AbsEnergy(arr))
            {
                var result = absEnergy.GetData1D <int>();
                Assert.AreEqual(385, result[0], Delta);
            }
        }
Exemplo n.º 22
0
 public void TestManhattan()
 {
     int[,] tss      = { { 1, 1, 1, 1, 1 }, { 2, 2, 2, 2, 2 }, { 3, 3, 3, 3, 3 }, { 4, 4, 4, 4, 4 }, { 5, 5, 5, 5, 5 } };
     int[,] expected =
     { { 0, 0, 0, 0, 0 }, { 5, 0, 0, 0, 0 }, { 10, 5, 0, 0, 0 }, { 15, 10, 5, 0, 0 }, { 20, 15, 10, 5, 0 } };
     using (KhivaArray arr = KhivaArray.Create(tss), manhattan = Distances.Manhattan(arr))
     {
         var result = manhattan.GetData2D <int>();
         Assert.AreEqual(expected, result);
     }
 }
Exemplo n.º 23
0
 public void TestLls()
 {
     float[,] tss = { { 4, 3 }, { -1, -2 } };
     float[] tss2 = { 3, 1 };
     using (KhivaArray a = KhivaArray.Create(tss), b = KhivaArray.Create(tss2), lls = LinAlg.Lls(a, b))
     {
         var result = lls.GetData2D <float>();
         Assert.AreEqual(1, result[0, 0], Delta);
         Assert.AreEqual(1, result[0, 1], Delta);
     }
 }
Exemplo n.º 24
0
 public void TestPercentageOfReoccurringValuesToAllValues()
 {
     float[,] tss = { { 1, 1, 2, 3, 4, 4, 5, 6 }, { 1, 2, 2, 3, 4, 5, 6, 7 } };
     using (KhivaArray arr = KhivaArray.Create(tss),
            percentage = Features.PercentageOfReoccurringValuesToAllValues(arr))
     {
         var result = percentage.GetData2D <float>();
         Assert.AreEqual(4.0 / 8.0, result[0, 0], 1e-4);
         Assert.AreEqual(2.0 / 8.0, result[1, 0], 1e-4);
     }
 }
Exemplo n.º 25
0
 public void TestPercentageOfReoccurringDatapointsToAllDatapoints()
 {
     float[,] tss = { { 3, 0, 0, 4, 0, 0, 13 }, { 3, 0, 0, 4, 0, 0, 13 } };
     using (KhivaArray arr = KhivaArray.Create(tss),
            percentage = Features.PercentageOfReoccurringDatapointsToAllDatapoints(arr))
     {
         var result = percentage.GetData2D <float>();
         Assert.AreEqual(0.25, result[0, 0], 1e-4);
         Assert.AreEqual(0.25, result[1, 0], 1e-4);
     }
 }
Exemplo n.º 26
0
        public void TestLinearMultipleTimeSeries()
        {
            double[,] tss =
            {
                {
                    0.24580423, 0.59642861, 0.35879163, 0.37891011, 0.02445137,
                    0.23830957, 0.38793433, 0.68054104, 0.83934083, 0.76073689
                },
                {
                    0.24580423, 0.59642861, 0.35879163, 0.37891011, 0.02445137,
                    0.23830957, 0.38793433, 0.68054104, 0.83934083, 0.76073689
                }
            };
            double[,] tss2 =
            {
                {
                    0.2217416, 0.06344161, 0.77944375, 0.72174137, 0.19413884,
                    0.51146167, 0.06880307, 0.39414268, 0.98172767, 0.30490851
                },
                {
                    0.2217416, 0.06344161, 0.77944375, 0.72174137, 0.19413884,
                    0.51146167, 0.06880307, 0.39414268, 0.98172767, 0.30490851
                }
            };
            using (KhivaArray arr = KhivaArray.Create(tss), arr2 = KhivaArray.Create(tss2))
            {
                var(slopeArr, interceptArr, rvalueArr, pvalueArr, stderrestArr) = Regression.Linear(arr, arr2);
                using (slopeArr)
                    using (interceptArr)
                        using (rvalueArr)
                            using (pvalueArr)
                                using (stderrestArr)
                                {
                                    var slope     = slopeArr.GetData2D <double>();
                                    var intercept = interceptArr.GetData2D <double>();
                                    var rvalue    = rvalueArr.GetData2D <double>();
                                    var pvalue    = pvalueArr.GetData2D <double>();
                                    var stderrest = stderrestArr.GetData2D <double>();

                                    for (var i = 0; i < slope.GetLength(0); i++)
                                    {
                                        for (var j = 0; j < slope.GetLength(1); j++)
                                        {
                                            Assert.AreEqual(0.344864266, slope[i, j], Delta);
                                            Assert.AreEqual(0.268578232, intercept[i, j], Delta);
                                            Assert.AreEqual(0.283552942, rvalue[i, j], Delta);
                                            Assert.AreEqual(0.427239418, pvalue[i, j], Delta);
                                            Assert.AreEqual(0.412351891, stderrest[i, j], Delta);
                                        }
                                    }
                                }
            }
        }
Exemplo n.º 27
0
 public void TestStdev()
 {
     double[,] tss = { { 0, 1, 2, 3, 4, 5 }, { 2, 2, 2, 20, 30, 25 } };
     using (KhivaArray arr = KhivaArray.Create(tss), stdev = Statistics.SampleStdevStatistics(arr))
     {
         double[] expected = { 1.870828693, 12.988456413 };
         var      result   = stdev.GetData2D <double>();
         for (var i = 0; i < result.GetLength(0); i++)
         {
             Assert.AreEqual(expected[i], result[i, 0], 1e-2);
         }
     }
 }
Exemplo n.º 28
0
 public void TestSkewness()
 {
     double[,] tss = { { 0, 1, 2, 3, 4, 5 }, { 2, 2, 2, 20, 30, 25 } };
     using (KhivaArray arr = KhivaArray.Create(tss), skewness = Statistics.SkewnessStatistics(arr))
     {
         double[] expected = { 0.0, 0.236177069879499 };
         var      result   = skewness.GetData2D <double>();
         for (var i = 0; i < result.GetLength(0); i++)
         {
             Assert.AreEqual(expected[i], result[i, 0], 1e-2);
         }
     }
 }
Exemplo n.º 29
0
 public void TestKurtosis()
 {
     double[,] tss = { { 0, 1, 2, 3, 4, 5 }, { 2, 2, 2, 20, 30, 25 } };
     using (KhivaArray arr = KhivaArray.Create(tss), kurtosis = Statistics.KurtosisStatistics(arr))
     {
         double[] expected = { -1.2, -2.66226722 };
         var      result   = kurtosis.GetData2D <double>();
         for (var i = 0; i < result.GetLength(0); i++)
         {
             Assert.AreEqual(expected[i], result[i, 0], 1e-2);
         }
     }
 }
Exemplo n.º 30
0
 public void TestCwtCoefficients()
 {
     double[,] tss = { { 0.1, 0.2, 0.3 }, { 0.1, 0.2, 0.3 } };
     int[] width = { 1, 2, 3 };
     using (KhivaArray arr = KhivaArray.Create(tss),
            widthArr = KhivaArray.Create(width),
            cwtCoeff = Features.CwtCoefficients(arr, widthArr, 2, 2))
     {
         var result = cwtCoeff.GetData2D <float>();
         Assert.AreEqual(0.26517161726951599, result[0, 0], Delta);
         Assert.AreEqual(0.26517161726951599, result[1, 0], Delta);
     }
 }