Пример #1
0
        private void setMinMaxValuesAndCountClasses()
        {
            foreach (var v in dataInHyperspace.DataValues[0].Attributes)
            {
                MinMaxKNN toAdd = new MinMaxKNN(v.getValueAsDouble(), v.getValueAsDouble());
                minMax.Add(toAdd);
            }

            foreach (var v in dataInHyperspace.DataValues)
            {
                for (int i = 0; i < v.Attributes.Count; i++)
                {
                    minMax[i].compareX(v.Attributes[i].getValueAsDouble());
                }
                classesCounter.addAttribute(v.DataClass, v.DataClass);
            }
        }
Пример #2
0
        private string doVoting(List <AnalyzedData> data)
        {
            AttributeCounter counter = new AttributeCounter();

            foreach (var v in data)
            {
                counter.addAttribute(v.DataClass, v.DataClass);
            }
            List <Tuple <string, double> > votes = new List <Tuple <string, double> >();

            foreach (var v in counter.Attributes)
            {
                double x = (double)v.Number / (double)classesCounter.returnNumberForOneClass(v.Name, v.Name);
                Tuple <string, double> toAdd = new Tuple <string, double>(v.Name, x);
                votes.Add(toAdd);
            }
            votes = votes.OrderByDescending(x => x.Item2).ToList();
            return(votes[0].Item1);
        }