private static Dictionary <string, DataRecord> GetAverageClassValues(DataWarehouse WH)
        {
            DataRecord[] records         = WH.GetRecords();
            string[]     classifications = records.Select(r => r.GetAttributeValue(WH.ClassificationAttribute)).Distinct().ToArray();

            ConcurrentDictionary <string, DataRecord> averageDataRecords = new ConcurrentDictionary <string, DataRecord>();

            Parallel.ForEach(classifications, (classification) =>
            {
                DataRecord averageRecord = new DataRecord();

                IEnumerable <DataRecord> targetRecords = records.Where(r => r.GetAttributeValue(WH.ClassificationAttribute) == classification);

                foreach (string attribute in WH.Attributes)
                {
                    if (attribute != WH.ClassificationAttribute && attribute != WH.IDAttribute)
                    {
                        decimal total = 0;
                        foreach (DataRecord r in targetRecords)
                        {
                            total += decimal.Parse(r.GetAttributeValue(attribute));
                        }
                        averageRecord.AddOrUpdateValue(attribute, (total / targetRecords.Count()).ToString());
                    }
                }
                averageDataRecords.TryAdd(classification, averageRecord);
            });
            return(new Dictionary <string, DataRecord>(averageDataRecords));
        }
        private static double GetDistanceFromZero(DataRecord Record, string IDAttributeName, string ClassificationAttributeName, double Power = 2d)
        {
            double     distance = 0;
            DataRecord zero     = new DataRecord();

            foreach (string attribute in Record.GetAttributes())
            {
                zero.AddOrUpdateValue(attribute, "0");
            }
            foreach (string attributeName in Record.GetAttributes())
            {
                if (attributeName != ClassificationAttributeName && attributeName != IDAttributeName)
                {
                    distance += Math.Pow(Math.Abs(double.Parse(Record.GetAttributeValue(attributeName)) - double.Parse(zero.GetAttributeValue(attributeName))), Power);
                }
            }
            return(Math.Pow(distance, (1 / Power)));
        }