LogSoftminActivation<T>

Models & Types · AiDotNet.ActivationFunctions

Implements the LogSoftmin activation function for neural networks.

Inheritance: ActivationFunctionBase<T> → LogSoftminActivation<T>

For Beginners

The LogSoftmin function is similar to LogSoftmax, but focuses on the smallest values instead of the largest values in a vector.

It works in two steps:

  1. First, it applies the “softmin” function, which gives more weight to smaller numbers in the input

(the opposite of softmax, which emphasizes larger numbers).

  1. Then, it takes the natural logarithm of these values.

While LogSoftmax is used to highlight the largest values (useful for finding the most likely class in classification), LogSoftmin can be useful when you want to focus on the smallest values in your data.

Like LogSoftmax, this function operates on vectors (collections of numbers) rather than individual values, because it needs to consider all values together to determine their relative importance.

Example

using AiDotNet.ActivationFunctions;

var activation = new LogSoftminActivation<double>();
double y = activation.Activate(0.5);
Console.WriteLine($"LogSoftminActivation: f(0.5) = {y:F4}");

Constructors

Constructor Summary
LogSoftminActivation()

Methods

Method Summary
Matrix<T> Derivative(Vector<T> input) Calculates the derivative (Jacobian matrix) of the LogSoftmin function for a vector input.
Tensor<T> Activate(Tensor<T> input) Applies LogSoftmin to a tensor via engine primitives so the gradient tape records every step.
Vector<T> Activate(Vector<T> input) Applies LogSoftmin to a tensor via engine primitives so the gradient tape records every step.