示例#1
0
        // finds the corralated feature.
        /************ the graph view uses it ***********/
        public string FindCorralativeFeature(string attName)
        {
            int    counter = 0;
            double max     = 0;
            double result  = 0;

            corrChooseIdx = 0;
            //finding attributes choseb index in list of list
            attChooseIdx = viewModelController.VM_headerNames.FindIndex(a => a.Contains(attName));
            // the values of the chosen feature
            attList      = viewModelController.VM_currentAtt[attChooseIdx];
            floatAttList = stringToFloat(attList);
            //finding most corrleative attribute
            foreach (List <string> list in viewModelController.VM_currentAtt)
            {
                if (counter == attChooseIdx)
                {
                    counter++;
                }
                else
                {
                    floatCorrList = stringToFloat(list);
                    result        = Math.Abs(clientModel.pearson(floatAttList, floatCorrList, floatCorrList.Count));
                    if (result > max)
                    {
                        max           = result;
                        corrChooseIdx = counter;
                    }
                    counter++;
                }
            }
            // takes care of the atts with vector 0
            if (corrChooseIdx == 0 && attName != viewModelController.VM_headerNames[0])
            {
                corrItemName   = attName;
                VM_corralative = corrItemName;
                floatCorrList  = floatAttList;
                //if anomaly detector ins reg line - setting up line (0,0)
                regMax   = 0;
                regMin   = 0;
                regFxMax = 0;
                regFxMin = 0;
                //if anomaly detector ins min Circle - setting up circle in (0,0) with 0 radius
                if (viewModelController.isCircel)
                {
                    radius  = 0;
                    centerX = 0;
                    centerY = viewModelController.dllAlgo.getY();
                }
                return(corrItemName);
            }
            //setting up corr
            corrItemName   = viewModelController.VM_headerNames[corrChooseIdx];
            floatCorrList  = stringToFloat(viewModelController.VM_currentAtt[corrChooseIdx]);
            VM_corralative = corrItemName;
            //creating a list of point for chosen att and max corr
            List <Point> pointList = new List <Point>();

            for (int i = 0; i < attList.Count; i++)
            {
                pointList.Add(new Point(floatAttList[i], floatCorrList[i]));
            }
            //if anomaly algorithim is min Circle - getting minimum circle and setting up (x,y) and radius
            if (viewModelController.isCircel)
            {
                viewModelController.dllAlgo.findMinCirc(attChooseIdx, corrChooseIdx);
                radius  = viewModelController.dllAlgo.getRadiu();
                centerX = viewModelController.dllAlgo.getX();
                centerY = viewModelController.dllAlgo.getY();
            }
            //finding reg Line
            Line regLine = clientModel.linear_reg(pointList, pointList.Count);

            //finding max and min values of attList;
            regMax   = floatAttList.Max();
            regMin   = floatAttList.Min();
            regFxMax = regLine.f(regMax);
            regFxMin = regLine.f(regMin);
            return(corrItemName);
        }