Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/05/19 11:08:57 (5 years ago)
Author:
gkronber
Message:

#2847: more changes for renaming the M5 plugin

Location:
trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4
Files:
9 edited
4 moved

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/DecisionTreeRegression.cs

    r17079 r17080  
    3838  [StorableType("FC8D8E5A-D16D-41BB-91CF-B2B35D17ADD7")]
    3939  [Creatable(CreatableAttribute.Categories.DataAnalysisRegression, Priority = 95)]
    40   [Item("M5RegressionTree", "A M5 regression tree / rule set")]
    41   public sealed class M5Regression : FixedDataAnalysisAlgorithm<IRegressionProblem> {
     40  [Item("Decision tree regression", "A regression tree / rule set learner")]
     41  public sealed class DecisionTreeRegression : FixedDataAnalysisAlgorithm<IRegressionProblem> {
    4242    public override bool SupportsPause {
    4343      get { return true; }
     
    135135    #region Constructors and Cloning
    136136    [StorableConstructor]
    137     private M5Regression(StorableConstructorFlag _) : base(_) { }
    138     private M5Regression(M5Regression original, Cloner cloner) : base(original, cloner) {
     137    private DecisionTreeRegression(StorableConstructorFlag _) : base(_) { }
     138    private DecisionTreeRegression(DecisionTreeRegression original, Cloner cloner) : base(original, cloner) {
    139139      stateScope = cloner.Clone(stateScope);
    140140    }
    141     public M5Regression() {
     141    public DecisionTreeRegression() {
    142142      var modelSet = new ItemSet<ILeafModel>(ApplicationManager.Manager.GetInstances<ILeafModel>());
    143143      var pruningSet = new ItemSet<IPruning>(ApplicationManager.Manager.GetInstances<IPruning>());
     
    145145      Parameters.Add(new FixedValueParameter<BoolValue>(GenerateRulesParameterName, "Whether a set of rules or a decision tree shall be created (default=false)", new BoolValue(false)));
    146146      Parameters.Add(new FixedValueParameter<PercentValue>(HoldoutSizeParameterName, "How much of the training set shall be reserved for pruning (default=20%).", new PercentValue(0.2)));
    147       Parameters.Add(new ConstrainedValueParameter<ISplitter>(SplitterParameterName, "The type of split function used to create node splits (default='M5Splitter').", splitterSet, splitterSet.OfType<M5Splitter>().First()));
     147      Parameters.Add(new ConstrainedValueParameter<ISplitter>(SplitterParameterName, "The type of split function used to create node splits (default='Splitter').", splitterSet, splitterSet.OfType<M5Splitter>().First()));
    148148      Parameters.Add(new FixedValueParameter<IntValue>(MinimalNodeSizeParameterName, "The minimal number of samples in a leaf node (default=1).", new IntValue(1)));
    149149      Parameters.Add(new ConstrainedValueParameter<ILeafModel>(LeafModelParameterName, "The type of model used for the nodes (default='LinearLeaf').", modelSet, modelSet.OfType<LinearLeaf>().First()));
     
    155155    }
    156156    public override IDeepCloneable Clone(Cloner cloner) {
    157       return new M5Regression(this, cloner);
     157      return new DecisionTreeRegression(this, cloner);
    158158    }
    159159    #endregion
     
    204204      var doubleVars = new HashSet<string>(problemData.Dataset.DoubleVariables);
    205205      var vars = problemData.AllowedInputVariables.Concat(new[] {problemData.TargetVariable}).ToArray();
    206       if (vars.Any(v => !doubleVars.Contains(v))) throw new NotSupportedException("M5 regression supports only double valued input or output features.");
     206      if (vars.Any(v => !doubleVars.Contains(v))) throw new NotSupportedException("Decision tree regression supports only double valued input or output features.");
    207207      var doubles = vars.Select(v => problemData.Dataset.GetDoubleValues(v, problemData.TrainingIndices).ToArray()).ToArray();
    208208      if (doubles.Any(v => v.Any(x => double.IsNaN(x) || double.IsInfinity(x))))
    209         throw new NotSupportedException("M5 regression does not support NaN or infinity values in the input dataset.");
     209        throw new NotSupportedException("Decision tree regression does not support NaN or infinity values in the input dataset.");
    210210      var trainingData = new Dataset(vars, doubles);
    211211      var pd = new RegressionProblemData(trainingData, problemData.AllowedInputVariables, problemData.TargetVariable);
     
    283283      var ruleSet = solution.Model as RegressionRuleSetModel;
    284284      if (ruleSet != null) {
    285         results.Add(RegressionTreeAnalyzer.CreateRulesResult(ruleSet, problemData, "M5Rules", true));
     285        results.Add(RegressionTreeAnalyzer.CreateRulesResult(ruleSet, problemData, "Rules", true));
    286286        frequencies = RegressionTreeAnalyzer.GetRuleVariableFrequences(ruleSet);
    287287        results.Add(RegressionTreeAnalyzer.CreateCoverageDiagram(ruleSet, problemData));
  • trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees-3.4.csproj

    r17079 r17080  
    6868  <ItemGroup>
    6969    <Compile Include="DecisionTreeRegression.cs" />
     70    <Compile Include="Interfaces\IDecisionTreeModel.cs" />
    7071    <Compile Include="Interfaces\ILeafModel.cs" />
    71     <Compile Include="Interfaces\IM5Model.cs" />
    7272    <Compile Include="Interfaces\IPruning.cs" />
    7373    <Compile Include="Interfaces\ISplitter.cs" />
     
    7979    <Compile Include="LeafTypes\ConstantLeaf.cs" />
    8080    <Compile Include="LeafTypes\GaussianProcessLeaf.cs" />
     81    <Compile Include="LeafTypes\Leaf.cs" />
    8182    <Compile Include="LeafTypes\LeafBase.cs" />
    8283    <Compile Include="LeafTypes\LinearLeaf.cs" />
    83     <Compile Include="LeafTypes\M5Leaf.cs" />
    84     <Compile Include="LeafTypes\M5regLeaf.cs" />
     84    <Compile Include="LeafTypes\RegularizedLeaf.cs" />
    8585    <Compile Include="MetaModels\RegressionNodeModel.cs" />
    8686    <Compile Include="MetaModels\RegressionNodeTreeModel.cs" />
     
    9393    <Compile Include="Splitting\CorrelationImpurityCalculator.cs" />
    9494    <Compile Include="Splitting\CorrelationSplitter.cs" />
    95     <Compile Include="Splitting\M5Splitter.cs" />
    9695    <Compile Include="Splitting\NeumaierSum.cs" />
    9796    <Compile Include="Splitting\OrderImpurityCalculator.cs" />
     97    <Compile Include="Splitting\Splitter.cs" />
    9898    <Compile Include="Splitting\SplitterBase.cs" />
    9999    <Compile Include="Splitting\UnivariateOnlineLR.cs" />
  • trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/LeafTypes/LeafBase.cs

    r16847 r17080  
    7272
    7373    public void Build(RegressionNodeTreeModel tree, IReadOnlyList<int> trainingRows, IScope stateScope, CancellationToken cancellationToken) {
    74       var parameters = (RegressionTreeParameters)stateScope.Variables[M5Regression.RegressionTreeParameterVariableName].Value;
     74      var parameters = (RegressionTreeParameters)stateScope.Variables[DecisionTreeRegression.RegressionTreeParameterVariableName].Value;
    7575      var state = (LeafBuildingState)stateScope.Variables[LeafBuildingStateVariableName].Value;
    7676
  • trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/LeafTypes/LinearLeaf.cs

    r16852 r17080  
    3030namespace HeuristicLab.Algorithms.DataAnalysis {
    3131  [StorableType("347CA25D-FB37-4C4F-9B61-9D79288B2B28")]
    32   [Item("LinearLeaf", "A leaf type that uses linear models as leaf models. This is the standard for M5' regression")]
     32  [Item("LinearLeaf", "A leaf type that uses linear models as leaf models. This is the standard for decision tree regression")]
    3333  public class LinearLeaf : LeafBase {
    3434    #region Constructors & Cloning
  • trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/MetaModels/RegressionNodeTreeModel.cs

    r16847 r17080  
    7171    #region IM5Model
    7272    public void Build(IReadOnlyList<int> trainingRows, IReadOnlyList<int> pruningRows, IScope statescope, ResultCollection results, CancellationToken cancellationToken) {
    73       var regressionTreeParams = (RegressionTreeParameters)statescope.Variables[M5Regression.RegressionTreeParameterVariableName].Value;
     73      var regressionTreeParams = (RegressionTreeParameters)statescope.Variables[DecisionTreeRegression.RegressionTreeParameterVariableName].Value;
    7474      //start with one node
    7575      if (Root == null)
     
    8787
    8888    public void Update(IReadOnlyList<int> rows, IScope statescope, CancellationToken cancellationToken) {
    89       var regressionTreeParams = (RegressionTreeParameters)statescope.Variables[M5Regression.RegressionTreeParameterVariableName].Value;
     89      var regressionTreeParams = (RegressionTreeParameters)statescope.Variables[DecisionTreeRegression.RegressionTreeParameterVariableName].Value;
    9090      regressionTreeParams.LeafModel.Build(this, rows, statescope, cancellationToken);
    9191    }
    9292
    9393    public static void Initialize(IScope stateScope) {
    94       var param = (RegressionTreeParameters)stateScope.Variables[M5Regression.RegressionTreeParameterVariableName].Value;
     94      var param = (RegressionTreeParameters)stateScope.Variables[DecisionTreeRegression.RegressionTreeParameterVariableName].Value;
    9595      stateScope.Variables.Add(new Variable(RootVariableName, RegressionNodeModel.CreateNode(param.TargetVariable, param)));
    9696    }
     
    9898
    9999    public void BuildModel(IReadOnlyList<int> trainingRows, IReadOnlyList<int> pruningRows, IScope statescope, ResultCollection results, CancellationToken cancellationToken) {
    100       var regressionTreeParams = (RegressionTreeParameters)statescope.Variables[M5Regression.RegressionTreeParameterVariableName].Value;
     100      var regressionTreeParams = (RegressionTreeParameters)statescope.Variables[DecisionTreeRegression.RegressionTreeParameterVariableName].Value;
    101101      //start with one node
    102102      Root = RegressionNodeModel.CreateNode(regressionTreeParams.TargetVariable, regressionTreeParams);
  • trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/MetaModels/RegressionRuleModel.cs

    r16847 r17080  
    8383
    8484    public void Build(IReadOnlyList<int> trainingRows, IReadOnlyList<int> pruningRows, IScope statescope, ResultCollection results, CancellationToken cancellationToken) {
    85       var regressionTreeParams = (RegressionTreeParameters)statescope.Variables[M5Regression.RegressionTreeParameterVariableName].Value;
     85      var regressionTreeParams = (RegressionTreeParameters)statescope.Variables[DecisionTreeRegression.RegressionTreeParameterVariableName].Value;
    8686      variables = regressionTreeParams.AllowedInputVariables.ToList();
    8787
     
    109109
    110110    public void Update(IReadOnlyList<int> rows, IScope statescope, CancellationToken cancellationToken) {
    111       var regressionTreeParams = (RegressionTreeParameters)statescope.Variables[M5Regression.RegressionTreeParameterVariableName].Value;
     111      var regressionTreeParams = (RegressionTreeParameters)statescope.Variables[DecisionTreeRegression.RegressionTreeParameterVariableName].Value;
    112112      int np;
    113113      RuleModel = regressionTreeParams.LeafModel.BuildModel(rows, regressionTreeParams, cancellationToken, out np);
  • trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/MetaModels/RegressionRuleSetModel.cs

    r16847 r17080  
    7777    #region IM5Model
    7878    public void Build(IReadOnlyList<int> trainingRows, IReadOnlyList<int> pruningRows, IScope stateScope, ResultCollection results, CancellationToken cancellationToken) {
    79       var regressionTreeParams = (RegressionTreeParameters)stateScope.Variables[M5Regression.RegressionTreeParameterVariableName].Value;
     79      var regressionTreeParams = (RegressionTreeParameters)stateScope.Variables[DecisionTreeRegression.RegressionTreeParameterVariableName].Value;
    8080      var ruleSetState = (RuleSetState)stateScope.Variables[RuleSetStateVariableName].Value;
    8181
  • trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/Pruning/ComplexityPruning.cs

    r16847 r17080  
    8686
    8787    public void Prune(RegressionNodeTreeModel treeModel, IReadOnlyList<int> trainingRows, IReadOnlyList<int> pruningRows, IScope statescope, CancellationToken cancellationToken) {
    88       var regressionTreeParams = (RegressionTreeParameters)statescope.Variables[M5Regression.RegressionTreeParameterVariableName].Value;
     88      var regressionTreeParams = (RegressionTreeParameters)statescope.Variables[DecisionTreeRegression.RegressionTreeParameterVariableName].Value;
    8989      var state = (PruningState)statescope.Variables[PruningStateVariableName].Value;
    9090
  • trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/Splitting/Splitter.cs

    r17079 r17080  
    3030namespace HeuristicLab.Algorithms.DataAnalysis {
    3131  [StorableType("502B1429-7A28-45C1-A60A-93E72CB3AF4A")]
    32   [Item("M5Splitter", "A split selector that uses the ratio between Variances^(1/Order) to determine good splits.")]
     32  [Item("Splitter", "A split selector that uses the ratio between Variances^(1/Order) to determine good splits.")]
    3333  public sealed class M5Splitter : SplitterBase {
    3434    public const string OrderParameterName = "Order";
  • trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/Splitting/SplitterBase.cs

    r16852 r17080  
    4848
    4949    public void Split(RegressionNodeTreeModel tree, IReadOnlyList<int> trainingRows, IScope stateScope, CancellationToken cancellationToken) {
    50       var regressionTreeParams = (RegressionTreeParameters)stateScope.Variables[M5Regression.RegressionTreeParameterVariableName].Value;
     50      var regressionTreeParams = (RegressionTreeParameters)stateScope.Variables[DecisionTreeRegression.RegressionTreeParameterVariableName].Value;
    5151      var splittingState = (SplittingState)stateScope.Variables[SplittingStateVariableName].Value;
    5252      var variables = regressionTreeParams.AllowedInputVariables.ToArray();
Note: See TracChangeset for help on using the changeset viewer.