Kernels¶
base kernel classes¶
-
class
pyqrse.kernels.basekernels.QRSEKernelBase Bases:
objectUnnormalized computational kernel for the QRSE model.
-
use_entropy¶ 1 if uses entropy and 0 if it does not
Type: int
-
use_xi¶ True if uses xi and False if it does not
Type: bool
-
name¶ short name (S-QRSE) of the kernel (changable)
Type: str
-
long_name¶ longer name of the kernel (Symmetric QRSE). Both name and long_name can be changed for chart making purposes. They have no other effects
Type: str
-
xi¶ the mean of the data. By default it is set to 0.
Type: float
-
pnames¶ list of the parameter names including appropriate label specific subscripts
Type: list(str)
-
pnames_latex¶ list of the parameter names for Latex including appropriate label specific subscripts
Type: list(str)
-
actions list of the QRSE action labels
new actions must be of the form of a list of string labels that is the same length as the existing list of actions.
-
code QRSEModel Identification code for the Kernel
-
denorm_params(params)
-
entropy(x, params) Entropy of conditional action distribution
H(p(a|x)) = SUM p(a_i|x) for i=1,2 (binary) (i=1,2,3 for ternary)
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
generic_actions= ['a0', 'a1']
-
classmethod
getcode() QRSEModel Identification code for the Kernel
Returns: string code
-
classmethod
getktype() QRSEModel Kernel Type
Returns: string kernel type. Either ‘binary’ or ‘ternary’
-
indif(params) The point of indifference between actions.
For binary kernels:
x s.t. p(a0|x)=p(a1|x)For ternary kernels:
x s.t. p(a0|x)=p(a2|x)Parameters: params (np.array([floats]) – parameter values of the model Returns: indifference point Return type: float
-
kernel(x, params) value unnormalized kernel function
kernel = exp(potential + entropy)
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
ktype= 'binary'
-
log_kernel(x, params) Log of the unnormalized kernel function
log_kernel = potential + entropy
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
logits(x, params) The probability distribution of agent actions at a given value of x.
This also referred to as the conditional action distribution given x.
For instance:
binary_logits = p(a0|x), p(a1|x)
ternary_logits = p(p0|x), p(a1|x), p(a2|x)
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: tuple(float) or tuple(np.array([float]))
-
n_actions length of the list of actions
-
potential(x, params) potential function of the kernel
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
set_params0(data=None, weights=None) Initial parameter value set based on data
Parameters: - data
- weights
Returns: np.array([float])
-
-
class
pyqrse.kernels.basekernels.QRSEKernelBaseBinary
-
class
pyqrse.kernels.basekernels.QRSEKernelBaseTernary
binary kernels¶
This is the binary kernel docstring!
yep
-
class
pyqrse.kernels.binarykernels.SQRSEKernel Bases:
pyqrse.kernels.basekernels.QRSEKernelBaseBinary-
entropy(x, params) Entropy of conditional action distribution
H(p(a|x)) = SUM p(a_i|x) for i=1,2 (binary) (i=1,2,3 for ternary)
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
indif(params) The point of indifference between actions.
For binary kernels:
x s.t. p(a0|x)=p(a1|x)For ternary kernels:
x s.t. p(a0|x)=p(a2|x)Parameters: params (np.array([floats]) – parameter values of the model Returns: indifference point Return type: float
-
logits(x, params) The probability distribution of agent actions at a given value of x.
This also referred to as the conditional action distribution given x.
For instance:
binary_logits = p(a0|x), p(a1|x)
ternary_logits = p(p0|x), p(a1|x), p(a2|x)
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: tuple(float) or tuple(np.array([float]))
-
potential(x, params) potential function of the kernel
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
set_params0(data=None, weights=None) Initial parameter value set based on data
Parameters: - data
- weights
Returns: np.array([float])
-
-
class
pyqrse.kernels.binarykernels.SQRSEKernelNoH Bases:
pyqrse.kernels.binarykernels.SQRSEKernel-
entropy(x, params) Entropy of conditional action distribution
H(p(a|x)) = SUM p(a_i|x) for i=1,2 (binary) (i=1,2,3 for ternary)
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
-
class
pyqrse.kernels.binarykernels.SFQRSEKernel Bases:
pyqrse.kernels.binarykernels.SQRSEKernel-
potential(x, params) potential function of the kernel
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
set_params0(data=None, weights=None) Initial parameter value set based on data
Parameters: - data
- weights
Returns: np.array([float])
-
-
class
pyqrse.kernels.binarykernels.SFCQRSEKernel Bases:
pyqrse.kernels.binarykernels.SFQRSEKernel-
entropy(x, params) Entropy of conditional action distribution
H(p(a|x)) = SUM p(a_i|x) for i=1,2 (binary) (i=1,2,3 for ternary)
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
logits(x, params) The probability distribution of agent actions at a given value of x.
This also referred to as the conditional action distribution given x.
For instance:
binary_logits = p(a0|x), p(a1|x)
ternary_logits = p(p0|x), p(a1|x), p(a2|x)
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: tuple(float) or tuple(np.array([float]))
-
potential(x, params) potential function of the kernel
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
set_params0(data=None, weights=None) Initial parameter value set based on data
Parameters: - data
- weights
Returns: np.array([float])
-
-
class
pyqrse.kernels.binarykernels.ABXQRSEKernel Bases:
pyqrse.kernels.binarykernels.SFQRSEKernel-
potential(x, params) potential function of the kernel
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
set_params0(data=None, weights=None) Initial parameter value set based on data
Parameters: - data
- weights
Returns: np.array([float])
-
-
class
pyqrse.kernels.binarykernels.ABXQRSEKernelNH Bases:
pyqrse.kernels.binarykernels.SFQRSEKernel-
entropy(x, params) Entropy of conditional action distribution
H(p(a|x)) = SUM p(a_i|x) for i=1,2 (binary) (i=1,2,3 for ternary)
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
potential(x, params) potential function of the kernel
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
set_params0(data=None, weights=None) Initial parameter value set based on data
Parameters: - data
- weights
Returns: np.array([float])
-
-
class
pyqrse.kernels.binarykernels.ABXCQRSEKernel Bases:
pyqrse.kernels.binarykernels.ABXQRSEKernel-
entropy(x, params) Entropy of conditional action distribution
H(p(a|x)) = SUM p(a_i|x) for i=1,2 (binary) (i=1,2,3 for ternary)
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
logits(x, params) The probability distribution of agent actions at a given value of x.
This also referred to as the conditional action distribution given x.
For instance:
binary_logits = p(a0|x), p(a1|x)
ternary_logits = p(p0|x), p(a1|x), p(a2|x)
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: tuple(float) or tuple(np.array([float]))
-
potential(x, params) potential function of the kernel
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
set_params0(data=None, weights=None) Initial parameter value set based on data
Parameters: - data
- weights
Returns: np.array([float])
-
-
class
pyqrse.kernels.binarykernels.ABQRSEKernel Bases:
pyqrse.kernels.binarykernels.ABXQRSEKernel-
potential(x, params) potential function of the kernel
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
set_params0(data=None, weights=None) Initial parameter value set based on data
Parameters: - data
- weights
Returns: np.array([float])
-
ternary kernels¶
-
class
pyqrse.kernels.ternarykernels.AAQRSEKernel Bases:
pyqrse.kernels.basekernels.QRSEKernelBaseTernary-
entropy(x, params) Entropy of conditional action distribution
H(p(a|x)) = SUM p(a_i|x) for i=1,2 (binary) (i=1,2,3 for ternary)
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
indif(params) The point of indifference between actions.
For binary kernels:
x s.t. p(a0|x)=p(a1|x)For ternary kernels:
x s.t. p(a0|x)=p(a2|x)Parameters: params (np.array([floats]) – parameter values of the model Returns: indifference point Return type: float
-
log_kernel(x, params) Log of the unnormalized kernel function
log_kernel = potential + entropy
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
logits(x, params) The probability distribution of agent actions at a given value of x.
This also referred to as the conditional action distribution given x.
For instance:
binary_logits = p(a0|x), p(a1|x)
ternary_logits = p(p0|x), p(a1|x), p(a2|x)
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: tuple(float) or tuple(np.array([float]))
-
potential(x, params) potential function of the kernel
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
set_params0(data=None, weights=None) Initial parameter value set based on data
Parameters: - data
- weights
Returns: np.array([float])
-
-
class
pyqrse.kernels.ternarykernels.ATQRSEKernel Bases:
pyqrse.kernels.ternarykernels.AAQRSEKernel-
entropy(x, params) Entropy of conditional action distribution
H(p(a|x)) = SUM p(a_i|x) for i=1,2 (binary) (i=1,2,3 for ternary)
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
log_kernel(x, params) Log of the unnormalized kernel function
log_kernel = potential + entropy
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
logits(x, params) The probability distribution of agent actions at a given value of x.
This also referred to as the conditional action distribution given x.
For instance:
binary_logits = p(a0|x), p(a1|x)
ternary_logits = p(p0|x), p(a1|x), p(a2|x)
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: tuple(float) or tuple(np.array([float]))
-
potential(x, params) potential function of the kernel
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
set_params0(data=None, weights=None) Initial parameter value set based on data
Parameters: - data
- weights
Returns: np.array([float])
-
-
class
pyqrse.kernels.ternarykernels.AAXQRSEKernel Bases:
pyqrse.kernels.ternarykernels.AAQRSEKernelpotential = -b*(p_buy - p_sell)*(x-xi)
-
set_params0(data=None, weights=None) Initial parameter value set based on data
Parameters: - data
- weights
Returns: np.array([float])
-
-
class
pyqrse.kernels.ternarykernels.AXQRSEKernel Bases:
pyqrse.kernels.ternarykernels.AAQRSEKernel-
log_kernel(x, params) Log of the unnormalized kernel function
log_kernel = potential + entropy
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
potential(x, params) potential function of the kernel
Parameters: - x (float or np.array([float]) – value of data being tested
- params (np.array([float])) – array of parameter values
Returns: float or np.array([float])
-
set_params0(data=None, weights=None) Initial parameter value set based on data
Parameters: - data
- weights
Returns: np.array([float])
-
-
class
pyqrse.kernels.ternarykernels.AQRSEKernel
Kernel Module contents¶
QRSE Kernels¶
Base Classes - pyqrse.kernels.base¶
QRSEBaseKernel Abtract Base For All QRSE Kernels QRSEKernelBaseBinary Abtract Base For All Binary QRSE Kernels QRSEKernelBaseTernary Abtract Base For All Ternary QRSE Kernels
Binary Action Kernels - pyqrse.kernels.binary¶
SQRSEKernel Symmetric QRSE Kernel SQRSEKernelNoH Symmetric QRSE (NO Entropy Term) SFQRSEKernel Scharfenaker and Foley QRSE SFCQRSEKernel Scharfenaker and Foley QRSE (Centered) ABQRSEKernel Asymmetric-Beta QRSE ABCQRSEKernel Asymmetric-Beta QRSE (Centered)
Ternary Action Kernels - pyqrse.kernels.ternary¶
AAQRSEKernel Asymmetric-Action QRSE AAXQRSEKernel Asymmetric-Action(xi) QRSE ATQRSEKernel Asymmetric-Temperature QRSE