nerva_numpy.softmax_functions
Softmax and log-softmax functions together with stable variants.
This module provides both function-only forms and simple callable classes.
Functions
|
Row-wise log-softmax (numerically unsafe version). |
Jacobian matrix of log_softmax for a single row vector. |
|
|
Row-wise softmax with explicit normalization (numerically unsafe). |
Jacobian matrix of softmax for a single row vector. |
|
Row-wise log-softmax with max-subtraction for stability. |
|
Jacobian matrix of stable log_softmax (same as log_softmax). |
|
Row-wise softmax using max-subtraction for numerical stability. |
|
Jacobian matrix of stable softmax for a single row vector. |
Classes
Callable implementing row-wise log-softmax and its Jacobian. |
|
Callable implementing row-wise softmax and its Jacobian. |
|
Callable implementing numerically stable row-wise log-softmax and its Jacobian. |
|
Callable implementing numerically stable row-wise softmax and its Jacobian. |
- nerva_numpy.softmax_functions.softmax(X: numpy.ndarray) numpy.ndarray [source]
Row-wise softmax with explicit normalization (numerically unsafe).
- nerva_numpy.softmax_functions.softmax_jacobian(x: numpy.ndarray) numpy.ndarray [source]
Jacobian matrix of softmax for a single row vector.
- nerva_numpy.softmax_functions.stable_softmax(X: numpy.ndarray) numpy.ndarray [source]
Row-wise softmax using max-subtraction for numerical stability.
- nerva_numpy.softmax_functions.stable_softmax_jacobian(x: numpy.ndarray) numpy.ndarray [source]
Jacobian matrix of stable softmax for a single row vector.
- nerva_numpy.softmax_functions.log_softmax(X: numpy.ndarray) numpy.ndarray [source]
Row-wise log-softmax (numerically unsafe version).
- nerva_numpy.softmax_functions.log_softmax_jacobian(x: numpy.ndarray) numpy.ndarray [source]
Jacobian matrix of log_softmax for a single row vector.
- nerva_numpy.softmax_functions.stable_log_softmax(X: numpy.ndarray) numpy.ndarray [source]
Row-wise log-softmax with max-subtraction for stability.
- nerva_numpy.softmax_functions.stable_log_softmax_jacobian(x: numpy.ndarray) numpy.ndarray [source]
Jacobian matrix of stable log_softmax (same as log_softmax).
- class nerva_numpy.softmax_functions.SoftmaxFunction[source]
Bases:
object
Callable implementing row-wise softmax and its Jacobian.
- class nerva_numpy.softmax_functions.StableSoftmaxFunction[source]
Bases:
object
Callable implementing numerically stable row-wise softmax and its Jacobian.