Module light_labyrinth.hyperparams.activation
The light_labyrinth.hyperparams.activation
module includes ReflectiveIndex
classes
with predefined splitting criteria (or activation functions) that can be used for building Light Labyrinth models.
Expand source code
"""
The `light_labyrinth.hyperparams.activation` module includes `ReflectiveIndex` classes
with predefined splitting criteria (or activation functions) that can be used for building Light Labyrinth models.
"""
from ._activation2d import ReflectiveIndexCalculator, ReflectiveIndexCalculatorRandom
from ._activation3d import ReflectiveIndexCalculator3D, ReflectiveIndexCalculator3DRandom
__all__ = ["ReflectiveIndexCalculator", "ReflectiveIndexCalculatorRandom",
"ReflectiveIndexCalculator3D", "ReflectiveIndexCalculator3DRandom"]
Classes
class ReflectiveIndexCalculator (value, names=None, *, module=None, qualname=None, type=None, start=1)
-
ReflectiveIndexCalculator class includes all the available splitting criteria for 2-dimensional Light Labyrinth models.
Splitting criterion in a LightLabyrinth model is the function that for a given node W_{ij} and an input vector x outputs the portion of light reflected p_{ij}^L and passed through p_{ij}^R. These two values always add up to 1.
Examples
>>> from light_labyrinth.hyperparams.activation import ReflectiveIndexCalculator >>> from light_labyrinth.dim2 import LightLabyrinthClassifier >>> model = LightLabyrinthClassifier(3, 3, ... activation=ReflectiveIndexCalculator.sigmoid_dot_product)
Expand source code
class ReflectiveIndexCalculator(Enum): """ ReflectiveIndexCalculator class includes all the available splitting criteria for 2-dimensional Light Labyrinth models. Splitting criterion in a LightLabyrinth model is the function that for a given node \\(W_{ij}\\) and an input vector \\(x\\) outputs the portion of light reflected \\(p_{ij}^L\\) and passed through \\(p_{ij}^R\\). These two values always add up to 1. Examples -------- >>> from light_labyrinth.hyperparams.activation import ReflectiveIndexCalculator >>> from light_labyrinth.dim2 import LightLabyrinthClassifier >>> model = LightLabyrinthClassifier(3, 3, ... activation=ReflectiveIndexCalculator.sigmoid_dot_product) """ sigmoid_dot_product = 1 """ The portion of light reflected is given by the logistic function over dot product of the input vector \\(x\\) and vector of weights \\(W_{ij}\\). \\[SD(x, W_{ij}) = \\begin{bmatrix} f(x \cdot W_{ij}) \\\\ 1 - f(x \cdot W_{ij}) \\end{bmatrix} = \\begin{bmatrix} p_{ij}^L \\\\ p_{ij}^R \\end{bmatrix} \\\\ f(v) = \\frac{1}{1+e^{-v}}\\] """
Ancestors
- enum.Enum
Class variables
var sigmoid_dot_product
-
The portion of light reflected is given by the logistic function over dot product of the input vector x and vector of weights W_{ij}. SD(x, W_{ij}) = \begin{bmatrix} f(x \cdot W_{ij}) \\ 1 - f(x \cdot W_{ij}) \end{bmatrix} = \begin{bmatrix} p_{ij}^L \\ p_{ij}^R \end{bmatrix} \\ f(v) = \frac{1}{1+e^{-v}}
class ReflectiveIndexCalculator3D (value, names=None, *, module=None, qualname=None, type=None, start=1)
-
ReflectiveIndexCalculator3D class includes all the available splitting criteria for 3-dimensional Light Labyrinth models.
Splitting criterion in a LightLabyrinth3D model is the function that for a given node W_{ij}^t and an input vector x outputs the portion of light reflected in all three directions - to the left p_{ij}^{tL}, right p_{ij}^{tR} and up p_{ij}^{tU}. These three values always add up to 1.
Examples
>>> from light_labyrinth.hyperparams.activation import ReflectiveIndexCalculator3D >>> from light_labyrinth.dim3 import LightLabyrinth3DClassifier >>> model = LightLabyrinthClassifier(3, 3, 2, ... activation=ReflectiveIndexCalculator3D.softmax_dot_product_3d)
Expand source code
class ReflectiveIndexCalculator3D(Enum): """ ReflectiveIndexCalculator3D class includes all the available splitting criteria for 3-dimensional Light Labyrinth models. Splitting criterion in a LightLabyrinth3D model is the function that for a given node \\(W_{ij}^t\\) and an input vector \\(x\\) outputs the portion of light reflected in all three directions - to the left \\(p_{ij}^{tL}\\), right \(p_{ij}^{tR}\\) and up \(p_{ij}^{tU}\\). These three values always add up to 1. Examples -------- >>> from light_labyrinth.hyperparams.activation import ReflectiveIndexCalculator3D >>> from light_labyrinth.dim3 import LightLabyrinth3DClassifier >>> model = LightLabyrinthClassifier(3, 3, 2, ... activation=ReflectiveIndexCalculator3D.softmax_dot_product_3d) """ softmax_dot_product_3d = 1 """ The portion of light reflected in all three directions is given by the softmax function over product of the input vector \\(x\\) and the matrix of weights \\(W_{ij}^t\\). \\[SD3d(x, W_{ij}^t) = \\sigma(x \cdot W_{ij}^t) = \\sigma\\Big(\\begin{bmatrix} p_{ij}^{tL} & p_{ij}^{tR} & p_{ij}^{tU} \\end{bmatrix}^T\\Big) \\\\ \\sigma(v)_i = \\frac{e^{v_i}}{\\sum_{j=1}^Z e^{v_j}} \\text{ for } i \\in \\{1,...,Z\\}\\] """
Ancestors
- enum.Enum
Class variables
var softmax_dot_product_3d
-
The portion of light reflected in all three directions is given by the softmax function over product of the input vector x and the matrix of weights W_{ij}^t. SD3d(x, W_{ij}^t) = \sigma(x \cdot W_{ij}^t) = \sigma\Big(\begin{bmatrix} p_{ij}^{tL} & p_{ij}^{tR} & p_{ij}^{tU} \end{bmatrix}^T\Big) \\ \sigma(v)_i = \frac{e^{v_i}}{\sum_{j=1}^Z e^{v_j}} \text{ for } i \in \{1,...,Z\}
class ReflectiveIndexCalculator3DRandom (value, names=None, *, module=None, qualname=None, type=None, start=1)
-
ReflectiveIndexCalculator3DRandom class includes all the available splitting criteria for 3-dimensional random Light Labyrinth models.
Splitting criterion in a LightLabyrinth3DRandom model is the function that for a given node W_{ij}^t, a subset of indices B_{ij}^t and an input vector x outputs the portion of light reflected in all three directions - to the left p_{ij}^{tL}, right p_{ij}^{tR} and up p_{ij}^{tU}. These three values always add up to 1.
Examples
>>> from light_labyrinth.hyperparams.activation import ReflectiveIndexCalculator3DRandom >>> from light_labyrinth.dim3 import LightLabyrinth3DRandomClassifier >>> model = LightLabyrinth3DRandomClassifier(3, 3, 2, features=0.7, ... activation=ReflectiveIndexCalculator3DRandom.random_3d_softmax_dot_product)
Expand source code
class ReflectiveIndexCalculator3DRandom(Enum): """ ReflectiveIndexCalculator3DRandom class includes all the available splitting criteria for 3-dimensional random Light Labyrinth models. Splitting criterion in a LightLabyrinth3DRandom model is the function that for a given node \\(W_{ij}^t\\), a subset of indices \\(B_{ij}^t\\) and an input vector \\(x\\) outputs the portion of light reflected in all three directions - to the left \\(p_{ij}^{tL}\\), right \(p_{ij}^{tR}\\) and up \(p_{ij}^{tU}\\). These three values always add up to 1. Examples -------- >>> from light_labyrinth.hyperparams.activation import ReflectiveIndexCalculator3DRandom >>> from light_labyrinth.dim3 import LightLabyrinth3DRandomClassifier >>> model = LightLabyrinth3DRandomClassifier(3, 3, 2, features=0.7, ... activation=ReflectiveIndexCalculator3DRandom.random_3d_softmax_dot_product) """ random_3d_softmax_dot_product = 1 """ The portion of light reflected in all three directions is given by the softmax function over product of the input vector \\(x\\) and the matrix of weights \\(W_{ij}^t\\) masked by the binary matrix holding relevant indices \\(B_{ij}^t\\). \\[RSD3d(x, W_{ij}^t, B_{ij}^t) = \\sigma(x \cdot (W_{ij}^t * B_{ij}^t)) = \\sigma\\Big(\\begin{bmatrix} p_{ij}^{tL} & p_{ij}^{tR} & p_{ij}^{tU} \\end{bmatrix}^T\\Big) \\\\ \\sigma(v)_i = \\frac{e^{v_i}}{\\sum_{j=1}^Z e^{v_j}} \\text{ for } i \\in \\{1,...,Z\\}\\] """
Ancestors
- enum.Enum
Class variables
var random_3d_softmax_dot_product
-
The portion of light reflected in all three directions is given by the softmax function over product of the input vector x and the matrix of weights W_{ij}^t masked by the binary matrix holding relevant indices B_{ij}^t. RSD3d(x, W_{ij}^t, B_{ij}^t) = \sigma(x \cdot (W_{ij}^t * B_{ij}^t)) = \sigma\Big(\begin{bmatrix} p_{ij}^{tL} & p_{ij}^{tR} & p_{ij}^{tU} \end{bmatrix}^T\Big) \\ \sigma(v)_i = \frac{e^{v_i}}{\sum_{j=1}^Z e^{v_j}} \text{ for } i \in \{1,...,Z\}
class ReflectiveIndexCalculatorRandom (value, names=None, *, module=None, qualname=None, type=None, start=1)
-
ReflectiveIndexCalculatorRandom class includes all the available splitting criteria for 2-dimensional random Light Labyrinth models.
Splitting criterion in a LightLabyrinthRandom model is the function that for a given node W_{ij}, a subset of indices B_{ij} and an input vector x outputs the portion of light reflected p_{ij}^L and passed through p_{ij}^R. These two values always add up to 1.
Examples
>>> from light_labyrinth.hyperparams.activation import ReflectiveIndexCalculatorRandom >>> from light_labyrinth.dim2 import LightLabyrinthRandomRegressor >>> model = LightLabyrinthRandomRegressor(4, 3, features=0.6, ... activation=ReflectiveIndexCalculatorRandom.random_sigmoid_dot_product)
Expand source code
class ReflectiveIndexCalculatorRandom(Enum): """ ReflectiveIndexCalculatorRandom class includes all the available splitting criteria for 2-dimensional random Light Labyrinth models. Splitting criterion in a LightLabyrinthRandom model is the function that for a given node \\(W_{ij}\\), a subset of indices \\(B_{ij}\\) and an input vector \\(x\\) outputs the portion of light reflected \\(p_{ij}^L\\) and passed through \\(p_{ij}^R\\). These two values always add up to 1. Examples -------- >>> from light_labyrinth.hyperparams.activation import ReflectiveIndexCalculatorRandom >>> from light_labyrinth.dim2 import LightLabyrinthRandomRegressor >>> model = LightLabyrinthRandomRegressor(4, 3, features=0.6, ... activation=ReflectiveIndexCalculatorRandom.random_sigmoid_dot_product) """ random_sigmoid_dot_product = 1 """ The portion of light reflected is given by the logistic function over dot product of the input vector \\(x\\) and vector of weights \\(W_{ij}\\) masked by the binary vector holding relevant indices \\(B_{ij}\\). \\[RSD(x, W_{ij}, B_{ij}) = \\begin{bmatrix} f(x \cdot (W_{ij}*B_{ij})) \\\\ 1 - f(x \cdot (W_{ij}*B_{ij})) \\end{bmatrix} = \\begin{bmatrix} p_{ij}^L \\\\ p_{ij}^R \\end{bmatrix} \\\\ f(v) = \\frac{1}{1+e^{-v}}\\] """
Ancestors
- enum.Enum
Class variables
var random_sigmoid_dot_product
-
The portion of light reflected is given by the logistic function over dot product of the input vector x and vector of weights W_{ij} masked by the binary vector holding relevant indices B_{ij}. RSD(x, W_{ij}, B_{ij}) = \begin{bmatrix} f(x \cdot (W_{ij}*B_{ij})) \\ 1 - f(x \cdot (W_{ij}*B_{ij})) \end{bmatrix} = \begin{bmatrix} p_{ij}^L \\ p_{ij}^R \end{bmatrix} \\ f(v) = \frac{1}{1+e^{-v}}