Exemplo n.º 1
0
        public Result(InfoRetrivial ir, int IdFrame, bool valid)
        {
            refIDFrame = IdFrame;

            correct       = ir.correct;
            falsePositive = ir.falsePositive;
            falseNegative = ir.falseNegative;
            precision     = ir.precision;
            recall        = ir.recall;
            f1            = ir.f1;
            this.valid    = valid;
        }
Exemplo n.º 2
0
        public Result(InfoRetrivial ir, int IdFrame, bool valid)
        {
            refIDFrame = IdFrame;

            correct = ir.correct;
            falsePositive = ir.falsePositive;
            falseNegative = ir.falseNegative;
            precision = ir.precision;
            recall = ir.recall;
            f1 = ir.f1;
            this.valid = valid;

        }
Exemplo n.º 3
0
        //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));
        }
Exemplo n.º 4
0
        //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);
        }