Search code examples
artificial-intelligence

Discrete vs Continuous Predictions


The sigmoid function is defined as sigmoid(x) = 1/(1+e-x). If the score is defined by 4x1 + 5x2 - 9 = score, then which of the following points has exactly a 50% probability of being blue or red? (Choose all that are correct.)

answers: (1,1) - (2,4) - (5,-5), (-4,5)

can someone explains how to solve this question?


Solution

  • Im taking the same udacity course. You asked the wrong question, got the wrong answer. its 1/1(1+e^-x)

    the correct code is

    from math import e,pow
    #Equation: 4x1+5x2-9=score
    #weights are 4,5 and bias is -9, find the sigmoid(x) = 1/(1+e-x).
    
    features=[(1,1),(2,4),(5,-5),(-4,5)]
    def linear_func(features):
        for x in features:
            score= 4*x[0]+ 5*x[1]-9
            y = 1 / (1 + pow(e,- score))
            print("X",x,score,y)
     #call the function
    linear_func(features)
    

    answer is 1,1 and -4,5

    answer on udacity: That's correct. Intuitively, if you look at the plot for a sigmoid function, the probability would always be 50% if the score evaluates to zero.