Created
July 5, 2017 04:57
-
-
Save sbugrov/c21fde606dd2653ac90234213a05a1e0 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_d (const vector <float>& m1) { | |
/* Returns the value of the sigmoid function derivative f'(x) = f(x)(1 - f(x)), | |
where f(x) is sigmoid function. | |
Input: m1, a vector. | |
Output: x(1 - 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 ] = m1[ i ] * (1 - m1[ i ]); | |
} | |
return output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment