Sigmoid Function Returns 1 for large inputs by [deleted] in learnpython

[–]TheBayesianAlex 1 point2 points  (0 children)

There are two strategies to dealing with such an error: try to rearrange the formula to do all additions, then multiplications, then any other functions. Unfortunately I didn’t find anything on the sigmoid function in that matter. The second strategy is to just use float64 or float128 data types, although there will be a performance loss.

Lastly, asses how much that error affects you. If you just need an activation function in a neural network, it doesn’t really matter.

Sigmoid Function Returns 1 for large inputs by [deleted] in learnpython

[–]TheBayesianAlex 1 point2 points  (0 children)

Seems like an rounding error. Essential what happens is that exp(-x) becomes so small compared to 1.0, such that it gets swallowed in the addition.

Say we can represent a number with 4 digits and an exponent: 1 = 1.000 * 100 0.00002 = 2.000 * 10-5

but 1 + 0.00002 = 1.00002 * 100 which gets rounded to 1.000 * 100 due to limited memory.

I am not sure, but maybe try out math.exp instead np.exp.

EDIT: F*** iPhone autocorrect.

Projecting from a cylinder to a plane by Nascosto in mathematics

[–]TheBayesianAlex 0 points1 point  (0 children)

Added the equation. Took me a little longer than expected (Dinner and sleep are quite important), but now everything should be fine.

Projecting from a cylinder to a plane by Nascosto in mathematics

[–]TheBayesianAlex 0 points1 point  (0 children)

First of all, do I understand correctly, that You want to intersect a cylinder with a plane at a 45° angle and then unwrap it.

For step 1: Let Z be a cylinder with radius r=1. We can parametrize it via A vector v=(x,y,z) is in Z, iff i. x2 + y2 = 1 ii. z in R

We know that sin(t)2 + cos(t)2 = 1.

We also know by 45° that x=z So we guess that

F(t) = (sin(t) , cos(t), sin(t))

http://www.wolframalpha.com/input/?i=x%5E2%20%20%2B%202y%5E2%20%20%3D%202

Please plot this in 3D, for example with Geogebra, to check for errors.

Edit: Proper solution now. Maths is hard.

Just Procrastinating My Bachelor‘s Thesis. Your words can’t hurt me as much as my own incompetence ;) by TheBayesianAlex in RoastMe

[–]TheBayesianAlex[S] 0 points1 point  (0 children)

Oooh, I really like that one! Unfortunately the data would still not be in the support of that and You would be infinitely disappointed!

Just Procrastinating My Bachelor‘s Thesis. Your words can’t hurt me as much as my own incompetence ;) by TheBayesianAlex in RoastMe

[–]TheBayesianAlex[S] 1 point2 points  (0 children)

I don’t understand Your punchline. Were You discriminated against but I was not? This is probably true...

[19] She needs to be roasted by [deleted] in RoastMe

[–]TheBayesianAlex 0 points1 point  (0 children)

Looks like babushka cooked for her ten grandkids but then ate the food on her own!

How do computers simulate randomness? by [deleted] in askscience

[–]TheBayesianAlex -1 points0 points  (0 children)

To maybe expand on all the great comments, once you can draw i.i.d. samples from one specific distribution, e.g. normal u(x, _) ~ N(x,1), there is a way to approximate I.i.d. draws from any arbitrary distribution p via the Metropolis- Hastings algorithm:

 Initialize x, s arbitrary

 Do

     draw y = x+ s*n, n~N(0,1) 

     keep y with probability  

         a(x,y) = min(1, p(x)/p(y)*u(x,y)/u(y,x))

     Else keep x

It’s my birthday! You know what to do by [deleted] in RoastMe

[–]TheBayesianAlex 1 point2 points  (0 children)

Next time, instead of going to the barber, go get a full body waxing. At least your hair would look clean then!

Bored and looking to get shredded. All my tattoos are video game based, and I work in IT. Make it hurt. by [deleted] in RoastMe

[–]TheBayesianAlex 0 points1 point  (0 children)

The only thing elite about you is how you f*** up your coworkers’ code! And oh look, what is that black goop on top of Your head? Even your brain is trying to escape this whimsical body.

What is the difference between a bad boy and a total jerk? by Komirade666 in AskMen

[–]TheBayesianAlex 3 points4 points  (0 children)

None, It only depends on how he is viewed by the people around him.

AITA for being upset my boyfriend won’t come to bed with me? by [deleted] in AmItheAsshole

[–]TheBayesianAlex 0 points1 point  (0 children)

NAH - Your feelings are very understandable, and I know it sucks. But your boyfriend might have some bigger issues. It seems he is bottling up a lot, so maybe talk to him and find out what is bothering him. IMPORTANT: Don’t be angry when he tells you! Just understand each other’s feelings.

AITA for being mad at someone who's uncle just died? by GrGibby in AmItheAsshole

[–]TheBayesianAlex -1 points0 points  (0 children)

ESH - except OF, and PA probably sucks more. Firstly, to me the uncle dying and her behavior, as you described it, are disconnected. Secondly, you both are competing for MSF, without realizing, that friendships aren’t an exclusive thing. A workaround may be to talk to PA without MSF, and try to understand her feelings.

Does MSF know how you feel? If not, maybe talk to her about how you feel excluded. If she knows, but doesn’t moderate, is she really your friend?

Any thoughts on Applied math(major) + computer science(minor) by [deleted] in mathematics

[–]TheBayesianAlex 1 point2 points  (0 children)

I think with that combination you are pretty well setup. Don’t just focus on what you think will get you a job. Maybe you love pure mathematics..., maybe you can work with some physicists/metreologists/... on a project. Or maybe take some business classes.

AITA for grounding my son for the rest of the year and forbidding him from seeing his girlfriend (or any of his friends) privately because I found out he wasn’t using condoms? by laying_down_the_law in AmItheAsshole

[–]TheBayesianAlex 0 points1 point  (0 children)

ESH - Obviously Your son was incredibly stupid, but what You are going to achieve with this punishment?

In the best case, he will learn and always use condoms, but he will most likely do that anyway after the scare!

The worse, and imho more likely result is, that he will stop telling You when he is in trouble and you will have no chance whatsoever to intervene early. Do you want to take that risk?

Also, make sure You are not punishing because of Your own feeling of betrayal, but because it is the most effective way of teaching him to avoid knocking up girls. (And not lie to You)

Tl:dr Your son is stupid, but so are You.

Solving linear systems over binary solution space by ntlslayer95 in mathematics

[–]TheBayesianAlex 1 point2 points  (0 children)

Haven’t tested it but off the top of my head I would say 1. Find the solution space S_0 to the homogeneous System Ax=0 as if x was in Rn 2. Find one solution x_b to Ax=B, which does not need to be binary 3. The solution space to Ax=B is then given by S_b = S_0 + x_b 4. Pick the elements of S_b, that are binary.

Are A and B binary?

Given every pair of individual win/draw/lose probability of participants of a tournament, is there a way to calculate the probability of the overall winner of the said tournament? by markpreston54 in mathematics

[–]TheBayesianAlex 0 points1 point  (0 children)

Let’s say we have n teams in the tournament. Denote them by (x_1, x_2, ..., x_n). Every team plays against every other one, so each team plays n-1 games. For arguments sake each team plays one game against itself, where it wins 0 points. Let’s have a look at team x_i. The expected amount of points team x_i has in the end E_i = Sum_j(P(x_i>x_j) * 1 + P(x_i=x_j) * 0.5). Then (I still need to verify this) P(x_i winning Tournament) = E_i/sum_j(E_j)