//Este metodo lo q hace es llenar la lista de indices con los indices q se van a usar en este caso (AHORA TENGO DESHABILITADO TODO LO Q TIENE Q VER CON LOS INDICES). //private void FillSegmentationIndexList() //{ // //indexes = new List<SegmentationIndex>(); // //indexes.Add(new CompactnessIndex()); // //indexes.Add(new CircularityIndex()); // //indexes.Add(new ConnectivityIndex()); //} //private double[] ComputeWeights() //{ // double[] weights = new double[this.prob.Segmentations.Count]; // foreach (SegmentationIndex sidx in indexes) // sidx.EvaluateSegmentations(this.prob); // double min = double.MaxValue; double max = 0; // for (int i = 0; i < this.prob.Segmentations.Count; i++) // { // foreach (SegmentationIndex sidx in indexes) // weights[i] += sidx.Weights[i]; // if (weights[i] < min) // min = weights[i]; // if (weights[i] > max) // max = weights[i]; // } // for (int i = 0; i < weights.Length; i++) // { // //weights[i] = weights[i] / max; // //Otra variante // weights[i] = (weights[i] - min) / (max - min); // } // return weights; //} private double Compute3thTerm(double[] weights) { double result = 0; for (int i = 0; i < prob.Segmentations.Count; i++) { for (int j = 0; j < prob.Segmentations.Count; j++) { result += weights[i] * weights[j] * rand.Process(prob.Segmentations[i], prob.Segmentations[j]); } } return(result); }
//Evaluo la segmentacion con las medidas RandIndex, VI and NMI y dejo los resultados en el prob. Evaluo contra el mejor ground-truth y el promedio contra todos. private void EvaluateMatrixSegmentation(Segmentation segm) { RandIndexSegSim rand = new RandIndexSegSim(); NMISegSim nmi = new NMISegSim(); VISegSim vi = new VISegSim(); //Calcular el rand double min = double.MaxValue; double ave = 0; double aux = 0; for (int i = 0; i < this.prob.GroundTruths.Count; i++) { aux = 1 - rand.Process(segm, this.prob.GroundTruths[i]); if (aux < min) { min = aux; } ave += aux; } ave = ave / this.prob.GroundTruths.Count; this.prob.Best_RandEvaluation = min; this.prob.Ave_RandEvaluation = ave; //Calcular NMI min = double.MaxValue; ave = 0; aux = 0; for (int i = 0; i < this.prob.GroundTruths.Count; i++) { aux = 1 - nmi.Process(segm, this.prob.GroundTruths[i]); if (aux < min) { min = aux; } ave += aux; } ave = ave / this.prob.GroundTruths.Count; this.prob.Best_NMIEvaluation = min; this.prob.Ave_NMIEvaluation = ave; //Calcular VI min = double.MaxValue; ave = 0; aux = 0; for (int i = 0; i < this.prob.GroundTruths.Count; i++) { aux = vi.Process(segm, this.prob.GroundTruths[i]); if (aux < min) { min = aux; } ave += aux; } ave = ave / this.prob.GroundTruths.Count; this.prob.Best_VIEvaluation = min; this.prob.Ave_VIEvaluation = ave; }
//Evaluo la segmentacion con las medidas RandIndex, VI and NMI y dejo los resultados en el prob. Evaluo contra el mejor ground-truth y el promedio contra todos. private void EvaluateMatrixSegmentation(Segmentation segm) { RandIndexSegSim rand = new RandIndexSegSim(); NMISegSim nmi = new NMISegSim(); VISegSim vi = new VISegSim(); //Calcular el rand double min = double.MaxValue; double ave = 0; double aux = 0; for (int i = 0; i < this.prob.GroundTruths.Count; i++) { aux = 1 - rand.Process(segm, this.prob.GroundTruths[i]); if (aux < min) min = aux; ave += aux; } ave = ave / this.prob.GroundTruths.Count; this.prob.Best_RandEvaluation = min; this.prob.Ave_RandEvaluation = ave; //Calcular NMI min = double.MaxValue; ave = 0; aux = 0; for (int i = 0; i < this.prob.GroundTruths.Count; i++) { aux = 1 - nmi.Process(segm, this.prob.GroundTruths[i]); if (aux < min) min = aux; ave += aux; } ave = ave / this.prob.GroundTruths.Count; this.prob.Best_NMIEvaluation = min; this.prob.Ave_NMIEvaluation = ave; //Calcular VI min = double.MaxValue; ave = 0; aux = 0; for (int i = 0; i < this.prob.GroundTruths.Count; i++) { aux = vi.Process(segm, this.prob.GroundTruths[i]); if (aux < min) min = aux; ave += aux; } ave = ave / this.prob.GroundTruths.Count; this.prob.Best_VIEvaluation = min; this.prob.Ave_VIEvaluation = ave; }