コード例 #1
0
ファイル: DominantSet.cs プロジェクト: rospoly/F-Formation
        public Group ComputeGroup()
        {
            ResetVector();
            Group g = new Group(a.F);
            //Utils.printMatrix(matrix);
            while (indexes.Count > 1)
            {
                while (RecursiveResearchMax() > DeltaValue) {};
                if (CheckValidFunction())
                {
                    List<int> label = FindDominantGroup();
                    List<int> ids = FromLabelToId(label);

                    //Utils.printMatrix(vector);
                    //Utils.printMatrix(matrix);
                    
                    if (StoppingCriterium(ids))
                    {
                        indexes.Clear();
                        g=new Group(a.F);
                    }
                    else
                    {
                        if (ids.Count > 0)
                        {
                            g.addSubGroup(ids);
                            RemoveDominantGroup(label, ids);
                        }
                        else
                            return new Group(a.F);
                    }
                }
            }
            return g;
        }
コード例 #2
0
ファイル: Group.cs プロジェクト: rospoly/F-Formation
        //ATTENZIONE 
        /// <summary>
        /// Ordine importante! Il primo parametro è il gruppo stimato,
        /// il secondo parametro il gruppo originale!
        /// OutPut una lista con: prima posizione CORRETTI, seconda posizione FALSI POSITIVI, terza posizione FALSI NEGATIVI
        /// </summary>
        /// <param name="val"></param>
        /// <param name="orig"></param>
        /// <param name="error"></param>
        /// <returns></returns>
        public static Result Compare(Group val, Group orig,double error=1,bool considerDiscarded=true) {
            if (val.IdFrame != orig.IdFrame)
                throw new Exception("Attenzione!!! stiamo confrontando gruppi diversi");
           
            int correct = 0;
            int falsePositive = 0;
            int falseNegative = 0;
            foreach (List<Person> l2 in orig.Grouping.Values) //foreach gt group
            {
                foreach (List<Person> l1 in val.Grouping.Values) //foreach detected group
                {
                    IEnumerable<Person> temp = l1.Intersect<Person>(l2,new PersonComparator());
                    if (l1.Count == 2 && l2.Count == 2)
                    {
                        if (temp.Count<Person>() == 2) //if groups have 2 members they must match perfectly
                            correct++;
                    }
                    else
                    {
                        if (((double)temp.Count<Person>() / (double)Math.Max(l1.Count, l2.Count)) >= error)
                            correct++;
                    }
                }
            }

            falsePositive = val.Grouping.Values.Count - correct;
            //falsePositive = val.Grouping.Values.Count - correct;
            //groups that are present in MY evaluation but not in TRUE one
            falseNegative = orig.Grouping.Values.Count - correct;
            //groups that are present in the TRUE evaluation but not in MY 
            InfoRetrivial ir = new InfoRetrivial(correct, falsePositive, falseNegative);//, diffNumGroups);
            bool tmp = true;
            if (val.Grouping.Values.Count == 0 && !considerDiscarded)
                tmp = false;
            return new Result(ir,val.IdFrame.IdFrame,tmp);
        }
コード例 #3
0
ファイル: AllSingleton.cs プロジェクト: rospoly/F-Formation
 public Group ComputeGroup()
 {
     Group g = new Group(a.F);
     g.addAllSingletons(FromLabelToId(indexes));
     return g;
 }