+ 1

Sigmoid function

If there is 2nd test case which is 0 1 2 1 -2, for example, why my code does not work for it? w1,w2,b,x1,x2 = list(map(int, input().split())) import math output = w1*x1 + w2*x2 + b output = 1/(1 + math.exp(output*-1)) print(f"{output:.3f}")

23rd Dec 2020, 5:55 AM
Zhenis Otarbay
Zhenis Otarbay - avatar
11 odpowiedzi
+ 3
Zhenis Otarbay , why do you change the first line for the coefficients w1, w2, b, x1, x2 - it is given in the solution for a reason. Second thing is it is mentioned you should round the result to 4 decimal digits, not to format it. Look at your code corrected. https://code.sololearn.com/cl8sjJcwc7IZ/?ref=app
23rd Dec 2020, 7:31 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 4
import math w1, w2, b, x1, x2 = [float(x) for x in input().split()] activation_function = -1*((w1*x1)+(w2*x2)+b) y = 1 / (1 + math.e ** activation_function) print(round(y,4))
13th May 2021, 7:18 PM
Reza Asgary
Reza Asgary - avatar
+ 3
Thomas Monette why so many
22nd Mar 2021, 7:09 AM
::sк::
::sк:: - avatar
+ 2
Zhenis Otarbay , I have already answered it.
23rd Dec 2020, 9:35 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 2
w1, w2, b, x1, x2 = [float(x) for x in input().split()] from math import* print(round(1/(1+exp(-(w1*x1+w2*x2+b))), 4))
13th Mar 2022, 7:13 AM
Alcino Castelo
+ 1
TheWh¡teCat 🇧🇬 could you tell what is the problem with this brother's code? https://www.sololearn.com/Discuss/2329570/?ref=app
23rd Dec 2020, 8:27 AM
Zhenis Otarbay
Zhenis Otarbay - avatar
+ 1
TheWh¡teCat 🇧🇬 thanks bro, now I think, understand it, the last thing I am stack is the forest of trees, could you approach it?
23rd Dec 2020, 9:43 AM
Zhenis Otarbay
Zhenis Otarbay - avatar
+ 1
Zhenis Otarbay, I can, but that's not the purpose. You should try it by yourself. If you have problem, then you can share your code in separate question, not here to mix many questions in one topic. There are many people here who can help you.
23rd Dec 2020, 10:38 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
w1, w2, b, x1, x2 = [float(x) for x in input().split()] import math y=(w1*x1)+(w2*x2)+b z = math.exp(-y) sig = 1 / (1 + z) sig = round(sig,4) print(sig)
21st Oct 2021, 2:32 PM
arian shahbaziyan
arian shahbaziyan - avatar
+ 1
really simple: import math w1, w2, b, x1, x2 = [float(x) for x in input().split()] x = (w1 * x1) + (w2*x2) + b y = 1 / (1 + (math.exp(-x))) print(round(y,4)) math.exp does ∑ function
2nd Mar 2022, 4:18 PM
Ilya Selivanov
Ilya Selivanov - avatar
+ 1
w1, w2, b, x1, x2 = [float(x) for x in input().split()] from math import* y = 1/(1+exp(-(w1*x1+w2*x2+b))) print(round(y, 4))
13th Mar 2022, 7:11 AM
Alcino Castelo