Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/05/14 15:08:11 (11 years ago)
Author:
mkommend
Message:

#1758: Reimplemented functionality to load new problem data to data analysis solution and redesigned the according views.

  • Added setter for the target variable of regression and classification problem data.
  • Added functionality to check the compatibility of problem data.
  • Added functionality to adjust the properties of a problem data.
  • Added flowLayoutPanel with according buttons for loading a new problem data, simplifying and exporting data analysis solutions.
  • TradingProblemData currently throws a NotSupportedException when the properties should be adjusted.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs

    r9456 r10540  
    100100    public string TargetVariable {
    101101      get { return TargetVariableParameter.Value.Value; }
     102      set {
     103        if (value == null) throw new ArgumentNullException("targetVariable", "The provided value for the targetVariable is null.");
     104        if (value == TargetVariable) return;
     105
     106        var matchingParameterValue = TargetVariableParameter.ValidValues.FirstOrDefault(v => v.Value == value);
     107        if (matchingParameterValue == null) throw new ArgumentException("The provided value is not valid as the targetVariable.", "targetVariable");
     108        TargetVariableParameter.Value = matchingParameterValue;
     109      }
    102110    }
    103111
     
    142150      OnChanged();
    143151    }
     152
     153    protected override bool IsProblemDataCompatible(IDataAnalysisProblemData problemData, out string errorMessage) {
     154      if (problemData == null) throw new ArgumentNullException("problemData", "The provided problemData is null.");
     155      IRegressionProblemData regressionProblemData = problemData as IRegressionProblemData;
     156      if (regressionProblemData == null)
     157        throw new ArgumentException("The problem data is not a regression problem data. Instead a " + problemData.GetType().GetPrettyName() + " was provided.", "problemData");
     158
     159      var returnValue = base.IsProblemDataCompatible(problemData, out errorMessage);
     160      //check targetVariable
     161      if (problemData.InputVariables.All(var => var.Value != TargetVariable)) {
     162        errorMessage = string.Format("The target variable {0} is not present in the new problem data.", TargetVariable)
     163                       + Environment.NewLine + errorMessage;
     164        return false;
     165      }
     166      return returnValue;
     167    }
     168
     169    public override void AdjustProblemDataProperties(IDataAnalysisProblemData problemData) {
     170      if (problemData == null) throw new ArgumentNullException("problemData", "The provided problemData is null.");
     171      RegressionProblemData regressionProblemData = problemData as RegressionProblemData;
     172      if (regressionProblemData == null)
     173        throw new ArgumentException("The problem data is not a regression problem data. Instead a " + problemData.GetType().GetPrettyName() + " was provided.", "problemData");
     174
     175      base.AdjustProblemDataProperties(problemData);
     176      TargetVariable = regressionProblemData.TargetVariable;
     177    }
    144178  }
    145179}
Note: See TracChangeset for help on using the changeset viewer.