Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/19/19 15:45:45 (5 years ago)
Author:
gkronber
Message:

#2847: fixed some issues that produced errors when testing

Location:
branches/2847_M5Regression/HeuristicLab.Algorithms.DataAnalysis/3.4/M5Regression
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/2847_M5Regression/HeuristicLab.Algorithms.DataAnalysis/3.4/M5Regression/LeafModels/PreconstructedLinearModel.cs

    r16847 r16852  
    117117      alglib.spdmatrixcholeskysolve(aTa, n + 1, true, aTyVector, out info, out report, out coefficients);
    118118
    119       //if cholesky calculation fails fall back to classic linear regresseion
     119      //if Cholesky calculation fails fall back to classic linear regresseion
    120120      if (info != 1) {
    121121        alglib.linearmodel lm;
  • branches/2847_M5Regression/HeuristicLab.Algorithms.DataAnalysis/3.4/M5Regression/LeafTypes/LinearLeaf.cs

    r16847 r16852  
    4444    #region IModelType
    4545    public override bool ProvidesConfidence {
    46       get { return false; }
     46      get { return true; }
    4747    }
    4848    public override IRegressionModel Build(IRegressionProblemData pd, IRandom random, CancellationToken cancellationToken, out int numberOfParameters) {
  • branches/2847_M5Regression/HeuristicLab.Algorithms.DataAnalysis/3.4/M5Regression/LeafTypes/M5Leaf.cs

    r16847 r16852  
    169169      }
    170170      while (!success && tries < 100);
    171       if (coefficients == null) throw new ArgumentException("No linear model could be built");
     171      if (coefficients == null || coefficients.Length != n) throw new ArgumentException("No linear model could be built");
    172172
    173173      intercept = yMean;
  • branches/2847_M5Regression/HeuristicLab.Algorithms.DataAnalysis/3.4/M5Regression/LeafTypes/M5regLeaf.cs

    r16847 r16852  
    4545    #region IModelType
    4646    public override bool ProvidesConfidence {
    47       get { return true; }
     47      get { return false; }
    4848    }
    4949
  • branches/2847_M5Regression/HeuristicLab.Algorithms.DataAnalysis/3.4/M5Regression/M5Utilities/RegressionTreeAnalyzer.cs

    r16847 r16852  
    104104      var training = pd.TrainingIndices.Where(x => !regressionRuleModel.Covers(pd.Dataset, x)).ToArray();
    105105      var test = pd.TestIndices.Where(x => !regressionRuleModel.Covers(pd.Dataset, x)).ToArray();
    106       var data = new Dataset(pd.Dataset.DoubleVariables, pd.Dataset.DoubleVariables.Select(v => pd.Dataset.GetDoubleValues(v, training.Concat(test)).ToArray()));
    107       notCovered = new RegressionProblemData(data, pd.AllowedInputVariables, pd.TargetVariable);
    108       notCovered.TestPartition.Start = notCovered.TrainingPartition.End = training.Length;
    109       notCovered.TestPartition.End = training.Length + test.Length;
     106      if (training.Length > 0 || test.Length > 0) {
     107        var data = new Dataset(pd.Dataset.DoubleVariables, pd.Dataset.DoubleVariables.Select(v => pd.Dataset.GetDoubleValues(v, training.Concat(test)).ToArray()));
     108        notCovered = new RegressionProblemData(data, pd.AllowedInputVariables, pd.TargetVariable);
     109        notCovered.TestPartition.Start = notCovered.TrainingPartition.End = training.Length;
     110        notCovered.TestPartition.End = training.Length + test.Length;
     111      } else notCovered = null;
    110112
    111113      var training2 = pd.TrainingIndices.Where(x => regressionRuleModel.Covers(pd.Dataset, x)).ToArray();
  • branches/2847_M5Regression/HeuristicLab.Algorithms.DataAnalysis/3.4/M5Regression/Splitting/M5Splitter.cs

    r16847 r16852  
    5555    protected override void AttributeSplit(IReadOnlyList<double> attValues, IReadOnlyList<double> targetValues, int minLeafSize, out int position, out double maxImpurity, out double splitValue) {
    5656      position = 0;
    57       maxImpurity = -1E20;
     57      maxImpurity = double.NegativeInfinity;
    5858      splitValue = 0.0;
    5959      var length = targetValues.Count;
  • branches/2847_M5Regression/HeuristicLab.Algorithms.DataAnalysis/3.4/M5Regression/Splitting/SplitterBase.cs

    r16847 r16852  
    3333  [Item("SplitterBase", "Abstract base class for splitters")]
    3434  public abstract class SplitterBase : ParameterizedNamedItem, ISplitter {
    35     public const string SplittingStateVariableName = "RuleSetState";
     35    public const string SplittingStateVariableName = "SplittingState";
    3636
    3737    #region Constructors & Cloning
     
    8080
    8181    protected virtual bool DecideSplit(IRegressionProblemData splitData, int minLeafSize, out string splitAttr, out double splitValue) {
    82       var bestPos = 0;
     82      var bestPos = -1;
    8383      var bestImpurity = double.MinValue;
    8484      var bestSplitValue = 0.0;
Note: See TracChangeset for help on using the changeset viewer.