Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/03/12 08:20:22 (13 years ago)
Author:
gkronber
Message:

#1810 implemented a number of additional special functions from alglib

Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/FullFunctionalExpressionGrammar.cs

    r7695 r7696  
    6161      var sqrt = new SquareRoot();
    6262      sqrt.InitialFrequency = 0.0;
     63      var airyA = new AiryA();
     64      var airyB = new AiryB();
     65      var bessel = new Bessel();
     66      var cosineIntegral = new CosineIntegral();
     67      var dawson = new Dawson();
     68      var erf = new Erf();
     69      var expIntegralEi = new ExponentialIntegralEi();
     70      var fresnelCosineIntegral = new FresnelCosineIntegral();
     71      var fresnelSineIntegral = new FresnelSineIntegral();
     72      var gamma = new Gamma();
     73      var hypCosineIntegral = new HyperbolicCosineIntegral();
     74      var hypSineIntegral = new HyperbolicSineIntegral();
     75      var norm = new Norm();
     76      var psi = new Psi();
     77      var sineIntegral = new SineIntegral();
     78
    6379      var exp = new Exponential();
    6480      var @if = new IfThenElse();
     
    86102      laggedVariable.InitialFrequency = 0.0;
    87103
    88       var allSymbols = new List<Symbol>() { add, sub, mul, div, mean, sin, cos, tan, log, square, pow, sqrt, root, exp, @if, gt, lt, and, or, not, timeLag, integral, derivative, constant, variableSymbol, laggedVariable, variableCondition };
    89       var unaryFunctionSymbols = new List<Symbol>() { square, sqrt, sin, cos, tan, log, exp, not, timeLag, integral, derivative };
     104      var allSymbols = new List<Symbol>() { add, sub, mul, div, mean, sin, cos, tan, log, square, pow, sqrt, root, exp,
     105        airyA, airyB, bessel, cosineIntegral, dawson, erf, expIntegralEi, fresnelCosineIntegral, fresnelSineIntegral, gamma, hypCosineIntegral, hypSineIntegral, norm, psi, sineIntegral,
     106        @if, gt, lt, and, or, not, timeLag, integral, derivative, constant, variableSymbol, laggedVariable, variableCondition };
     107      var unaryFunctionSymbols = new List<Symbol>() { square, sqrt, sin, cos, tan, log, exp, not, timeLag, integral, derivative,
     108        airyA, airyB, bessel, cosineIntegral, dawson, erf, expIntegralEi, fresnelCosineIntegral, fresnelSineIntegral, gamma, hypCosineIntegral, hypSineIntegral, norm, psi, sineIntegral
     109      };
    90110
    91111      var binaryFunctionSymbols = new List<Symbol>() { pow, root, gt, lt, variableCondition };
    92       var functionSymbols = new List<Symbol>() { add, sub, mul, div, mean, and, or };
     112      var ternarySymbols = new List<Symbol>() { add, sub, mul, div, mean, and, or };
    93113      var terminalSymbols = new List<Symbol>() { variableSymbol, constant, laggedVariable };
    94114
     
    96116        AddSymbol(symb);
    97117
    98       foreach (var funSymb in functionSymbols) {
     118      foreach (var funSymb in ternarySymbols) {
    99119        SetSubtreeCount(funSymb, 1, 3);
    100120      }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/TypeCoherentExpressionGrammar.cs

    r7695 r7696  
    4040    private const string BooleanOperatorsName = "Boolean Operators";
    4141    private const string ConditionalSymbolsName = "ConditionalSymbols";
     42    private const string SpecialFunctionsName = "Special Functions";
    4243    private const string TimeSeriesSymbolsName = "Time Series Symbols";
    4344
     
    6970      var sqrt = new SquareRoot();
    7071      var exp = new Exponential();
     72
     73      var airyA = new AiryA();
     74      var airyB = new AiryB();
     75      var bessel = new Bessel();
     76      var cosineIntegral = new CosineIntegral();
     77      var dawson = new Dawson();
     78      var erf = new Erf();
     79      var expIntegralEi = new ExponentialIntegralEi();
     80      var fresnelCosineIntegral = new FresnelCosineIntegral();
     81      var fresnelSineIntegral = new FresnelSineIntegral();
     82      var gamma = new Gamma();
     83      var hypCosineIntegral = new HyperbolicCosineIntegral();
     84      var hypSineIntegral = new HyperbolicSineIntegral();
     85      var norm = new Norm();
     86      var psi = new Psi();
     87      var sineIntegral = new SineIntegral();
     88
    7189      var @if = new IfThenElse();
    7290      var gt = new GreaterThan();
     
    92110      var trigonometricSymbols = new GroupSymbol(TrigonometricFunctionsName, new List<ISymbol>() { sin, cos, tan });
    93111      var exponentialAndLogarithmicSymbols = new GroupSymbol(ExponentialFunctionsName, new List<ISymbol> { exp, log });
     112      var specialFunctions = new GroupSymbol(SpecialFunctionsName, new List<ISymbol> { airyA, airyB, bessel, cosineIntegral, dawson, erf, expIntegralEi,
     113        fresnelCosineIntegral,fresnelSineIntegral,gamma,hypCosineIntegral,hypSineIntegral,norm, psi, sineIntegral});
    94114      var terminalSymbols = new GroupSymbol(TerminalsName, new List<ISymbol> { constant, variableSymbol });
    95       var realValuedSymbols = new GroupSymbol(RealValuedSymbolsName, new List<ISymbol>() { arithmeticSymbols, trigonometricSymbols, exponentialAndLogarithmicSymbols, terminalSymbols });
     115      var realValuedSymbols = new GroupSymbol(RealValuedSymbolsName, new List<ISymbol>() { arithmeticSymbols, trigonometricSymbols, exponentialAndLogarithmicSymbols, specialFunctions, terminalSymbols });
    96116
    97117      var powerSymbols = new GroupSymbol(PowerFunctionsName, new List<ISymbol> { square, pow, sqrt, root });
     
    118138      SetSubtreeCount(sqrt, 1, 1);
    119139      SetSubtreeCount(exponentialAndLogarithmicSymbols, 1, 1);
     140      SetSubtreeCount(specialFunctions, 1, 1);
    120141      SetSubtreeCount(terminalSymbols, 0, 0);
    121142
     
    141162      AddAllowedChildSymbol(realValuedSymbols, conditionSymbols);
    142163      AddAllowedChildSymbol(realValuedSymbols, timeSeriesSymbols);
     164      AddAllowedChildSymbol(realValuedSymbols, specialFunctions);
    143165
    144166      AddAllowedChildSymbol(powerSymbols, variableSymbol, 0);
     
    186208
    187209    public void ConfigureAsDefaultRegressionGrammar() {
    188       Symbols.Where(s => s is Average).First().Enabled = false;
    189       Symbols.Where(s => s.Name == TrigonometricFunctionsName).First().Enabled = false;
    190       Symbols.Where(s => s.Name == PowerFunctionsName).First().Enabled = false;
    191       Symbols.Where(s => s.Name == ConditionalSymbolsName).First().Enabled = false;
    192       Symbols.Where(s => s.Name == TimeSeriesSymbolsName).First().Enabled = false;
     210      Symbols.First(s => s is Average).Enabled = false;
     211      Symbols.First(s => s.Name == TrigonometricFunctionsName).Enabled = false;
     212      Symbols.First(s => s.Name == PowerFunctionsName).Enabled = false;
     213      Symbols.First(s => s.Name == SpecialFunctionsName).Enabled = false;
     214      Symbols.First(s => s.Name == ConditionalSymbolsName).Enabled = false;
     215      Symbols.First(s => s.Name == TimeSeriesSymbolsName).Enabled = false;
    193216    }
    194217
    195218    public void ConfigureAsDefaultClassificationGrammar() {
    196       Symbols.Where(s => s is Average).First().Enabled = false;
    197       Symbols.Where(s => s is VariableCondition).First().Enabled = false;
    198       Symbols.Where(s => s.Name == TrigonometricFunctionsName).First().Enabled = false;
    199       Symbols.Where(s => s.Name == ExponentialFunctionsName).First().Enabled = false;
    200       Symbols.Where(s => s.Name == PowerFunctionsName).First().Enabled = false;
    201       Symbols.Where(s => s.Name == TimeSeriesSymbolsName).First().Enabled = false;
     219      Symbols.First(s => s is Average).Enabled = false;
     220      Symbols.First(s => s is VariableCondition).Enabled = false;
     221      Symbols.First(s => s.Name == TrigonometricFunctionsName).Enabled = false;
     222      Symbols.First(s => s.Name == ExponentialFunctionsName).Enabled = false;
     223      Symbols.First(s => s.Name == SpecialFunctionsName).Enabled = false;
     224      Symbols.First(s => s.Name == PowerFunctionsName).Enabled = false;
     225      Symbols.First(s => s.Name == TimeSeriesSymbolsName).Enabled = false;
    202226    }
    203227  }
Note: See TracChangeset for help on using the changeset viewer.