示例#1
0
        public override LabelType GetLabel(DomainType[] instance_features)
        {
            NearestNeighbourEnumerator <DomainType, DistanceType, LabelType> enumerator = kdtree.NearestNeighbors(instance_features, DistanceFunction, default(DistanceType), default(DistanceType), false, neighbor_count);
            IList <Tuple <DomainType[], DistanceType, LabelType> >           neighbors  = new List <Tuple <DomainType[], DistanceType, LabelType> >();

            do
            {
                neighbors.Add(enumerator.Current);
            }while (enumerator.MoveNext());
            return(voting_system.elect(neighbors).Item3);
        }
        private IList <Tuple <double[], int> > Values()
        {
            NearestNeighbourEnumerator <double, double, int> enumerator = kdtree.NearestNeighbors(new double[this.DataContext.FeatureCount], this.DistanceFunction, 0, 0, false, kdtree.Size);
            IList <Tuple <double[], int> > neighbors = new List <Tuple <double[], int> >();

            do
            {
                neighbors.Add(new Tuple <double[], int>(enumerator.Current.Item1, enumerator.Current.Item3));
            }while (enumerator.MoveNext());
            return(neighbors);
        }