Changeset 12151


Ignore:
Timestamp:
03/06/15 13:26:30 (6 years ago)
Author:
mkommend
Message:

#2352: Reverse merged r12137 and implemented a format pattern for the EnhancedStringConvertibleMatrixView.

Location:
trunk/sources
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Analysis.Statistics.Views/3.3/CorrelationView.cs

    r12137 r12151  
    5656      stringConvertibleMatrixView.Minimum = -1.0;
    5757      stringConvertibleMatrixView.Maximum = 1.0;
     58      stringConvertibleMatrixView.FormatPattern = "0.000";
    5859
    5960      methodComboBox.Items.Add(PearsonName);
     
    216217          if (!rowValues.Any() || !columnValues.Any() || rowValues.Count() != columnValues.Count()) {
    217218            dt[i, j] = double.NaN;
    218           } else if (i == j) {
    219             dt[i, j] = 1.0;
    220219          } else {
    221220            if (methodName == PearsonName) {
    222               dt[i, j] = Math.Round(alglib.pearsoncorr2(rowValues.ToArray(), columnValues.ToArray()), 3); // for correlations it is usually sufficient to show only 3 digits
     221              dt[i, j] = alglib.pearsoncorr2(rowValues.ToArray(), columnValues.ToArray());
    223222            } else {
    224               dt[i, j] = Math.Round(alglib.spearmancorr2(rowValues.ToArray(), columnValues.ToArray()), 3); // for correlations it is usually sufficient to show only 3 digits
     223              dt[i, j] = alglib.spearmancorr2(rowValues.ToArray(), columnValues.ToArray());
    225224            }
    226225          }
  • trunk/sources/HeuristicLab.Data.Views/3.3/EnhancedStringConvertibleMatrixView.cs

    r12012 r12151  
    4545    public double Minimum { get; set; }
    4646
     47    public string FormatPattern { get; set; }
     48
    4749    public new DoubleMatrix Content {
    4850      get { return (DoubleMatrix)base.Content; }
     
    5254    public EnhancedStringConvertibleMatrixView() {
    5355      InitializeComponent();
     56      FormatPattern = string.Empty;
    5457    }
    5558
     
    5760      columnVisibility = null;
    5861      rowVisibility = null;
     62    }
     63
     64    protected override void dataGridView_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e) {
     65      if (Content != null && e.RowIndex < Content.Rows && e.ColumnIndex < Content.Columns) {
     66        int rowIndex = virtualRowIndices[e.RowIndex];
     67        e.Value = Content[rowIndex, e.ColumnIndex].ToString(FormatPattern);
     68      }
    5969    }
    6070
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.cs

    r12077 r12151  
    281281      dataGridView.Rows[e.RowIndex].ErrorText = string.Empty;
    282282    }
    283     private void dataGridView_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e) {
     283    protected virtual void dataGridView_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e) {
    284284      if (Content != null && e.RowIndex < Content.Rows && e.ColumnIndex < Content.Columns) {
    285285        int rowIndex = virtualRowIndices[e.RowIndex];
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/FeatureCorrelation/AbstractFeatureCorrelationView.cs

    r12012 r12151  
    4848    protected AbstractFeatureCorrelationView() {
    4949      InitializeComponent();
     50      dataView.FormatPattern = "0.000";
    5051      fcc = new FeatureCorrelationCalculator();
    5152      var calculators = ApplicationManager.Manager.GetInstances<IDependencyCalculator>();
     
    115116      dataView.Maximum = calc.Maximum;
    116117      dataView.Minimum = calc.Minimum;
     118
    117119      dataView.Content = correlation;
    118120      dataView.Enabled = true;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/FeatureCorrelation/FeatureCorrelationCalculator.cs

    r12137 r12151  
    139139          IEnumerable<double> var2 = problemData.Dataset.GetDoubleValues(doubleVariableNames[j], indices);
    140140
    141           elements[i, j] = Math.Round(calc.Calculate(var1, var2, out error), 3); // only show correlations to 3 digits accuracy
     141          elements[i, j] = calc.Calculate(var1, var2, out error);
    142142
    143143          if (!error.Equals(OnlineCalculatorError.None)) {
Note: See TracChangeset for help on using the changeset viewer.