Accord.Controls.ConfusionMatrixRowView.GetValue C# (CSharp) Метод

GetValue() публичный Метод

Gets the value for a given element in this row.
public GetValue ( int columnIndex ) : double
columnIndex int The column index of an element.
Результат double
        public double GetValue(int columnIndex)
        {
            if (RowIndex == -1 && columnIndex == -1)
            {
                if (Owner.Proportions)
                    return 1;
                else return Owner.Matrix.Samples;
            }

            if (RowIndex == -1)
            {
                if (Owner.Proportions)
                    return Owner.Matrix.ColumnProportions[columnIndex];
                else return Owner.Matrix.ColumnTotals[columnIndex];
            }
            else if (columnIndex == -1)
            {
                if (Owner.Proportions)
                    return Owner.Matrix.RowProportions[RowIndex];
                else return Owner.Matrix.RowTotals[RowIndex];
            }
            else
            {
                if (Owner.Proportions)
                    return Owner.Matrix.ProportionMatrix[RowIndex, columnIndex];
                else return Owner.Matrix.Matrix[RowIndex, columnIndex];
            }
        }

Usage Example

        /// <summary>
        ///   Gets a value from the array.
        /// </summary>
        ///
        public override object GetValue(object component)
        {
            try
            {
                ConfusionMatrixRowView rowView = component as ConfusionMatrixRowView;
                return(rowView.GetValue(ColumnIndex));
            }
            catch (ArgumentException e)
            {
                Debug.WriteLine(e);
            }
            catch (IndexOutOfRangeException e)
            {
                Debug.WriteLine(e);
            }

            return(null);
        }