- Timestamp:
- 12/13/21 10:25:35 (3 years ago)
- 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 239 239 } 240 240 241 private ISymbolicExpressionTreeNode CreateSymbolicRegressionTreeRecursive(TreeNode[] treeNodes, int nodeIdx, VariableCondition varCondSy, Number constSy) {241 private ISymbolicExpressionTreeNode CreateSymbolicRegressionTreeRecursive(TreeNode[] treeNodes, int nodeIdx, VariableCondition varCondSy, Number numSy) { 242 242 var curNode = treeNodes[nodeIdx]; 243 243 if (curNode.VarName == TreeNode.NO_VARIABLE) { 244 var node = (NumberTreeNode) constSy.CreateTreeNode();244 var node = (NumberTreeNode)numSy.CreateTreeNode(); 245 245 node.Value = curNode.Val; 246 246 return node; … … 250 250 node.Threshold = curNode.Val; 251 251 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); 254 254 node.AddSubtree(left); 255 255 node.AddSubtree(right); -
branches/3140_NumberSymbol/HeuristicLab.Algorithms.DataAnalysis/3.4/NonlinearRegression/NonlinearRegression.cs
r18113 r18114 123 123 : base() { 124 124 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 constantsoptimization.", 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))); 127 127 Parameters.Add(new FixedValueParameter<IntValue>(RestartsParameterName, "The number of independent random restarts (>0)", new IntValue(10))); 128 128 Parameters.Add(new FixedValueParameter<IntValue>(SeedParameterName, "The PRNG seed value.", new IntValue())); … … 210 210 211 211 /// <summary> 212 /// Fits a model to the data by optimizing the numeric constants.212 /// Fits a model to the data by optimizing parameters. 213 213 /// 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 are214 /// 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 215 215 /// used as a starting point. 216 216 /// </summary>- 217 217 /// <param name="problemData">Training and test data</param> 218 218 /// <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> 221 221 /// <returns></returns> 222 222 public static ISymbolicRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData, string modelStructure, int maxIterations, bool applyLinearScaling, IRandom rand = null) { … … 265 265 if (!SymbolicRegressionParameterOptimizationEvaluator.CanOptimizeParameters(tree)) throw new ArgumentException("The optimizer does not support the specified model structure."); 266 266 267 // initialize constants randomly267 // initialize parameters randomly 268 268 if (rand != null) { 269 269 foreach (var node in tree.IterateNodesPrefix().OfType<NumberTreeNode>()) { -
branches/3140_NumberSymbol/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestModelAlglib_3_7.cs
r18100 r18114 232 232 } 233 233 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) { 235 235 236 236 // alglib source for evaluation of one tree (dfprocessinternal) … … 261 261 // } 262 262 263 if ( (double)(trees[k]) == (double)(-1)) {264 var numNode = (NumberTreeNode) constSy.CreateTreeNode();263 if (trees[k] == -1) { 264 var numNode = (NumberTreeNode)numSy.CreateTreeNode(); 265 265 numNode.Value = trees[k + 1]; 266 266 return numNode; … … 271 271 condNode.Slope = double.PositiveInfinity; 272 272 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); 275 275 276 276 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 211 211 } 212 212 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) { 214 214 215 215 // alglib source for evaluation of one tree (dfprocessinternal) … … 240 240 // } 241 241 242 if ( (double)(trees[k]) == (double)(-1)) {243 var numNode = (NumberTreeNode) constSy.CreateTreeNode();242 if (trees[k] == -1) { 243 var numNode = (NumberTreeNode)numSy.CreateTreeNode(); 244 244 numNode.Value = trees[k + 1]; 245 245 return numNode; … … 250 250 condNode.Slope = double.PositiveInfinity; 251 251 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); 254 254 255 255 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 104 104 int nRows = inputMatrix.GetLength(0); 105 105 int nFeatures = inputMatrix.GetLength(1) - 1; 106 double[] coefficients = new double[nFeatures + 1]; // last coefficient is for the constant106 double[] coefficients = new double[nFeatures + 1]; // last coefficient is for the offset 107 107 108 108 int retVal = 1;
Note: See TracChangeset
for help on using the changeset viewer.