Exemple #1
0
        public ClusterPair GetTestResultByWidthSearch(Sample item)
        {
            ClusterPairTestResult result = new ClusterPairTestResult() { Distance = double.MaxValue, ClusterPair = new ClusterPair()};
            this.CountClosestClusterPairByWidthSearch(item, result);

            return result.ClusterPair;
        }
Exemple #2
0
        //public void CountClosestClusterPairByWidthSearch(Sample item, ClusterPairTestResult result)
        //{
        //    if (this.children != null && this.children.Count != 0 && this.children[0].IsLeafNode)
        //    {
        //        double distance = double.MaxValue;
        //        int index = 0;
        //        ClusterPair clPair = this.GetNearestClusterPairXBySDNLL_MDF(item, out distance, out index);
        //        if (distance < result.Distance)
        //        {
        //            result.ClusterPair = clPair;
        //            result.Distance = distance;
        //        }
        //    }
        //    else
        //    {
        //        var nodesToSearch = this.GetNodesToSearch(item);
        //        foreach (var node in nodesToSearch)
        //        {
        //            node.CountClosestClusterPairByWidthSearch(item, result);
        //        }
        //    }
        //}
        public void CountClosestClusterPairByWidthSearch(Sample item, ClusterPairTestResult result)
        {
            if (this.IsLeafNode)
            {
                if (this.Parent != null)
                {
                    double distance = double.MaxValue;
                    int index = 0;
                    ClusterPair clPair = this.Parent.GetNearestClusterPairXBySDNLL_MDF(item, out distance, out index);
                    Console.WriteLine(distance.ToString());
                    if (distance < result.Distance)
                    {
                        //Console.WriteLine("Store");
                        result.ClusterPair = clPair;
                        result.Distance = distance;
                    }
                }
            }
            else
            {
                var nodesToSearch = this.GetNodesToSearch(item);

                foreach (var node in nodesToSearch)
                {
                    node.CountClosestClusterPairByWidthSearch(item, result);
                }
            }
        }