TheAlgorithms / C-Sharp

All algorithms implemented in C#.
GNU General Public License v3.0
7.17k stars 1.53k forks source link

Adding the SoftMax Function #469

Closed RicardoRibeiroRodrigues closed 3 months ago

RicardoRibeiroRodrigues commented 3 months ago

Summary of change

This pull request introduces an implementation of the SoftMax algorithm. The SoftMax function is often used as the last activation function of a neural network to normalize the output of a network to a probability distribution over predicted output classes.

Definition

The SoftMax function takes as input a vector z of K real numbers, and normalizes it into a probability distribution consisting of K probabilities proportional to the exponentials of the input numbers.

Motivation

The SoftMax function is a critical component in many machine learning models, particularly in classification tasks within neural networks.

Time Complexity

The time complexity for the SoftMax algorithm is O(n), where n is the number of elements in the input array.

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 94.99%. Comparing base (cb45f4a) to head (62ac483). Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #469 +/- ## ========================================== - Coverage 95.00% 94.99% -0.02% ========================================== Files 238 239 +1 Lines 10091 10108 +17 Branches 1429 1432 +3 ========================================== + Hits 9587 9602 +15 Misses 389 389 - Partials 115 117 +2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.