Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/10/16 20:10:25 (8 years ago)
Author:
gkronber
Message:

#2650:

  • extended non-linear regression to work with factors
  • fixed bugs in constants optimizer and tree interpreter
  • improved simplification of factor variables
  • added support for factors to ERC view
  • added support for factors to solution comparison view
  • activated view for all factors
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs

    r14249 r14251  
    194194        terminalNodes = tree.Root.IterateNodesPrefix().OfType<SymbolicExpressionTreeTerminalNode>().ToList();
    195195      else
    196         terminalNodes = new List<SymbolicExpressionTreeTerminalNode>(tree.Root.IterateNodesPrefix().OfType<ConstantTreeNode>());
     196        terminalNodes = new List<SymbolicExpressionTreeTerminalNode>
     197          (tree.Root.IterateNodesPrefix()
     198          .OfType<SymbolicExpressionTreeTerminalNode>()
     199          .Where(node => node is ConstantTreeNode || node is FactorVariableTreeNode));
    197200
    198201      //extract inital constants
     
    214217            c[i++] = binFactorVarTreeNode.Weight;
    215218          else if (factorVarTreeNode != null) {
     219            // gkronber: a factorVariableTreeNode holds a category-specific constant therefore we can consider factors to be the same as constants
    216220            foreach (var w in factorVarTreeNode.Weights) c[i++] = w;
    217221          }
     
    252256        alglib.lsfitfit(state, function_cx_1_func, function_cx_1_grad, null, null);
    253257        alglib.lsfitresults(state, out info, out c, out rep);
    254       } catch (ArithmeticException) {
     258      }
     259      catch (ArithmeticException) {
    255260        return originalQuality;
    256       } catch (alglib.alglibexception) {
     261      }
     262      catch (alglib.alglibexception) {
    257263        return originalQuality;
    258264      }
     
    284290          binFactorVarTreeNode.Weight = constants[i++];
    285291        else if (factorVarTreeNode != null) {
    286           foreach (var w in factorVarTreeNode.Weights) constants[i++] = w;
     292          for (int j = 0; j < factorVarTreeNode.Weights.Length; j++)
     293            factorVarTreeNode.Weights[j] = constants[i++];
    287294        }
    288295      }
Note: See TracChangeset for help on using the changeset viewer.