Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/11/10 13:00:53 (14 years ago)
Author:
gkronber
Message:

Created a feature/exploration branch for new data analysis features #1142

Location:
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression
Files:
4 edited
3 copied

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/Evaluators/SymbolicVectorRegressionEvaluator.cs

    r4068 r4194  
    105105    #endregion
    106106
     107    public SymbolicVectorRegressionEvaluator(bool deserializing) : base(deserializing) { }
    107108    public SymbolicVectorRegressionEvaluator()
    108109      : base() {
     
    118119    }
    119120
    120     public override IOperation Apply() {
    121       var interpreter = SymbolicExpressionTreeInterpreter;
    122       var tree = SymbolicExpressionTree;
    123       var problemData = MultiVariateDataAnalysisProblemData;
    124 
    125       IEnumerable<string> selectedTargetVariables =
    126         problemData.TargetVariables.CheckedItems
    127         .Select(x => x.Value.Value);
    128 
    129       // check if there is a vector component for each target variable
    130       if (selectedTargetVariables.Count() != tree.Root.SubTrees[0].SubTrees.Count)
    131         throw new ArgumentException("The dimension of the output-vector of the tree doesn't match the number of selected target variables.");
    132       int start = SamplesStart.Value;
    133       int end = SamplesEnd.Value;
    134 
    135       IEnumerable<int> rows = GenerateRowsToEvaluate((uint)Random.Next(), RelativeNumberOfEvaluatedSamples.Value, start, end);
    136 
    137       Evaluate(tree, interpreter, problemData, selectedTargetVariables, rows, LowerEstimationLimit, UpperEstimationLimit);
    138 
    139       return base.Apply();
    140     }
    141 
    142     public abstract void Evaluate(SymbolicExpressionTree tree, ISymbolicExpressionTreeInterpreter interpreter, MultiVariateDataAnalysisProblemData problemData, IEnumerable<string> targetVariables, IEnumerable<int> rows, DoubleArray lowerEstimationBound, DoubleArray upperEstimationBound);
    143 
    144     private static IEnumerable<int> GenerateRowsToEvaluate(uint seed, double relativeAmount, int start, int end) {
     121    public static IEnumerable<int> GenerateRowsToEvaluate(uint seed, double relativeAmount, int start, int end) {
    145122      if (end < start) throw new ArgumentException("Start value is larger than end value.");
    146123      int count = (int)((end - start) * relativeAmount);
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/Evaluators/SymbolicVectorRegressionNormalizedMseEvaluator.cs

    r4112 r4194  
    3434  [Item("SymbolicVectorRegressionNormalizedMseEvaluator", "Represents an operator that calculates the sum of the normalized mean squared error over all components.")]
    3535  [StorableClass]
    36   public class SymbolicVectorRegressionNormalizedMseEvaluator : SymbolicVectorRegressionEvaluator, ISingleObjectiveSymbolicVectorRegressionEvaluator {
    37     private const string QualityParameterName = "ScaledNormalizedMeanSquaredError";
     36  public class SymbolicVectorRegressionNormalizedMseEvaluator : SingleObjectiveSymbolicVectorRegressionEvaluator {
    3837
    39     #region parameter properties
    40     public ILookupParameter<DoubleValue> QualityParameter {
    41       get { return (ILookupParameter<DoubleValue>)Parameters[QualityParameterName]; }
     38
     39    public SymbolicVectorRegressionNormalizedMseEvaluator(bool deserializing) : base(deserializing) { }
     40    public SymbolicVectorRegressionNormalizedMseEvaluator()
     41      : base() {
    4242    }
    4343
    44     #endregion
    45 
    46     public SymbolicVectorRegressionNormalizedMseEvaluator()
    47       : base() {
    48       Parameters.Add(new LookupParameter<DoubleValue>(QualityParameterName, "The sum of the normalized mean squared error over all components of the symbolic vector regression solution encoded as a symbolic expression tree."));
    49     }
    50 
    51     public override void Evaluate(SymbolicExpressionTree tree, ISymbolicExpressionTreeInterpreter interpreter, MultiVariateDataAnalysisProblemData problemData, IEnumerable<string> targetVariables, IEnumerable<int> rows, DoubleArray lowerEstimationBound, DoubleArray upperEstimationBound) {
    52       double nmse = Calculate(tree, interpreter, problemData, targetVariables, rows, lowerEstimationBound, upperEstimationBound);
    53       QualityParameter.ActualValue = new DoubleValue(nmse);
     44    public override double Evaluate(SymbolicExpressionTree tree, ISymbolicExpressionTreeInterpreter interpreter, MultiVariateDataAnalysisProblemData problemData, IEnumerable<string> targetVariables, IEnumerable<int> rows, DoubleArray lowerEstimationBound, DoubleArray upperEstimationBound) {
     45      return Calculate(tree, interpreter, problemData, targetVariables, rows, lowerEstimationBound, upperEstimationBound);
    5446    }
    5547
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/Evaluators/SymbolicVectorRegressionScaledMseEvaluator.cs

    r4112 r4194  
    3434  [Item("SymbolicVectorRegressionScaledMseEvaluator", "Represents an operator that calculates the scaled mean squared error for all components independently.")]
    3535  [StorableClass]
    36   public class SymbolicVectorRegressionScaledMseEvaluator : SymbolicVectorRegressionEvaluator, IMultiObjectiveSymbolicVectorRegressionEvaluator {
    37     private const string QualitiesParameterName = "ScaledMeanSquaredErrors";
     36  public class SymbolicVectorRegressionScaledMseEvaluator : MultiObjectiveSymbolicVectorRegressionEvaluator {
    3837    private const string AlphaParameterName = "Alpha";
    3938    private const string BetaParameterName = "Beta";
    4039
    4140    #region parameter properties
    42     public ILookupParameter<DoubleArray> QualitiesParameter {
    43       get { return (ILookupParameter<DoubleArray>)Parameters[QualitiesParameterName]; }
    44     }
    4541    public ILookupParameter<DoubleArray> AlphaParameter {
    4642      get { return (ILookupParameter<DoubleArray>)Parameters[AlphaParameterName]; }
     
    5450    public SymbolicVectorRegressionScaledMseEvaluator()
    5551      : base() {
    56       Parameters.Add(new LookupParameter<DoubleArray>(QualitiesParameterName, "The mean squared errors for each component of the symbolic vector regression solution encoded as a symbolic expression tree."));
    5752      Parameters.Add(new LookupParameter<DoubleArray>(AlphaParameterName, "The alpha parameter for linear scaling."));
    5853      Parameters.Add(new LookupParameter<DoubleArray>(BetaParameterName, "The beta parameter for linear scaling."));
    5954    }
    6055
    61     public override void Evaluate(SymbolicExpressionTree tree, ISymbolicExpressionTreeInterpreter interpreter, MultiVariateDataAnalysisProblemData problemData, IEnumerable<string> targetVariables, IEnumerable<int> rows, DoubleArray lowerEstimationBound, DoubleArray upperEstimationBound) {
     56    public override double[] Evaluate(SymbolicExpressionTree tree, ISymbolicExpressionTreeInterpreter interpreter, MultiVariateDataAnalysisProblemData problemData, IEnumerable<string> targetVariables, IEnumerable<int> rows, DoubleArray lowerEstimationBound, DoubleArray upperEstimationBound) {
    6257      List<string> targetVariablesList = targetVariables.ToList();
    63       DoubleArray qualities = new DoubleArray(targetVariables.Count());
     58      double[] qualities = new double[targetVariables.Count()];
    6459      DoubleArray alpha = new DoubleArray(qualities.Length);
    6560      DoubleArray beta = new DoubleArray(qualities.Length);
     
    8782      }
    8883
    89       QualitiesParameter.ActualValue = qualities;
    9084      AlphaParameter.ActualValue = alpha;
    9185      BetaParameter.ActualValue = beta;
     86      return qualities;
    9287    }
    9388  }
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/Evaluators/SymbolicVectorRegressionScaledNormalizedMseEvaluator.cs

    r4112 r4194  
    3434  [Item("SymbolicVectorRegressionScaledNormalizedMseEvaluator", "Represents an operator that calculates the sum of the normalized mean squared error over all components.")]
    3535  [StorableClass]
    36   public class SymbolicVectorRegressionScaledNormalizedMseEvaluator : SymbolicVectorRegressionEvaluator, ISingleObjectiveSymbolicVectorRegressionEvaluator {
    37     private const string QualityParameterName = "ScaledNormalizedMeanSquaredError";
     36  public class SymbolicVectorRegressionScaledNormalizedMseEvaluator : SingleObjectiveSymbolicVectorRegressionEvaluator {
    3837    private const string AlphaParameterName = "Alpha";
    3938    private const string BetaParameterName = "Beta";
    4039
    4140    #region parameter properties
    42     public ILookupParameter<DoubleValue> QualityParameter {
    43       get { return (ILookupParameter<DoubleValue>)Parameters[QualityParameterName]; }
    44     }
    4541    public ILookupParameter<DoubleArray> AlphaParameter {
    4642      get { return (ILookupParameter<DoubleArray>)Parameters[AlphaParameterName]; }
     
    5450    public SymbolicVectorRegressionScaledNormalizedMseEvaluator()
    5551      : base() {
    56       Parameters.Add(new LookupParameter<DoubleValue>(QualityParameterName, "The sum of the normalized mean squared error over all components of the symbolic vector regression solution encoded as a symbolic expression tree."));
    5752      Parameters.Add(new LookupParameter<DoubleArray>(AlphaParameterName, "The alpha parameter for linear scaling."));
    5853      Parameters.Add(new LookupParameter<DoubleArray>(BetaParameterName, "The beta parameter for linear scaling."));
    5954    }
    6055
    61     public override void Evaluate(SymbolicExpressionTree tree, ISymbolicExpressionTreeInterpreter interpreter, MultiVariateDataAnalysisProblemData problemData, IEnumerable<string> targetVariables, IEnumerable<int> rows, DoubleArray lowerEstimationBound, DoubleArray upperEstimationBound) {
     56    public override double Evaluate(SymbolicExpressionTree tree, ISymbolicExpressionTreeInterpreter interpreter, MultiVariateDataAnalysisProblemData problemData, IEnumerable<string> targetVariables, IEnumerable<int> rows, DoubleArray lowerEstimationBound, DoubleArray upperEstimationBound) {
    6257      List<string> targetVariablesList = targetVariables.ToList();
    6358      double nmseSum = 0.0;
     
    8782      AlphaParameter.ActualValue = alpha;
    8883      BetaParameter.ActualValue = beta;
    89       QualityParameter.ActualValue = new DoubleValue(nmseSum);
     84      return nmseSum;
    9085    }
    9186  }
Note: See TracChangeset for help on using the changeset viewer.