Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/16/10 15:22:57 (15 years ago)
Author:
gkronber
Message:

Refactored HeuristicLab.Problems.DataAnalysis namespace. #938 (Data types and operators for regression problems)

Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic
Files:
5 deleted
6 edited
1 copied

Legend:

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

    r3338 r3373  
    2020#endregion
    2121
    22 
    2322using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2423using System.Collections.Generic;
     
    2827using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2928using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.GeneralSymbols;
    30 using HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Symbols;
    3129using HeuristicLab.Data;
    32 namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic {
     30using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols;
     31namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    3332  [StorableClass]
    3433  [Item("ArithmeticExpressionGrammar", "Represents a grammar for functional expressions using only arithmetic operations.")]
     
    4544
    4645    [Storable]
    47     private HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Symbols.Variable variableSymbol;
     46    private HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable variableSymbol;
    4847
    4948    public ArithmeticExpressionGrammar()
     
    5857      var div = new Division();
    5958      var constant = new Constant();
    60       variableSymbol = new HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Symbols.Variable();
     59      variableSymbol = new HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable();
    6160
    6261      var allSymbols = new List<Symbol>() { add, sub, mul, div, constant, variableSymbol };
    6362      var functionSymbols = new List<Symbol>() { add, sub, mul, div };
     63
    6464      foreach (var symb in allSymbols)
    6565        AddSymbol(symb);
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/SimpleArithmeticExpressionEvaluator.cs

    r3294 r3373  
    2727using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2828using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.GeneralSymbols;
    29 using HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Symbols;
     29using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols;
    3030
    31 namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic {
     31namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    3232  [StorableClass]
    3333  [Item("SimpleArithmeticExpressionEvaluator", "Default evaluator for arithmetic symbolic expression trees.")]
     
    8282          }
    8383        case CodeSymbol.Dynamic: {
    84             if (currentInstr.dynamicNode is VariableTreeNode) {
    85               var variableTreeNode = currentInstr.dynamicNode as VariableTreeNode;
     84            var variableTreeNode = currentInstr.dynamicNode as VariableTreeNode;
     85            if (variableTreeNode != null) {
    8686              return dataset[row, dataset.GetVariableIndex(variableTreeNode.VariableName)] * variableTreeNode.Weight;
    87             } else if (currentInstr.dynamicNode is ConstantTreeNode) {
    88               return ((ConstantTreeNode)currentInstr.dynamicNode).Value;
     87            }
     88            var constTreeNode = currentInstr.dynamicNode as ConstantTreeNode;
     89            if (constTreeNode != null) {
     90              return constTreeNode.Value;
    8991            } else throw new NotSupportedException();
    9092          }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Constant.cs

    r3294 r3373  
    2323using HeuristicLab.Core;
    2424using HeuristicLab.Operators;
    25 using HeuristicLab.Random;
    2625using HeuristicLab.Data;
    2726using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2827using HeuristicLab.Parameters;
    29 namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Symbols {
     28namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols {
    3029  [StorableClass]
    3130  [Item("Constant", "Represents a constant value.")]
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/ConstantTreeNode.cs

    r3294 r3373  
    2727using HeuristicLab.Data;
    2828using HeuristicLab.Random;
    29 namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Symbols {
     29namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols {
    3030  [StorableClass]
    3131  public sealed class ConstantTreeNode : SymbolicExpressionTreeTerminalNode {
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Variable.cs

    r3294 r3373  
    2929using System.Collections.Generic;
    3030using System;
    31 namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Symbols {
     31namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols {
    3232  [StorableClass]
    3333  [Item("Variable", "Represents a variable value.")]
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/VariableTreeNode.cs

    r3294 r3373  
    2727using HeuristicLab.Data;
    2828using HeuristicLab.Random;
    29 namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Symbols {
     29namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols {
    3030  [StorableClass]
    3131  public sealed class VariableTreeNode : SymbolicExpressionTreeTerminalNode {
Note: See TracChangeset for help on using the changeset viewer.