Free cookie consent management tool by TermsFeed Policy Generator

source: branches/M5Regression/HeuristicLab.Algorithms.DataAnalysis/3.4/M5Regression/M5Utilities/M5Parameters.cs @ 15614

Last change on this file since 15614 was 15614, checked in by bwerth, 7 years ago

#2847 made changes to M5 according to review comments

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 M5Parameters {
30    private readonly ISpliter splitter;
31    private readonly IPruning pruning;
32    private readonly ILeafModel leafModel;
33    private readonly int minLeafSize;
34    private readonly IRegressionProblemData problemData;
35    private readonly IRandom random;
36    private readonly ResultCollection results;
37    public ISpliter Spliter {
38      get { return splitter; }
39    }
40    public IPruning Pruning {
41      get { return pruning; }
42    }
43    public ILeafModel LeafModel {
44      get { return leafModel; }
45    }
46    public int MinLeafSize {
47      get { return minLeafSize; }
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    public IEnumerable<string> AllowedInputVariables {
59      get { return ProblemData.AllowedInputVariables; }
60    }
61    public string TargetVariable {
62      get { return ProblemData.TargetVariable; }
63    }
64    public IDataset Data {
65      get { return ProblemData.Dataset; }
66    }
67
68    public M5Parameters(IPruning pruning, int minleafSize, ILeafModel leafModel,
69      IRegressionProblemData problemData, IRandom random, ISpliter splitter, ResultCollection results) {
70      this.problemData = problemData;
71      this.random = random;
72      this.leafModel = leafModel;
73      this.splitter = splitter;
74      this.pruning = pruning;
75      this.results = results;
76      minLeafSize = Math.Max(pruning.MinLeafSize(problemData, leafModel), Math.Max(minleafSize, leafModel.MinLeafSize(problemData)));
77    }
78
79    public M5Parameters(ILeafModel modeltype, IRegressionProblemData problemData, IRandom random) {
80      this.problemData = problemData;
81      this.random = random;
82      leafModel = modeltype;
83    }
84  }
85}
Note: See TracBrowser for help on using the repository browser.