Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/29/20 15:24:40 (3 years ago)
Author:
gkronber
Message:

#3022: made a few changes while reviewing the code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3022-FastFunctionExtraction/FFX/Approach.cs

    r17737 r17779  
    44namespace HeuristicLab.Algorithms.DataAnalysis.FastFunctionExtraction {
    55    internal struct Approach {
    6         public bool AllowInter { get; set; }
    7         public bool AllowDenom { get; set; }
     6        public bool AllowInteractions { get; set; }
     7        public bool AllowDenominators { get; set; }
    88        public bool AllowExp { get; set; }
    9         public bool AllowNonlinFuncs { get; set; }
     9        public bool AllowNonLinearFunctions { get; set; }
    1010        public bool AllowHinge { get; set; }
    1111        public HashSet<double> Exponents { get; set; }
    12         public HashSet<NonlinearOperator> NonlinFuncs { get; set; }
    13         public double MinHingeThr { get; set; }
    14         public double MaxHingeThr { get; set; }
    15         public int NumHingeThrs { get; set; }
    16         public double ElnetPenalty { get; set; }
     12        public HashSet<NonlinearOperator> NonLinearFunctions { get; set; }
     13        public double MinHingeThreshold { get; set; }
     14        public double MaxHingeThreshold { get; set; }
     15        public int NumHingeThresholds { get; set; }
     16        public double ElasticNetPenalty { get; set; }
    1717        public int MaxNumBases { get; set; }
    1818
    19         private static int Int(bool b) => b ? 1 : 0;
    20 
    2119        public override string ToString() {
    22             return $"Inter{Int(AllowInter)} Denom{Int(AllowDenom)} Exp{Int((AllowExp))} Nonlin{Int(AllowNonlinFuncs)} Hinge{Int(AllowHinge)}";
     20            return $"Interactions{AllowInteractions} Denominator{AllowDenominators} Exponential{AllowExp} NonLinearFunctions{AllowNonLinearFunctions} HingeFunctions{AllowHinge}";
    2321        }
    2422
    25         public Approach(bool inter, bool denom, bool exp, bool nonlin, bool hinge, HashSet<double> exponents, HashSet<NonlinearOperator> nonlinFuncs, int maxNumBases, double penalty, double minHingeThr, double maxHingeThr, int numHingeThrs) {
    26             this.AllowInter = inter;
    27             this.AllowDenom = denom;
    28             this.AllowExp = exp;
    29             this.AllowNonlinFuncs = nonlin;
    30             this.AllowHinge = hinge;
     23        public Approach(bool allowInteractions, bool allowDenominators, bool allowExp, bool allowNonLinearFunctions, bool allowHingeFunctions, HashSet<double> exponents, HashSet<NonlinearOperator> nonLinearFunctions, int maxNumBases, double elasticNetPenality, double minHingeThreshold, double maxHingeThreshold, int numHingeThresholds) {
     24            this.AllowInteractions = allowInteractions;
     25            this.AllowDenominators = allowDenominators;
     26            this.AllowExp = allowExp;
     27            this.AllowNonLinearFunctions = allowNonLinearFunctions;
     28            this.AllowHinge = allowHingeFunctions;
    3129            if (AllowExp && exponents == null) throw new ArgumentNullException(nameof(exponents));
    3230            Exponents = exponents;
    33             if (AllowNonlinFuncs && nonlinFuncs == null) throw new ArgumentNullException(nameof(nonlinFuncs));
    34             NonlinFuncs = nonlinFuncs;
    35             MinHingeThr = minHingeThr;
    36             MaxHingeThr = maxHingeThr;
    37             NumHingeThrs = numHingeThrs;
    38             ElnetPenalty = penalty;
     31            if (AllowNonLinearFunctions && nonLinearFunctions == null) throw new ArgumentNullException(nameof(nonLinearFunctions));
     32            NonLinearFunctions = nonLinearFunctions;
     33            MinHingeThreshold = minHingeThreshold;
     34            MaxHingeThreshold = maxHingeThreshold;
     35            NumHingeThresholds = numHingeThresholds;
     36            ElasticNetPenalty = elasticNetPenality;
    3937            MaxNumBases = maxNumBases;
    4038        }
Note: See TracChangeset for help on using the changeset viewer.