-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathKernelFunction.h
62 lines (50 loc) · 1.47 KB
/
KernelFunction.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
* Author: Andrea Casalino
* Created: 29.11.2021
*
* report any bug to andrecasa91@gmail.com.
**/
#pragma once
#include <Eigen/Core>
#include <memory>
namespace gauss::gp {
class KernelFunction;
using KernelFunctionPtr = std::unique_ptr<KernelFunction>;
/**
* @brief https : // www.cs.toronto.edu/~duvenaud/cookbook/
*
*/
class KernelFunction {
public:
virtual ~KernelFunction() = default;
virtual KernelFunctionPtr copy() const = 0;
KernelFunction(const KernelFunction &) = delete;
KernelFunction &operator==(const KernelFunction &) = delete;
/**
* @return the number of hyperparameters pertaining to this kernel function
*/
virtual std::size_t numberOfParameters() const = 0;
/**
* @return the current values of the hyperparameters
*/
virtual std::vector<double> getParameters() const = 0;
/**
* @brief sets the hyperparameters values.
*/
virtual void setParameters(const std::vector<double> &values) = 0;
/**
* @brief evaluation is expected be reflexive: evaluate(a,b) = evaluate(b,a)
*
*/
virtual double evaluate(const Eigen::VectorXd &a,
const Eigen::VectorXd &b) const = 0;
/**
* @return The gradient of the kernel activation function w.r.t. the
* hyperparameters
*/
virtual std::vector<double> getGradient(const Eigen::VectorXd &a,
const Eigen::VectorXd &b) const = 0;
protected:
KernelFunction() = default;
};
} // namespace gauss::gp