Changeset 13948 for branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/ConstantModel.cs
- Timestamp:
- 06/29/16 10:36:52 (8 years ago)
- Location:
- branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis merged: 13921,13938,13941
- Property svn:mergeinfo changed
-
branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/ConstantModel.cs
r13154 r13948 31 31 [StorableClass] 32 32 [Item("Constant Model", "A model that always returns the same constant value regardless of the presented input data.")] 33 public class ConstantModel : NamedItem, IRegressionModel, IClassificationModel, ITimeSeriesPrognosisModel, IStringConvertibleValue { 33 public class ConstantModel : RegressionModel, IClassificationModel, ITimeSeriesPrognosisModel, IStringConvertibleValue { 34 public override IEnumerable<string> VariablesUsedForPrediction { get { return Enumerable.Empty<string>(); } } 35 36 34 37 [Storable] 35 private double constant;38 private readonly double constant; 36 39 public double Constant { 37 40 get { return constant; } … … 45 48 this.constant = original.constant; 46 49 } 50 47 51 public override IDeepCloneable Clone(Cloner cloner) { return new ConstantModel(this, cloner); } 48 52 49 public ConstantModel(double constant )50 : base( ) {53 public ConstantModel(double constant, string targetVariable = "Target") 54 : base(targetVariable) { 51 55 this.name = ItemName; 52 56 this.description = ItemDescription; … … 55 59 } 56 60 57 public IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) {61 public override IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) { 58 62 return rows.Select(row => Constant); 59 63 } … … 65 69 } 66 70 67 public IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) {71 public override IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) { 68 72 return new ConstantRegressionSolution(this, new RegressionProblemData(problemData)); 69 73 }
Note: See TracChangeset
for help on using the changeset viewer.