Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/13/21 10:25:35 (3 years ago)
Author:
gkronber
Message:

#3140: made several more changes while reviewing the branch.

Location:
branches/3140_NumberSymbol/HeuristicLab.Algorithms.DataAnalysis/3.4
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/3140_NumberSymbol/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/RegressionTreeModel.cs

    r18100 r18114  
    239239    }
    240240
    241     private ISymbolicExpressionTreeNode CreateSymbolicRegressionTreeRecursive(TreeNode[] treeNodes, int nodeIdx, VariableCondition varCondSy, Number constSy) {
     241    private ISymbolicExpressionTreeNode CreateSymbolicRegressionTreeRecursive(TreeNode[] treeNodes, int nodeIdx, VariableCondition varCondSy, Number numSy) {
    242242      var curNode = treeNodes[nodeIdx];
    243243      if (curNode.VarName == TreeNode.NO_VARIABLE) {
    244         var node = (NumberTreeNode)constSy.CreateTreeNode();
     244        var node = (NumberTreeNode)numSy.CreateTreeNode();
    245245        node.Value = curNode.Val;
    246246        return node;
     
    250250        node.Threshold = curNode.Val;
    251251
    252         var left = CreateSymbolicRegressionTreeRecursive(treeNodes, curNode.LeftIdx, varCondSy, constSy);
    253         var right = CreateSymbolicRegressionTreeRecursive(treeNodes, curNode.RightIdx, varCondSy, constSy);
     252        var left = CreateSymbolicRegressionTreeRecursive(treeNodes, curNode.LeftIdx, varCondSy, numSy);
     253        var right = CreateSymbolicRegressionTreeRecursive(treeNodes, curNode.RightIdx, varCondSy, numSy);
    254254        node.AddSubtree(left);
    255255        node.AddSubtree(right);
  • branches/3140_NumberSymbol/HeuristicLab.Algorithms.DataAnalysis/3.4/NonlinearRegression/NonlinearRegression.cs

    r18113 r18114  
    123123      : base() {
    124124      Problem = new RegressionProblem();
    125       Parameters.Add(new FixedValueParameter<StringValue>(ModelStructureParameterName, "The function for which the parameters must be fit (only numeric constants are tuned).", new StringValue("<num> * x*x + 0.0")));
    126       Parameters.Add(new FixedValueParameter<IntValue>(IterationsParameterName, "The maximum number of iterations for constants optimization.", new IntValue(200)));
     125      Parameters.Add(new FixedValueParameter<StringValue>(ModelStructureParameterName, "The expression for which the <num> parameters should be fit.", new StringValue("<num> * x*x + 0.0")));
     126      Parameters.Add(new FixedValueParameter<IntValue>(IterationsParameterName, "The maximum number of iterations for parameter optimization.", new IntValue(200)));
    127127      Parameters.Add(new FixedValueParameter<IntValue>(RestartsParameterName, "The number of independent random restarts (>0)", new IntValue(10)));
    128128      Parameters.Add(new FixedValueParameter<IntValue>(SeedParameterName, "The PRNG seed value.", new IntValue()));
     
    210210
    211211    /// <summary>
    212     /// Fits a model to the data by optimizing the numeric constants.
     212    /// Fits a model to the data by optimizing parameters.
    213213    /// Model is specified as infix expression containing variable names and numbers.
    214     /// The starting point for the numeric constants is initialized randomly if a random number generator is specified (~N(0,1)). Otherwise the user specified constants are
     214    /// The starting values for the parameters are initialized randomly if a random number generator is specified (~N(0,1)). Otherwise the user specified values are
    215215    /// used as a starting point.
    216216    /// </summary>-
    217217    /// <param name="problemData">Training and test data</param>
    218218    /// <param name="modelStructure">The function as infix expression</param>
    219     /// <param name="maxIterations">Number of constant optimization iterations (using Levenberg-Marquardt algorithm)</param>
    220     /// <param name="random">Optional random number generator for random initialization of numeric constants.</param>
     219    /// <param name="maxIterations">Number of Levenberg-Marquardt iterations</param>
     220    /// <param name="random">Optional random number generator for random initialization of parameters.</param>
    221221    /// <returns></returns>
    222222    public static ISymbolicRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData, string modelStructure, int maxIterations, bool applyLinearScaling, IRandom rand = null) {
     
    265265      if (!SymbolicRegressionParameterOptimizationEvaluator.CanOptimizeParameters(tree)) throw new ArgumentException("The optimizer does not support the specified model structure.");
    266266
    267       // initialize constants randomly
     267      // initialize parameters randomly
    268268      if (rand != null) {
    269269        foreach (var node in tree.IterateNodesPrefix().OfType<NumberTreeNode>()) {
  • branches/3140_NumberSymbol/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestModelAlglib_3_7.cs

    r18100 r18114  
    232232    }
    233233
    234     private ISymbolicExpressionTreeNode CreateRegressionTreeRec(double[] trees, int offset, int k, Number constSy, VariableCondition varCondSy) {
     234    private ISymbolicExpressionTreeNode CreateRegressionTreeRec(double[] trees, int offset, int k, Number numSy, VariableCondition varCondSy) {
    235235
    236236      // alglib source for evaluation of one tree (dfprocessinternal)
     
    261261      // }
    262262
    263       if ((double)(trees[k]) == (double)(-1)) {
    264         var numNode = (NumberTreeNode)constSy.CreateTreeNode();
     263      if (trees[k] == -1) {
     264        var numNode = (NumberTreeNode)numSy.CreateTreeNode();
    265265        numNode.Value = trees[k + 1];
    266266        return numNode;
     
    271271        condNode.Slope = double.PositiveInfinity;
    272272
    273         var left = CreateRegressionTreeRec(trees, offset, k + 3, constSy, varCondSy);
    274         var right = CreateRegressionTreeRec(trees, offset, offset + (int)Math.Round(trees[k + 2]), constSy, varCondSy);
     273        var left = CreateRegressionTreeRec(trees, offset, k + 3, numSy, varCondSy);
     274        var right = CreateRegressionTreeRec(trees, offset, offset + (int)Math.Round(trees[k + 2]), numSy, varCondSy);
    275275
    276276        condNode.AddSubtree(left); // not 100% correct because interpreter uses: if(x <= thres) left() else right() and RF uses if(x < thres) left() else right() (see above)
  • branches/3140_NumberSymbol/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestModelFull.cs

    r18100 r18114  
    211211    }
    212212
    213     private ISymbolicExpressionTreeNode CreateRegressionTreeRec(double[] trees, int offset, int k, Number constSy, VariableCondition varCondSy) {
     213    private ISymbolicExpressionTreeNode CreateRegressionTreeRec(double[] trees, int offset, int k, Number numSy, VariableCondition varCondSy) {
    214214
    215215      // alglib source for evaluation of one tree (dfprocessinternal)
     
    240240      // }
    241241
    242       if ((double)(trees[k]) == (double)(-1)) {
    243         var numNode = (NumberTreeNode)constSy.CreateTreeNode();
     242      if (trees[k] == -1) {
     243        var numNode = (NumberTreeNode)numSy.CreateTreeNode();
    244244        numNode.Value = trees[k + 1];
    245245        return numNode;
     
    250250        condNode.Slope = double.PositiveInfinity;
    251251
    252         var left = CreateRegressionTreeRec(trees, offset, k + 3, constSy, varCondSy);
    253         var right = CreateRegressionTreeRec(trees, offset, offset + (int)Math.Round(trees[k + 2]), constSy, varCondSy);
     252        var left = CreateRegressionTreeRec(trees, offset, k + 3, numSy, varCondSy);
     253        var right = CreateRegressionTreeRec(trees, offset, offset + (int)Math.Round(trees[k + 2]), numSy, varCondSy);
    254254
    255255        condNode.AddSubtree(left); // not 100% correct because interpreter uses: if(x <= thres) left() else right() and RF uses if(x < thres) left() else right() (see above)
  • branches/3140_NumberSymbol/HeuristicLab.Algorithms.DataAnalysis/3.4/TimeSeries/AutoregressiveModeling.cs

    r17180 r18114  
    104104      int nRows = inputMatrix.GetLength(0);
    105105      int nFeatures = inputMatrix.GetLength(1) - 1;
    106       double[] coefficients = new double[nFeatures + 1]; // last coefficient is for the constant
     106      double[] coefficients = new double[nFeatures + 1]; // last coefficient is for the offset
    107107
    108108      int retVal = 1;
Note: See TracChangeset for help on using the changeset viewer.