Free cookie consent management tool by TermsFeed Policy Generator

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

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

#2847 first implementation of M5'-regression

File size: 3.0 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 IImpurityType Impurity1;
31    private readonly IPruningType Pruningtype1;
32    private readonly ILeafType<IRegressionModel> LeafType1;
33    private readonly int MinLeafSize1;
34    private readonly IRegressionProblemData ProblemData1;
35    private readonly IRandom Random1;
36    private readonly ResultCollection Results1;
37    public IImpurityType Impurity {
38      get { return Impurity1; }
39    }
40    public IPruningType Pruningtype {
41      get { return Pruningtype1; }
42    }
43    public ILeafType<IRegressionModel> LeafType {
44      get { return LeafType1; }
45    }
46    public int MinLeafSize {
47      get { return MinLeafSize1; }
48    }
49    private IRegressionProblemData ProblemData {
50      get { return ProblemData1; }
51    }
52    public IRandom Random {
53      get { return Random1; }
54    }
55    public ResultCollection Results {
56      get { return Results1; }
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, IImpurityType impurity, ResultCollection results) {
74      Impurity1 = impurity;
75      Pruningtype1 = pruning;
76      ProblemData1 = problemData;
77      Random1 = random;
78      LeafType1 = modeltype;
79      Results1 = results;
80      var pruningLeaf = pruning.ModelType(LeafType);
81      MinLeafSize1 = 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.