Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/05/16 21:41:28 (8 years ago)
Author:
mkommend
Message:

#2619: Merged r13938 and r14001 into stable.

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.DataAnalysis.Views

  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/FeatureCorrelation/AbstractFeatureCorrelationView.cs

    r12199 r14005  
    3737    public const string TESTSAMPLES = "Test Samples";
    3838
    39     public static readonly IList<string> Partitions = new List<string>() { ALLSAMPLES, TRAININGSAMPLES, TESTSAMPLES };
     39    public static readonly IList<string> Partitions = new List<string>() { ALLSAMPLES, TRAININGSAMPLES, TESTSAMPLES }.AsReadOnly();
    4040
    41     protected FeatureCorrelationCalculator fcc;
     41    protected AbstractFeatureCorrelationCalculator CorrelationCalculator { get; set; }
    4242
    4343    public new DataAnalysisProblemData Content {
     
    4949      InitializeComponent();
    5050      dataView.FormatPattern = "0.000";
    51       fcc = new FeatureCorrelationCalculator();
    5251      var calculators = ApplicationManager.Manager.GetInstances<IDependencyCalculator>();
    5352      var calcList = calculators.OrderBy(c => c.Name).Select(c => new { Name = c.Name, Calculator = c }).ToList();
     
    5554      correlationCalcComboBox.DisplayMember = "Name";
    5655      correlationCalcComboBox.DataSource = calcList;
    57       correlationCalcComboBox.SelectedItem = calcList.First(c => c.Calculator.GetType().Equals(typeof(PearsonsRDependenceCalculator)));
     56      correlationCalcComboBox.SelectedItem = calcList.First(c => c.Calculator.GetType() == typeof(PearsonsRDependenceCalculator));
    5857      partitionComboBox.DataSource = Partitions;
    5958      partitionComboBox.SelectedItem = TRAININGSAMPLES;
     
    6160    }
    6261
     62    protected override void OnClosing(FormClosingEventArgs e) {
     63      base.OnClosing(e);
     64      CorrelationCalculator.TryCancelCalculation();
     65    }
     66
    6367    protected override void RegisterContentEvents() {
    6468      base.RegisterContentEvents();
    65       fcc.ProgressCalculation += new FeatureCorrelationCalculator.ProgressCalculationHandler(Content_ProgressCalculation);
    66       fcc.CorrelationCalculationFinished += new FeatureCorrelationCalculator.CorrelationCalculationFinishedHandler(Content_CorrelationCalculationFinished);
     69      CorrelationCalculator.ProgressChanged += FeatureCorrelation_ProgressChanged;
     70      CorrelationCalculator.CorrelationCalculationFinished += FeatureCorrelation_CalculationFinished;
    6771    }
    6872
    6973    protected override void DeregisterContentEvents() {
    70       fcc.CorrelationCalculationFinished -= new FeatureCorrelationCalculator.CorrelationCalculationFinishedHandler(Content_CorrelationCalculationFinished);
    71       fcc.ProgressCalculation -= new FeatureCorrelationCalculator.ProgressCalculationHandler(Content_ProgressCalculation);
     74      CorrelationCalculator.ProgressChanged -= FeatureCorrelation_ProgressChanged;
     75      CorrelationCalculator.CorrelationCalculationFinished -= FeatureCorrelation_CalculationFinished;
    7276      base.DeregisterContentEvents();
    7377    }
     
    7579    protected override void OnContentChanged() {
    7680      base.OnContentChanged();
    77       fcc.TryCancelCalculation();
     81      CorrelationCalculator.TryCancelCalculation();
    7882      if (Content != null) {
    79         fcc.ProblemData = Content;
    8083        CalculateCorrelation();
    8184      } else {
     
    106109
    107110    protected abstract void CalculateCorrelation();
    108     protected abstract void Content_CorrelationCalculationFinished(object sender, FeatureCorrelationCalculator.CorrelationCalculationFinishedArgs e);
     111
     112    protected abstract void FeatureCorrelation_CalculationFinished(object sender,
     113      AbstractFeatureCorrelationCalculator.CorrelationCalculationFinishedArgs e);
    109114
    110115    protected void UpdateDataView(DoubleMatrix correlation) {
     
    121126    }
    122127
    123     protected void Content_ProgressCalculation(object sender, ProgressChangedEventArgs e) {
     128    protected void FeatureCorrelation_ProgressChanged(object sender, ProgressChangedEventArgs e) {
    124129      if (!progressPanel.Visible && e.ProgressPercentage != progressBar.Maximum) {
    125130        progressPanel.Show();
Note: See TracChangeset for help on using the changeset viewer.