Exemplo n.º 1
0
        public void Statistics_Standard_Deviation_Population_precomputed_mean()
        {
            double mean  = Dispersion.Mean(ta);
            double value = Dispersion.StandardDeviationPopulation(ta, mean);

            Assert.IsTrue((6.81 <= value && value <= 6.83));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Compute the SD of each column
        ///
        /// </summary>
        /// <param name="classInputMatrix"></param>
        /// <returns>Returns a list of 2D array.
        /// Even though there is 1 rowm the 2D array is returned
        /// for use in any future matrix computations</returns>
        protected List <double[][]> GetClassStandardDeviationMatrix(List <double[][]>
                                                                    classInputMatrix, List <double[][]>
                                                                    classMeanMatrix)
        {
            if (classInputMatrix == null || classMeanMatrix == null)
            {
                throw new InvalidMatrixException();
            }
            List <double[][]> sdMatrix = new List <double[][]>();

            int noOfAttributes = classInputMatrix[0].Length;

            //foreach (double[][] cim in classInputMatrix)
            for (int ii = 0; ii < classInputMatrix.Count; ii++)
            {
                double[][] cim = classInputMatrix[ii];
                double[][] sd  = new double[noOfAttributes][];

                //For each attribute
                Parallel.For(0, sd.Length, idx =>
                {
                    sd[idx] = new double[1];
                    //Do not call SD functionin Statistic routine
                    //as mean is already known and it will be double computation
                    sd[idx][0] =
                        Dispersion.StandardDeviationPopulation(
                            cim[idx], classMeanMatrix[ii][idx][0]);
                });

                sdMatrix.Add(sd);
            }

            return(sdMatrix);
        }
Exemplo n.º 3
0
        public void Statistics_Standard_Deviation_Population()
        {
            double value = Dispersion.StandardDeviationPopulation(ta);

            Assert.IsTrue((6.81 <= value && value <= 6.83));
        }