- Timestamp:
- 03/09/21 08:39:25 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Algorithms.DataAnalysis/3.4/GAM/Spline1dModel.cs
r17839 r17867 37 37 [Storable] 38 38 private readonly string[] variablesUsedForPrediction; 39 public override IEnumerable<string> VariablesUsedForPrediction { 40 get { 41 return variablesUsedForPrediction; 42 } 43 } 39 public override IEnumerable<string> VariablesUsedForPrediction => variablesUsedForPrediction; 44 40 45 41 [StorableConstructor] … … 54 50 public Spline1dModel(alglib.spline1d.spline1dinterpolant interpolant, string targetVar, string inputVar) 55 51 : base(targetVar, "Spline model (1d)") { 56 this.interpolant = (alglib.spline1d.spline1dinterpolant)interpolant.make_copy(); 52 this.interpolant = (alglib.spline1d.spline1dinterpolant)interpolant.make_copy(); 57 53 this.variablesUsedForPrediction = new string[] { inputVar }; 58 54 } 59 55 60 56 61 public override IDeepCloneable Clone(Cloner cloner) { 62 return new Spline1dModel(this, cloner); 63 } 57 public override IDeepCloneable Clone(Cloner cloner) => new Spline1dModel(this, cloner); 64 58 65 59 public override IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) { … … 67 61 } 68 62 69 public double GetEstimatedValue(double x) { 70 return alglib.spline1d.spline1dcalc(interpolant, x); 71 } 63 public double GetEstimatedValue(double x) => alglib.spline1d.spline1dcalc(interpolant, x); 72 64 73 65 public override IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) { 74 var x = dataset.GetDoubleValues(VariablesUsedForPrediction.First(), rows).ToArray(); 75 foreach (var xi in x) { 76 yield return GetEstimatedValue(xi); 77 } 66 return dataset.GetDoubleValues(VariablesUsedForPrediction.First(), rows).Select(GetEstimatedValue); 78 67 } 79 68
Note: See TracChangeset
for help on using the changeset viewer.