Free cookie consent management tool by TermsFeed Policy Generator

source: branches/M5Regression/HeuristicLab.Algorithms.DataAnalysis/3.4/M5Regression/M5Utilities/M5CreationParameters.cs @ 15549

Last change on this file since 15549 was 15549, checked in by gkronber, 6 years ago

#2847: made some changes while reviewing

File size: 2.9 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using HeuristicLab.Core;
25using HeuristicLab.Optimization;
26using HeuristicLab.Problems.DataAnalysis;
27
28namespace HeuristicLab.Algorithms.DataAnalysis {
29  internal class M5CreationParameters {
30    private readonly ISplitType impurity;
31    private readonly IPruningType pruningType;
32    private readonly ILeafType<IRegressionModel> leafType;
33    private readonly int minLeadSize;
34    private readonly IRegressionProblemData problemData;
35    private readonly IRandom random;
36    private readonly ResultCollection results;
37    public ISplitType Split {
38      get { return impurity; }
39    }
40    public IPruningType Pruningtype {
41      get { return pruningType; }
42    }
43    public ILeafType<IRegressionModel> LeafType {
44      get { return leafType; }
45    }
46    public int MinLeafSize {
47      get { return minLeadSize; }
48    }
49    private IRegressionProblemData ProblemData {
50      get { return problemData; }
51    }
52    public IRandom Random {
53      get { return random; }
54    }
55    public ResultCollection Results {
56      get { return results; }
57    }
58
59    public ILeafType<IRegressionModel> PruningLeaf {
60      get { return Pruningtype.ModelType(LeafType); }
61    }
62    public IEnumerable<string> AllowedInputVariables {
63      get { return ProblemData.AllowedInputVariables; }
64    }
65    public string TargetVariable {
66      get { return ProblemData.TargetVariable; }
67    }
68    public IDataset Data {
69      get { return ProblemData.Dataset; }
70    }
71
72    public M5CreationParameters(IPruningType pruning, int minleafSize, ILeafType<IRegressionModel> modeltype,
73      IRegressionProblemData problemData, IRandom random, ISplitType split, ResultCollection results) {
74      impurity = split;
75      pruningType = pruning;
76      this.problemData = problemData;
77      this.random = random;
78      leafType = modeltype;
79      this.results = results;
80      var pruningLeaf = pruning.ModelType(LeafType);
81      minLeadSize = Math.Max(pruningLeaf == null ? 0 : pruningLeaf.MinLeafSize(problemData), Math.Max(minleafSize, modeltype.MinLeafSize(problemData)));
82    }
83  }
84}
Note: See TracBrowser for help on using the repository browser.