Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/15/12 09:11:17 (13 years ago)
Author:
gkronber
Message:

#1081 merged r7462:7609 from trunk into time series branch

Location:
branches/HeuristicLab.TimeSeries
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.TimeSeries

  • branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisEvaluator.cs

    r7268 r7615  
    4444    private const string EvaluationPartitionParameterName = "EvaluationPartition";
    4545    private const string RelativeNumberOfEvaluatedSamplesParameterName = "RelativeNumberOfEvaluatedSamples";
     46    private const string ValidRowIndicatorParameterName = "ValidRowIndicator";
    4647
    4748    public override bool CanChangeName { get { return false; } }
     
    7071      get { return (IValueLookupParameter<PercentValue>)Parameters[RelativeNumberOfEvaluatedSamplesParameterName]; }
    7172    }
     73    public IValueLookupParameter<StringValue> ValidRowIndicatorParameter {
     74      get { return (IValueLookupParameter<StringValue>)Parameters[ValidRowIndicatorParameterName]; }
     75    }
    7276    #endregion
    7377
     
    8791      Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The upper and lower limit that should be used as cut off value for the output values of symbolic data analysis trees."));
    8892      Parameters.Add(new ValueLookupParameter<PercentValue>(RelativeNumberOfEvaluatedSamplesParameterName, "The relative number of samples of the dataset partition, which should be randomly chosen for evaluation between the start and end index."));
     93      Parameters.Add(new ValueLookupParameter<StringValue>(ValidRowIndicatorParameterName, "An indicator variable in the data set that specifies which rows should be evaluated (those for which the indicator <> 0) (optional)."));
     94    }
     95
     96    [StorableHook(HookType.AfterDeserialization)]
     97    private void AfterDeserialization() {
     98      if(!Parameters.ContainsKey(ValidRowIndicatorParameterName))
     99        Parameters.Add(new ValueLookupParameter<StringValue>(ValidRowIndicatorParameterName, "An indicator variable in the data set that specifies which rows should be evaluated (those for which the indicator <> 0) (optional)."));
    89100    }
    90101
     
    93104    }
    94105
    95     protected IEnumerable<int> GenerateRowsToEvaluate(double percentageOfRows) {
    96 
     106    protected IEnumerable<int> GenerateRowsToEvaluate(double percentageOfRows)
     107    {
    97108
    98109      IEnumerable<int> rows;
     
    113124      }
    114125
    115       return rows.Where(i => i < testPartitionStart || testPartitionEnd <= i);
     126      rows = rows.Where(i => i < testPartitionStart || testPartitionEnd <= i);
     127     
     128      if(ValidRowIndicatorParameter.ActualValue != null)
     129      {
     130        string indicatorVar = ValidRowIndicatorParameter.ActualValue.Value;
     131        var problemData = ProblemDataParameter.ActualValue;
     132        var indicatorRow = problemData.Dataset.GetReadOnlyDoubleValues(indicatorVar);
     133        rows = rows.Where(r=>!indicatorRow[r].IsAlmost(0.0));
     134      }
     135      return rows;
    116136    }
    117137  }
Note: See TracChangeset for help on using the changeset viewer.