Created
July 4, 2017 00:08
-
-
Save sbugrov/bfac5e49c21e20109b2c090b677b8f71 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vector <float> sigmoid (const vector <float>& m1) { | |
/* Returns the value of the sigmoid function f(x) = 1/(1 + e^-x). | |
Input: m1, a vector. | |
Output: 1/(1 + e^-x) for every element of the input matrix m1. | |
*/ | |
const unsigned long VECTOR_SIZE = m1.size(); | |
vector <float> output (VECTOR_SIZE); | |
for( unsigned i = 0; i != VECTOR_SIZE; ++i ) { | |
output[ i ] = 1 / (1 + exp(-m1[ i ])); | |
} | |
return output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment