Changeset 13948 for branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess
- Timestamp:
- 06/29/16 10:36:52 (9 years ago)
- Location:
- branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Algorithms.DataAnalysis
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Algorithms.DataAnalysis
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Algorithms.DataAnalysis (added) merged: 13889,13891,13895,13898,13917,13921-13922,13941
- Property svn:mergeinfo changed
-
branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceProduct.cs
r13784 r13948 94 94 public static IList<double> GetGradient(double[,] x, int i, int j, List<ParameterizedCovarianceFunction> factorFunctions) { 95 95 var covariances = factorFunctions.Select(f => f.Covariance(x, i, j)).ToArray(); 96 var gr = new List<double>( factorFunctions.Sum(f => f.CovarianceGradient(x, i, j).Count));96 var gr = new List<double>(); 97 97 for (int ii = 0; ii < factorFunctions.Count; ii++) { 98 98 foreach (var g in factorFunctions[ii].CovarianceGradient(x, i, j)) { -
branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceSum.cs
r13784 r13948 88 88 sum.CrossCovariance = (x, xt, i, j) => functions.Select(e => e.CrossCovariance(x, xt, i, j)).Sum(); 89 89 sum.CovarianceGradient = (x, i, j) => { 90 var g = new List<double>( functions.Sum(e => e.CovarianceGradient(x, i, j).Count));90 var g = new List<double>(); 91 91 foreach (var e in functions) 92 92 g.AddRange(e.CovarianceGradient(x, i, j)); -
branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs
r13823 r13948 34 34 [StorableClass] 35 35 [Item("GaussianProcessModel", "Represents a Gaussian process posterior.")] 36 public sealed class GaussianProcessModel : NamedItem, IGaussianProcessModel { 36 public sealed class GaussianProcessModel : RegressionModel, IGaussianProcessModel { 37 public override IEnumerable<string> VariablesUsedForPrediction { 38 get { return allowedInputVariables; } 39 } 40 37 41 [Storable] 38 42 private double negativeLogLikelihood; … … 61 65 get { return meanFunction; } 62 66 } 63 [Storable] 64 private string targetVariable; 65 public string TargetVariable { 66 get { return targetVariable; } 67 } 67 68 68 [Storable] 69 69 private string[] allowedInputVariables; … … 128 128 this.trainingDataset = cloner.Clone(original.trainingDataset); 129 129 this.negativeLogLikelihood = original.negativeLogLikelihood; 130 this.targetVariable = original.targetVariable;131 130 this.sqrSigmaNoise = original.sqrSigmaNoise; 132 131 if (original.meanParameter != null) { … … 147 146 IEnumerable<double> hyp, IMeanFunction meanFunction, ICovarianceFunction covarianceFunction, 148 147 bool scaleInputs = true) 149 : base( ) {148 : base(targetVariable) { 150 149 this.name = ItemName; 151 150 this.description = ItemDescription; 152 151 this.meanFunction = (IMeanFunction)meanFunction.Clone(); 153 152 this.covarianceFunction = (ICovarianceFunction)covarianceFunction.Clone(); 154 this.targetVariable = targetVariable;155 153 this.allowedInputVariables = allowedInputVariables.ToArray(); 156 154 … … 182 180 183 181 IEnumerable<double> y; 184 y = ds.GetDoubleValues( targetVariable, rows);182 y = ds.GetDoubleValues(TargetVariable, rows); 185 183 186 184 int n = x.GetLength(0); … … 301 299 302 300 #region IRegressionModel Members 303 public IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) {301 public override IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) { 304 302 return GetEstimatedValuesHelper(dataset, rows); 305 303 } 306 public GaussianProcessRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) {304 public override IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) { 307 305 return new GaussianProcessRegressionSolution(this, new RegressionProblemData(problemData)); 308 }309 IRegressionSolution IRegressionModel.CreateRegressionSolution(IRegressionProblemData problemData) {310 return CreateRegressionSolution(problemData);311 306 } 312 307 #endregion … … 392 387 } 393 388 } 389 394 390 } 395 391 } -
branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/StudentTProcessModel.cs
r13823 r13948 34 34 [StorableClass] 35 35 [Item("StudentTProcessModel", "Represents a Student-t process posterior.")] 36 public sealed class StudentTProcessModel : NamedItem, IGaussianProcessModel { 36 public sealed class StudentTProcessModel : RegressionModel, IGaussianProcessModel { 37 public override IEnumerable<string> VariablesUsedForPrediction { 38 get { return allowedInputVariables; } 39 } 40 37 41 [Storable] 38 42 private double negativeLogLikelihood; … … 61 65 get { return meanFunction; } 62 66 } 63 [Storable] 64 private string targetVariable; 65 public string TargetVariable { 66 get { return targetVariable; } 67 } 67 68 68 [Storable] 69 69 private string[] allowedInputVariables; … … 131 131 this.trainingDataset = cloner.Clone(original.trainingDataset); 132 132 this.negativeLogLikelihood = original.negativeLogLikelihood; 133 this.targetVariable = original.targetVariable;134 133 if (original.meanParameter != null) { 135 134 this.meanParameter = (double[])original.meanParameter.Clone(); … … 151 150 IEnumerable<double> hyp, IMeanFunction meanFunction, ICovarianceFunction covarianceFunction, 152 151 bool scaleInputs = true) 153 : base( ) {152 : base(targetVariable) { 154 153 this.name = ItemName; 155 154 this.description = ItemDescription; 156 155 this.meanFunction = (IMeanFunction)meanFunction.Clone(); 157 156 this.covarianceFunction = (ICovarianceFunction)covarianceFunction.Clone(); 158 this.targetVariable = targetVariable;159 157 this.allowedInputVariables = allowedInputVariables.ToArray(); 160 158 … … 186 184 187 185 IEnumerable<double> y; 188 y = ds.GetDoubleValues( targetVariable, rows);186 y = ds.GetDoubleValues(TargetVariable, rows); 189 187 190 188 int n = x.GetLength(0); … … 318 316 319 317 #region IRegressionModel Members 320 public IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) {318 public override IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) { 321 319 return GetEstimatedValuesHelper(dataset, rows); 322 320 } 323 public GaussianProcessRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) {321 public override IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) { 324 322 return new GaussianProcessRegressionSolution(this, new RegressionProblemData(problemData)); 325 }326 IRegressionSolution IRegressionModel.CreateRegressionSolution(IRegressionProblemData problemData) {327 return CreateRegressionSolution(problemData);328 323 } 329 324 #endregion
Note: See TracChangeset
for help on using the changeset viewer.