entropy
module¶
Entropies and their derivatives.
EntropyHessianComponents = tuple[ThreeArrays, TwoArrays]
module-attribute
¶
combines the tuples of the values of the components of the hessians.
EntropyHessians = tuple[EntropyHessianMuMu, EntropyHessianMuR]
module-attribute
¶
combines the hessian functions.
EntropyFunctions
dataclass
¶
Defines the entropy used, via the derivative \(e_0 + e \cdot \alpha\)
Attributes:
Name | Type | Description |
---|---|---|
e0_fun |
MatchingFunction
|
required |
parameter_dependent |
bool
|
if |
e_fun |
MatchingFunction | None
|
only in entropies that depend on parameters.
Defaults to |
hessian |
str | None
|
defaults to |
e0_derivative |
EntropyHessians | None
|
the derivative of |
e_derivative |
EntropyHessians | None
|
the derivative of |
additional_parameters |
list | None
|
additional parameters
that define the distribution of errors.
Defaults to |
description |
str | None
|
some text describing the model.
Defaults to |
Examples:
See entropy_choo_siow
in choo_siow.py
Source code in cupid_matching/entropy.py
67 68 69 70 71 72 73 74 75 76 77 78 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 122 123 124 125 |
|
check_additional_parameters(number_required, additional_parameters)
¶
checks that the correct number of additional parameters is passed in
Parameters:
Name | Type | Description | Default |
---|---|---|---|
number_required |
int
|
number we want |
required |
additional_parameters |
list | None
|
the list of additional parameters passed in, if any |
required |
Source code in cupid_matching/entropy.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|
entropy_gradient(entropy, muhat, alpha=None, additional_parameters=None)
¶
Computes the derivative of the entropy wrt \(\mu\) at \((\mu, n, m, \alpha, p)\)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entropy |
EntropyFunctions
|
the |
required |
muhat |
Matching
|
a Matching |
required |
alpha |
np.ndarray | None
|
a vector of parameters of the derivative of the entropy, if any |
None
|
additional_parameters |
list | None
|
a list of additional parameters |
None
|
Returns:
Type | Description |
---|---|
np.ndarray
|
the derivative of the entropy wrt \(\mu\) |
np.ndarray
|
at \((\mu, n, m, \alpha, p)\). |
Source code in cupid_matching/entropy.py
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 158 |
|
fill_hessianMuMu_from_components(hessian_components)
¶
Fills the hessian of the entropy wrt \((\mu,\mu)\)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hessian_components |
ThreeArrays
|
the three components of the hessian |
required |
Returns:
Type | Description |
---|---|
np.ndarray
|
the (XY,XY) matrix of the hessian |
Source code in cupid_matching/entropy.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
|
fill_hessianMuR_from_components(hessian_components)
¶
Fills the hessian of the entropy wrt \((\mu,(n,m))\)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hessian_components |
TwoArrays
|
the two components of the hessian |
required |
Returns:
Type | Description |
---|---|
np.ndarray
|
the (XY,X+Y) matrix of the hessian |
Source code in cupid_matching/entropy.py
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
|
numeric_hessian(entropy, muhat, alpha=None, additional_parameters=None)
¶
Evaluates numerically the components of the hessians of the entropy wrt \((\mu,\mu)\) and \((\mu,(n,m))\)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entropy |
EntropyFunctions
|
the |
required |
muhat |
Matching
|
a Matching |
required |
alpha |
np.ndarray | None
|
a vector of parameters of the derivative of the entropy, if any |
None
|
additional_parameters |
list | None
|
a list of additional parameters, if any |
None
|
Returns:
Type | Description |
---|---|
EntropyHessianComponents
|
the hessians of the entropy wrt \((\mu,\mu)\) and \((\mu,(n,m))\). |
Source code in cupid_matching/entropy.py
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 |
|