Changeset 3559


Ignore:
Timestamp:
04/29/10 18:26:23 (12 years ago)
Author:
gkronber
Message:

Implemented checkboxes to select input variables. #938 (Data types and operators for regression problems)

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblem.cs

    r3545 r3559  
    262262    }
    263263    protected virtual void OnArchitectureParameterChanged(EventArgs e) {
    264       var globalGrammar = FunctionTreeGrammar as GlobalSymbolicExpressionGrammar;
    265       if (globalGrammar != null) {
    266         globalGrammar.MaxFunctionArguments = MaxFunctionArguments.Value;
    267         globalGrammar.MaxFunctionDefinitions = MaxFunctionDefiningBranches.Value;
    268       }
     264      UpdateGrammar();
    269265    }
    270266    protected virtual void OnGrammarChanged(EventArgs e) { }
     
    356352    private void UpdateGrammar() {
    357353      foreach (var varSymbol in FunctionTreeGrammar.Symbols.OfType<HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable>()) {
    358         varSymbol.VariableNames = DataAnalysisProblemData.InputVariables.Select(x => x.Value);
     354        varSymbol.VariableNames = DataAnalysisProblemData.InputVariables.CheckedItems.Select(x => x.Value);
     355      }
     356      var globalGrammar = FunctionTreeGrammar as GlobalSymbolicExpressionGrammar;
     357      if (globalGrammar != null) {
     358        globalGrammar.MaxFunctionArguments = MaxFunctionArguments.Value;
     359        globalGrammar.MaxFunctionDefinitions = MaxFunctionDefiningBranches.Value;
    359360      }
    360361    }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/DataAnalysisProblemData.cs

    r3545 r3559  
    4646    }
    4747
    48     public IValueParameter<ItemSet<StringValue>> InputVariablesParameter {
    49       get { return (IValueParameter<ItemSet<StringValue>>)Parameters["InputVariables"]; }
     48    public IValueParameter<CheckedItemCollection<StringValue>> InputVariablesParameter {
     49      get { return (IValueParameter<CheckedItemCollection<StringValue>>)Parameters["InputVariables"]; }
    5050    }
    5151
     
    8585      }
    8686    }
    87     public ItemSet<StringValue> InputVariables {
    88       get { return (ItemSet<StringValue>)InputVariablesParameter.Value; }
     87    public CheckedItemCollection<StringValue> InputVariables {
     88      get { return (CheckedItemCollection<StringValue>)InputVariablesParameter.Value; }
    8989      set {
    9090        if (value != InputVariables) {
     
    140140      : base() {
    141141      Parameters.Add(new ValueParameter<Dataset>("Dataset", new Dataset()));
    142       Parameters.Add(new ValueParameter<ItemSet<StringValue>>("InputVariables", new ItemSet<StringValue>()));
     142      Parameters.Add(new ValueParameter<CheckedItemCollection<StringValue>>("InputVariables", new CheckedItemCollection<StringValue>()));
    143143      Parameters.Add(new ConstrainedValueParameter<StringValue>("TargetVariable"));
    144144      Parameters.Add(new ValueParameter<IntValue>("TrainingSamplesStart", new IntValue()));
     
    252252      InputVariables.ItemsAdded += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<StringValue>(InputVariables_ItemsAdded);
    253253      InputVariables.ItemsRemoved += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<StringValue>(InputVariables_ItemsRemoved);
     254      InputVariables.ItemsChecked += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<StringValue>(InputVariables_ItemsChecked);
    254255      foreach (var item in InputVariables)
    255256        item.ValueChanged += new EventHandler(InputVariable_ValueChanged);
     257    }
     258
     259    void InputVariables_ItemsChecked(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<StringValue> e) {
     260      OnProblemDataChanged(e);
    256261    }
    257262
     
    323328        ((ConstrainedValueParameter<StringValue>)TargetVariableParameter).ValidValues.Add(variableName);
    324329      TargetVariable = variableNames.First();
    325       InputVariables = new ItemSet<StringValue>(variableNames.Skip(1));
     330      InputVariables = new CheckedItemCollection<StringValue>(variableNames);
     331      foreach (var variableName in variableNames.Skip(1))
     332        InputVariables.SetItemCheckedState(variableName, true);
    326333      int middle = (int)(csvFileParser.Rows * 0.5);
    327334      TrainingSamplesStart = new IntValue(0);
Note: See TracChangeset for help on using the changeset viewer.