Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/08/19 14:40:15 (5 years ago)
Author:
pfleck
Message:

#2972 Improved initialization and added a tooltip.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2972_PDPRowSelect/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionPartialDependencePlotView.cs

    r16516 r16517  
    9797      var problemData = Content.ProblemData;
    9898
     99      if (sharedFixedVariables != null) {
     100        sharedFixedVariables.ItemChanged -= SharedFixedVariables_ItemChanged;
     101        sharedFixedVariables.Reset -= SharedFixedVariables_Reset;
     102      }
     103
    99104      // Init Y-axis range
    100105      double min = double.MaxValue, max = double.MinValue;
     
    120125        Content.ProblemData.Dataset.VariableNames.Where(v => inputvariables.Contains(v)).ToList();
    121126
    122       // ToDo: set default values with the variableValuesMode
    123127      var doubleVariables = allowedInputVariables.Where(problemData.Dataset.VariableHasType<double>);
    124128      var doubleVariableValues = (IEnumerable<IList>)doubleVariables.Select(x => new List<double> {
    125         problemData.Dataset.GetDoubleValues(x, problemData.TrainingIndices).Median()
     129        problemData.Dataset.GetDoubleValue(x, 0)
    126130      });
    127131
    128132      var factorVariables = allowedInputVariables.Where(problemData.Dataset.VariableHasType<string>);
    129133      var factorVariableValues = (IEnumerable<IList>)factorVariables.Select(x => new List<string> {
    130         MostCommon(problemData.Dataset.GetStringValues(x, problemData.TrainingIndices))
     134        problemData.Dataset.GetStringValue(x, 0)
    131135      });
    132136
    133       if (sharedFixedVariables != null) {
    134         sharedFixedVariables.ItemChanged -= SharedFixedVariables_ItemChanged;
    135         sharedFixedVariables.Reset -= SharedFixedVariables_Reset;
    136       }
    137 
    138137      sharedFixedVariables = new ModifiableDataset(doubleVariables.Concat(factorVariables), doubleVariableValues.Concat(factorVariableValues));
    139 
     138      variableValuesModeComboBox.SelectedItem = "Median"; // triggers UpdateVariableValue and changes shardFixedVariables
    140139
    141140      // create controls
     
    645644      return values.GroupBy(x => x).OrderByDescending(g => g.Count()).Select(g => g.Key).First();
    646645    }
     646
     647    // ToolTips cannot be shown longer than 5000ms, only by using ToolTip.Show manually
     648    // See: https://stackoverflow.com/questions/8225807/c-sharp-tooltip-doesnt-display-long-enough
     649    private void variableValuesModeComboBox_MouseHover(object sender, EventArgs e) {
     650      string tooltipText = @"Sets each variable to a specific value:
     651    Row - Selects the value based on a specified row of the dataset.
     652    Mean - Sets the value to the arithmetic mean of the variable.
     653    Median - Sets the value to the median of the variable.
     654    Most Common - Sets the value to the most common value of the variable (first if multiple).
     655
     656Note: For categorical values, the most common value is used when selecting Mean, Median or Most Common.";
     657      toolTip.Show(tooltipText, variableValuesModeComboBox, 30000);
     658      toolTip.Active = true;
     659    }
     660    private void variableValuesModeComboBox_MouseLeave(object sender, EventArgs e) {
     661      toolTip.Active = false;
     662    }
    647663  }
    648664}
Note: See TracChangeset for help on using the changeset viewer.