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 |
|
---|
22 | using System;
|
---|
23 | using System.Collections.Generic;
|
---|
24 | using HeuristicLab.Core;
|
---|
25 | using HeuristicLab.Optimization;
|
---|
26 | using HeuristicLab.Problems.DataAnalysis;
|
---|
27 |
|
---|
28 | namespace HeuristicLab.Algorithms.DataAnalysis {
|
---|
29 | internal class M5CreationParameters {
|
---|
30 | private readonly ISplitType 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 ISplitType Split {
|
---|
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, ISplitType split, ResultCollection results) {
|
---|
74 | Impurity1 = split;
|
---|
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 | } |
---|