Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/23/16 16:19:04 (9 years ago)
Author:
mkommend
Message:

#2591: Changed all GP covariance and mean functions to use int[] for column indices instead of IEnumerable<int>. Changed GP utils, GPModel and StudentTProcessModell as well to use fewer iterators and adapted unit tests to new interface.

Location:
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanFunctions
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanFunctions/MeanConst.cs

    r12012 r13721  
    7676    }
    7777
    78     public ParameterizedMeanFunction GetParameterizedMeanFunction(double[] p, IEnumerable<int> columnIndices) {
     78    public ParameterizedMeanFunction GetParameterizedMeanFunction(double[] p, int[] columnIndices) {
    7979      double c;
    8080      GetParameters(p, out c);
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanFunctions/MeanLinear.cs

    r12012 r13721  
    2121
    2222using System;
    23 using System.Collections.Generic;
    2423using System.Linq;
    2524using HeuristicLab.Common;
     
    7069    }
    7170
    72     public ParameterizedMeanFunction GetParameterizedMeanFunction(double[] p, IEnumerable<int> columnIndices) {
     71    public ParameterizedMeanFunction GetParameterizedMeanFunction(double[] p, int[] columnIndices) {
    7372      double[] weights;
    74       int[] columns = columnIndices.ToArray();
     73      int[] columns = columnIndices;
    7574      GetParameter(p, out weights);
    7675      var mf = new ParameterizedMeanFunction();
     
    7877        // sanity check
    7978        if (weights.Length != columns.Length) throw new ArgumentException("The number of rparameters must match the number of variables for the linear mean function.");
    80         return Util.ScalarProd(weights, Util.GetRow(x, i, columns));
     79        return Util.ScalarProd(weights, Util.GetRow(x, i, columns).ToArray());
    8180      };
    8281      mf.Gradient = (x, i, k) => {
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanFunctions/MeanModel.cs

    r13136 r13721  
    7373    }
    7474
    75     public ParameterizedMeanFunction GetParameterizedMeanFunction(double[] p, IEnumerable<int> columnIndices) {
     75    public ParameterizedMeanFunction GetParameterizedMeanFunction(double[] p, int[] columnIndices) {
    7676      if (p.Length > 0) throw new ArgumentException("No parameters allowed for model-based mean function.", "p");
    7777      var solution = RegressionSolution;
    7878      var variableNames = solution.ProblemData.AllowedInputVariables.ToArray();
    79       if (variableNames.Length != columnIndices.Count())
     79      if (variableNames.Length != columnIndices.Length)
    8080        throw new ArgumentException("The number of input variables does not match in MeanModel");
    8181      var variableValues = variableNames.Select(_ => new List<double>() { 0.0 }).ToArray(); // or of zeros
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanFunctions/MeanProduct.cs

    r12012 r13721  
    7373
    7474
    75     public ParameterizedMeanFunction GetParameterizedMeanFunction(double[] p, IEnumerable<int> columnIndices) {
     75    public ParameterizedMeanFunction GetParameterizedMeanFunction(double[] p, int[] columnIndices) {
    7676      var factorMf = new List<ParameterizedMeanFunction>();
    7777      int totalNumberOfParameters = GetNumberOfParameters(numberOfVariables);
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanFunctions/MeanSum.cs

    r12012 r13721  
    6868    }
    6969
    70     public ParameterizedMeanFunction GetParameterizedMeanFunction(double[] p, IEnumerable<int> columnIndices) {
     70    public ParameterizedMeanFunction GetParameterizedMeanFunction(double[] p, int[] columnIndices) {
    7171      var termMf = new List<ParameterizedMeanFunction>();
    7272      int totalNumberOfParameters = GetNumberOfParameters(numberOfVariables);
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanFunctions/MeanZero.cs

    r12012 r13721  
    2020#endregion
    2121using System;
    22 using System.Collections.Generic;
    23 using System.Linq;
    2422using HeuristicLab.Common;
    2523using HeuristicLab.Core;
     
    5048    }
    5149
    52     public ParameterizedMeanFunction GetParameterizedMeanFunction(double[] p, IEnumerable<int> columnIndices) {
     50    public ParameterizedMeanFunction GetParameterizedMeanFunction(double[] p, int[] columnIndices) {
    5351      if (p.Length > 0) throw new ArgumentException("No parameters allowed for zero mean function.", "p");
    5452      var mf = new ParameterizedMeanFunction();
Note: See TracChangeset for help on using the changeset viewer.