示例#1
0
 private static void AddToGroupTable(Hashtable groupTable, CenterInfo cp)
 {
     if (groupTable.ContainsKey(cp.Cluster))
     {
         Hashtable methodTable = (Hashtable)groupTable[cp.Cluster];
         if (methodTable.ContainsKey(cp.Method))
         {
             // Need a list to maintain the order of points
             List <CenterInfo> cps = (List <CenterInfo>)methodTable[cp.Method];
             cps.Add(cp);
         }
         else
         {
             // Need a list to maintain the order of points
             List <CenterInfo> cps = new List <CenterInfo> {
                 cp
             };
             methodTable[cp.Method] = cps;
         }
     }
     else
     {
         // Need a list to maintain the order of points
         List <CenterInfo> cps = new List <CenterInfo> {
             cp
         };
         Hashtable methodTable = new Hashtable();
         methodTable[cp.Method] = cps;
         groupTable[cp.Cluster] = methodTable;
     }
 }
示例#2
0
 private static Hashtable ProcessCenterFile(string centerFile)
 {
     using (StreamReader reader = new StreamReader(centerFile))
     {
         Hashtable groupTable = new Hashtable();
         while (!reader.EndOfStream)
         {
             CenterInfo cp = ReadCenterLine(reader.ReadLine());
             AddToGroupTable(groupTable, cp);
         }
         return(groupTable);
     }
 }
示例#3
0
        private static void CreatePlotWithCenters(string outDir, string outNamePrefix, XElement clustersElement, XElement pointsElement, int maxpnum, Hashtable existingPointsTable, int maxcnum, List <Color> matlab50Colors, Hashtable groupTable, int numberOfCenterPointsToIncludeInEachCenterType)
        {
            ++maxcnum;
            foreach (DictionaryEntry groupToMethodTable in groupTable)
            {
                var group       = (int)groupToMethodTable.Key; // group is the original cluster number
                var methodTable = (Hashtable)groupToMethodTable.Value;
                int methodCount = methodTable.Count;
                int tempCount   = methodCount;
                foreach (DictionaryEntry methodToCenterPoints in methodTable)
                {
                    var method = (string)methodToCenterPoints.Key; // method is one of smallest distance mean, smallest MDS mean, etc.

                    // cluster number to be used in PlotViz for this center type
                    var clusterNumberForCenterType = group * methodCount + (methodCount - tempCount--) + maxcnum;

                    // cluster name to be used in PlotViz for this center type
                    var centerTypeName = group + "." + method + ".centerpoints";

                    // add an XML element to represent this center type as a cluster in PlotViz
                    clustersElement.Add(CreateClusterElement(clusterNumberForCenterType, centerTypeName,
                                                             matlab50Colors[group % matlab50Colors.Count], false, 2.0));

                    var cps = (List <CenterInfo>)methodToCenterPoints.Value;
                    // Picking the topmost n point for each method
                    for (int i = 0; i < numberOfCenterPointsToIncludeInEachCenterType; i++)
                    {
                        CenterInfo   cp = cps[i];
                        PlotVizPoint p  = (PlotVizPoint)existingPointsTable[cp.Pnum];
                        pointsElement.Add(CreatePointElement(++maxpnum, clusterNumberForCenterType,
                                                             ("cluster:" + group + "-idx:" + p.Index + "method:" +
                                                              method),
                                                             p.X, p.Y, p.Z));
                    }
                }
            }

            string   pvizName       = outNamePrefix + "_with_" + numberOfCenterPointsToIncludeInEachCenterType + "_center(s)_for_each_center_type";
            XElement plotElement    = CreatePlotElement(pvizName, true);
            XElement plotvizElement = new XElement("plotviz");

            plotvizElement.Add(plotElement);
            plotvizElement.Add(clustersElement);
            plotvizElement.Add(pointsElement);
            string pvizFile = Path.Combine(outDir, pvizName + ".pviz");

            plotvizElement.Save(pvizFile);
        }
示例#4
0
        public JsonResult GetCenterAll()
        {
            CenterInfo res = new CenterInfo();

            return(Json(res.GetAllCenter(), JsonRequestBehavior.AllowGet));
        }
 public frmCenterInfo(Account oAccount) : base(oAccount)
 {
     InitializeComponent();
     oCen = new CenterInfo();
 }