示例#1
0
文件: Form1.cs 项目: vshehu/SEEUMiner
        private void button1_Click(object sender, EventArgs e)
        {
            string[] array = txtItems.Text.Split(',');

            double[] dArray = Array.ConvertAll(array, Double.Parse);

            DescriptiveStatistics s = new DescriptiveStatistics(dArray);

            MessageBox.Show("Mesatarja: " + s.Average().ToString());

            MessageBox.Show("Median:" + s.Median().ToString());

            MessageBox.Show("STDEV_Population: " + s.StandardDeviationP().ToString());
            MessageBox.Show("STDEV_Sample: " + s.StandardDeviationS().ToString());

            //CategoricalStatistics s = new CategoricalStatistics(array);

            //foreach (KeyValuePair<object, int> kv in s.Frequency())
            //{
            //    MessageBox.Show(kv.Key.ToString() + " - " + kv.Value.ToString());

            //}

            // test test test
            CategoricalStatistics cs = new CategoricalStatistics(dArray);
               // MessageBox.Show(Convert.ToInt32( cs.CalculateMode()).ToString());

            foreach (KeyValuePair<object, int> kv in cs.CalculateMode())
            {
               // MessageBox.Show("Mode: " + kv.Key.ToString() + "=" + kv.Value.ToString());
                label1.Text = "Mode: " + kv.Key.ToString() + "=" + kv.Value.ToString();
            }
        }
示例#2
0
        public double[] ZScore(double[] array_to_normalize)
        {
            //formula eshte: v-mesatarja / devijimi
            double average;
            double deviation;
            DescriptiveStatistics ds = new DescriptiveStatistics(array_to_normalize);
            average = ds.Average();
            deviation = ds.StandardDeviationP();
            List<double> normalized_array = new List<double>();

            foreach (double element in array_to_normalize)
            {
                double new_value = (element - average) / deviation;                 normalized_array.Add(new_value);
            }

            return normalized_array.ToArray();
        }
示例#3
0
        public double[] ZScore(double[] array_to_normalize)
        {
            //formula eshte: v-mesatarja / devijimi
            double average;
            double deviation;
            DescriptiveStatistics ds = new DescriptiveStatistics(array_to_normalize);

            average   = ds.Average();
            deviation = ds.StandardDeviationP();
            List <double> normalized_array = new List <double>();

            foreach (double element in array_to_normalize)
            {
                double new_value = (element - average) / deviation;                 normalized_array.Add(new_value);
            }

            return(normalized_array.ToArray());
        }