Skip to content

Instantly share code, notes, and snippets.

@mikhailklassen
Created August 25, 2019 21:37
Show Gist options
  • Save mikhailklassen/de9147d2756cc1897bbf400eb54b7d6f to your computer and use it in GitHub Desktop.
Save mikhailklassen/de9147d2756cc1897bbf400eb54b7d6f to your computer and use it in GitHub Desktop.
import math
# Better activation function
def take_umbrella(input_1, input_2, w_1=1.0, w_2=1.0):
'''Let input_1 be a probability between 0.0 and 1.0
with 0.0 meaning no chance of rain and 1.0 meaning 100%
chance of rain.
Let input_2 be a time duration describing minutes spent
outdoors.'''
input_2 = input_2/1440
activation = (w_1*input_1 + w_2*input_2) / (w_1 + w_2)
activation = math.tanh(activation)
return activation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment