Free cookie consent management tool by TermsFeed Policy Generator

Changeset 494


Ignore:
Timestamp:
08/11/08 14:04:12 (16 years ago)
Author:
gkronber
Message:

implemented #247 (FunctionLibraryInjector should have a parameter to switch between autoregressive and non-autoregressive modeling)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.StructureIdentification/FunctionLibraryInjector.cs

    r487 r494  
    3232namespace HeuristicLab.StructureIdentification {
    3333  public class FunctionLibraryInjector : OperatorBase {
     34    private const string TARGETVARIABLE = "TargetVariable";
     35    private const string AUTOREGRESSIVE = "Autoregressive";
    3436    private const string ALLOWEDFEATURES = "AllowedFeatures";
    3537    private const string MINTIMEOFFSET = "MinTimeOffset";
     
    4749    public FunctionLibraryInjector()
    4850      : base() {
     51      AddVariableInfo(new VariableInfo(TARGETVARIABLE, "The target variable", typeof(IntData), VariableKind.In));
     52      AddVariableInfo(new VariableInfo(AUTOREGRESSIVE, "Switch to turn on/off autoregressive modeling (wether to allow the target variable as input)", typeof(BoolData), VariableKind.In));
    4953      AddVariableInfo(new VariableInfo(ALLOWEDFEATURES, "List of indexes of allowed features", typeof(ItemList<IntData>), VariableKind.In));
    5054      AddVariableInfo(new VariableInfo(MINTIMEOFFSET, "Minimal time offset for all features", typeof(IntData), VariableKind.In));
     
    5761      IntData maxTimeOffset = GetVariableValue<IntData>(MAXTIMEOFFSET, scope, true);
    5862      ItemList<IntData> allowedFeatures = GetVariableValue<ItemList<IntData>>(ALLOWEDFEATURES, scope, true);
     63      int targetVariable = GetVariableValue<IntData>(TARGETVARIABLE, scope, true).Data;
     64      bool autoregressive = GetVariableValue<BoolData>(AUTOREGRESSIVE, scope, true).Data;
     65
     66      if(autoregressive) {
     67        // make sure the target-variable occures in list of allowed features
     68        if(!allowedFeatures.Exists(d => d.Data == targetVariable)) allowedFeatures.Add(new IntData(targetVariable));
     69      } else {
     70        // remove the target-variable in case it occures in allowed features
     71        List<IntData> ts = allowedFeatures.FindAll(d => d.Data == targetVariable);
     72        foreach(IntData t in ts) allowedFeatures.Remove(t);
     73      }
    5974
    6075      InitDefaultOperatorLibrary();
Note: See TracChangeset for help on using the changeset viewer.