Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/PennML/PennMLRegressionDataDescriptor.cs @ 16755

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

#2520: merged changes from PersistenceOverhaul branch (r16451:16564) into trunk

File size: 2.8 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2019 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.Collections.Generic;
23using System.Linq;
24using HeuristicLab.Data;
25
26namespace HeuristicLab.Problems.Instances.DataAnalysis {
27  public class PennMLRegressionDataDescriptor : ResourceRegressionDataDescriptor {
28    private readonly string[] variableNames;
29    private readonly string[] allowedInputVariables;
30    private readonly string target;
31    private readonly int trainStart;
32    private readonly int trainEnd;
33    private readonly int testStart;
34    private readonly int testEnd;
35
36    public PennMLRegressionDataDescriptor(string resourceName) : base(resourceName) { }
37
38    public PennMLRegressionDataDescriptor(string resourceName, IEnumerable<string> variableNames, IEnumerable<string> allowedInputVariables, string target,
39      IntRange trainRange, IntRange testRange) : this(resourceName) {
40      this.variableNames = variableNames.ToArray();
41      this.allowedInputVariables = allowedInputVariables.ToArray();
42      this.target = target;
43
44      this.trainStart = trainRange.Start;
45      this.trainEnd = trainRange.End;
46      this.testStart = testRange.Start;
47      this.testEnd = testRange.End;
48    }
49
50    public override string Name {
51      get { return ResourceName.Replace(".csv", ""); }
52    }
53
54    public override string Description {
55      get { return "No description available."; }
56    }
57
58    protected override string TargetVariable {
59      get { return target; }
60    }
61
62    protected override string[] VariableNames {
63      get { return variableNames; }
64    }
65
66    protected override string[] AllowedInputVariables {
67      get { return allowedInputVariables; }
68    }
69
70    protected override int TrainingPartitionStart {
71      get { return trainStart; }
72    }
73
74    protected override int TrainingPartitionEnd {
75      get { return trainEnd; }
76    }
77
78    protected override int TestPartitionStart {
79      get { return testStart; }
80    }
81
82    protected override int TestPartitionEnd {
83      get { return testEnd; }
84    }
85  }
86}
Note: See TracBrowser for help on using the repository browser.