Last active
July 28, 2016 16:20
-
-
Save MarHoff/169d4642fc4cdbe5874c4b8188fdc4db to your computer and use it in GitHub Desktop.
A basic SQL function to return a score between 0 and 1 based on 2 parameters
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
CREATE OR REPLACE FUNCTION ia_sigmoid( | |
v_value numeric, | |
v_turn numeric, | |
v_slope numeric) | |
RETURNS numeric AS | |
'SELECT 1./(1.+ exp(((-v_slope*v_value)+v_slope*v_turn))); ' | |
LANGUAGE sql ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Parameters:
Graphical example (where a= v_turn and b=v_slope ):
https://www.desmos.com/calculator/rna4aqta0c