# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: 'Python 3.8.3 64-bit (''3.8.3'': pyenv)'
#     name: python_defaultSpec_1595582370349
# ---

import numpy as np

fan = 0.0
rain = 1.0
people = 0.0


def activation_function(x):
    if x >= 0.5:
        return 1
    else:
        return 0


def predict(fan, rain, people):
    inputs = np.array([fan, rain, people])
    weights_input_to_hidden_1 = [0.25, 0.25, 0]
    weights_input_to_hidden_2 = [0.5, -0.4, 0.9]
    weights_input_to_hidden = np.array([weights_input_to_hidden_1, weights_input_to_hidden_2])

    weights_input_to_output = np.array([-1, 1])

    hidden_input = np.dot(weights_input_to_hidden, inputs)
    print("Hidden input: " + str(hidden_input))

    hidden_output = np.array([activation_function(x) for x in hidden_input])
    print("Hidden output: " + str(hidden_output))

    output = np.dot(weights_input_to_output, hidden_output)
    print("Output: " + str(output))

    return activation_function(output) == 1
    


# + tags=[]
print("Result: " + str(predict(fan, rain, people)))
# -

# [Resource](https://www.youtube.com/watch?v=AZG0j0pNY-4)

StarcoderdataJupyterScriptsDedupFiltered