Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleProblemData.cs @ 7729

Last change on this file since 7729 was 7259, checked in by swagner, 13 years ago

Updated year of copyrights to 2012 (#1716)

File size: 4.1 KB
RevLine 
[6238]1#region License Information
2/* HeuristicLab
[7259]3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
[6238]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.Collections.Generic;
23using HeuristicLab.Common;
24using HeuristicLab.Core;
25using HeuristicLab.Data;
26using HeuristicLab.Parameters;
27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
28
29namespace HeuristicLab.Problems.DataAnalysis {
30  [StorableClass]
31  [Item("RegressionEnsembleProblemData", "Represents an item containing all data defining a regression problem.")]
32  public sealed class RegressionEnsembleProblemData : RegressionProblemData {
33
[6672]34    public override bool IsTrainingSample(int index) {
35      return index >= 0 && index < Dataset.Rows &&
36             TrainingPartition.Start <= index && index < TrainingPartition.End;
[6238]37    }
38
[6672]39    public override bool IsTestSample(int index) {
40      return index >= 0 && index < Dataset.Rows &&
41             TestPartition.Start <= index && index < TestPartition.End;
[6238]42    }
43
[6672]44    private static readonly RegressionEnsembleProblemData emptyProblemData;
[6666]45    public new static RegressionEnsembleProblemData EmptyProblemData {
46      get { return emptyProblemData; }
47    }
48    static RegressionEnsembleProblemData() {
49      var problemData = new RegressionEnsembleProblemData();
50      problemData.Parameters.Clear();
51      problemData.Name = "Empty Regression ProblemData";
52      problemData.Description = "This ProblemData acts as place holder before the correct problem data is loaded.";
53      problemData.isEmpty = true;
54
55      problemData.Parameters.Add(new FixedValueParameter<Dataset>(DatasetParameterName, "", new Dataset()));
56      problemData.Parameters.Add(new FixedValueParameter<ReadOnlyCheckedItemList<StringValue>>(InputVariablesParameterName, ""));
57      problemData.Parameters.Add(new FixedValueParameter<IntRange>(TrainingPartitionParameterName, "", (IntRange)new IntRange(0, 0).AsReadOnly()));
58      problemData.Parameters.Add(new FixedValueParameter<IntRange>(TestPartitionParameterName, "", (IntRange)new IntRange(0, 0).AsReadOnly()));
59      problemData.Parameters.Add(new ConstrainedValueParameter<StringValue>(TargetVariableParameterName, new ItemSet<StringValue>()));
60      emptyProblemData = problemData;
61    }
62
[6238]63    [StorableConstructor]
64    private RegressionEnsembleProblemData(bool deserializing) : base(deserializing) { }
[6666]65    private RegressionEnsembleProblemData(RegressionEnsembleProblemData original, Cloner cloner) : base(original, cloner) { }
66    public override IDeepCloneable Clone(Cloner cloner) {
67      if (this == emptyProblemData) return emptyProblemData;
68      return new RegressionEnsembleProblemData(this, cloner);
[6238]69    }
70
[6666]71    public RegressionEnsembleProblemData() : base() { }
[6238]72    public RegressionEnsembleProblemData(IRegressionProblemData regressionProblemData)
73      : base(regressionProblemData.Dataset, regressionProblemData.AllowedInputVariables, regressionProblemData.TargetVariable) {
74      TrainingPartition.Start = regressionProblemData.TrainingPartition.Start;
75      TrainingPartition.End = regressionProblemData.TrainingPartition.End;
76      TestPartition.Start = regressionProblemData.TestPartition.Start;
77      TestPartition.End = regressionProblemData.TestPartition.End;
78    }
[6666]79    public RegressionEnsembleProblemData(Dataset dataset, IEnumerable<string> allowedInputVariables, string targetVariable)
80      : base(dataset, allowedInputVariables, targetVariable) {
81    }
[6238]82  }
83}
Note: See TracBrowser for help on using the repository browser.