likelihood
gradnl(par, D, Y, gradnl_method='inv')
¶
Calculate the gradient of the negative log-likelihood for an exponential correlation function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
par |
ndarray
|
Array of parameters, where the first element is the range parameter and the second element is the nugget parameter. |
required |
D |
ndarray
|
Distance matrix of shape (n, n). |
required |
Y |
ndarray
|
Response vector of shape (n,). |
required |
gradnl_method |
str
|
The inversion method to use. |
'inv'
|
Returns:
Type | Description |
---|---|
ndarray
|
np.ndarray: Gradient vector. |
Examples:
>>> import numpy as np
>>> from spotpython.gp.likelihood import gradnl
>>> D = np.array([[0.0, 1.0, 2.0], [1.0, 0.0, 1.0], [2.0, 1.0, 0.0]])
>>> Y = np.array([1.0, 2.0, 3.0])
>>> par = np.array([0.5, 0.1])
>>> grad = gradnl(par, D, Y)
>>> print(grad)
[-0.000 -0.000]
Source code in spotpython/gp/likelihood.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
|
gradnlsep(par, X, Y, gradnlsep_method='inv')
¶
Compute gradient of the negative log-likelihood using full matrix inverse.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
par |
ndarray
|
Array of parameters, where the first ncol(X) elements are the range parameters and the last element is the nugget parameter. |
required |
X |
ndarray
|
Input matrix of shape (n, col). |
required |
Y |
ndarray
|
Response vector of shape (n,). |
required |
gradnlsep_method |
str
|
The inversion method to use. |
'inv'
|
Source code in spotpython/gp/likelihood.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
nl(par, D, Y, nl_method='inv')
¶
Calculate the negative log-likelihood for an exponential correlation function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
par |
ndarray
|
Array of parameters, where the first element is the range parameter and the second element is the nugget parameter. |
required |
D |
ndarray
|
Distance matrix of shape (n, n). |
required |
Y |
ndarray
|
Response vector of shape (n,). |
required |
nl_method |
str
|
The inversion method to use. |
'inv'
|
Returns:
Name | Type | Description |
---|---|---|
float |
float
|
Negative log-likelihood. |
Examples:
>>> import numpy as np
>>> from spotpython.gp.likelihood import nl
>>> D = np.array([[0.0, 1.0, 2.0], [1.0, 0.0, 1.0], [2.0, 1.0, 0.0]])
>>> Y = np.array([1.0, 2.0, 3.0])
>>> par = np.array([0.5, 0.1])
>>> result = nl(par, D, Y)
>>> print(result)
2.772
Source code in spotpython/gp/likelihood.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
nlsep(par, X, Y, nlsep_method='inv')
¶
Calculate the negative log-likelihood for a separable power exponential correlation function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
par |
ndarray
|
Array of parameters, where the first ncol(X) elements are the range parameters and the last element is the nugget parameter. |
required |
X |
ndarray
|
Input matrix of shape (n, col). |
required |
Y |
ndarray
|
Response vector of shape (n,). |
required |
Returns:
Name | Type | Description |
---|---|---|
float |
float
|
Negative log-likelihood. |
Examples:
>>> import numpy as np
>>> from spotpython.gp.likelihood import nlsep
>>> X = np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]])
>>> Y = np.array([1.0, 2.0, 3.0])
>>> par = np.array([0.5, 0.5, 0.1])
>>> result = nlsep(par, X, Y)
>>> print(result)
2.772588722239781
Source code in spotpython/gp/likelihood.py
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 |
|