5 ms·
>And this is what "big data" and NLP were like before computers :) aside, I recently interviewed a candidate for a "Big Data" position. He got quite chatty abo
by dxbydt 13y ago
>And this is what "big data" and NLP were like before computers :)
aside, I recently interviewed a candidate for a "Big Data" position. He got quite chatty about Kolmogorov & Measure Theory, so I quickly cooked up an interesting problem to relax his nerves. I opened the interview with "If the side of a cube comes from a uniform distribution between 1 and 5 inches, what's the expected volume of the cube ?"
I thought he'll give me the answer in 10 seconds & we'll move on but instead he was completely stumped & just stared blankly. I asked him to use the whiteboard but he simply drew a cube and wrote a^3, a~[1,5], and then went back to staring at it.
Finally after 10 minutes of pin-drop silence, my partner, a non-math guy, took over the interview & asked him some Hadoop related technology questions & he started speaking again.
- Chris2048 13y agoWhat's the answer?
- relaia 13y ago27?
- lsconjugate 13y ago39
- solve 13y agofrom random import random sum([(random()*4+1)**3 for x in xrange(1000000)])/1000000 => ~39 Weird.
- bluetech 13y agosum(random.uniform(1, 5)**3 for i in range(10000)) / 10000 Many people don't know that the random module allows to sample from many distributions directly without having to construct your own.
- hollerith 13y agoI like the first version better because everyone knows what infix * and + do.
- saucetenuto 13y agoI like the second version better because it taught me something I didn't know.
- zeckalpha 13y agoI'd say 45, assuming the side length is an integer.
- tzs 13y agoNope. To see where the subtlety lies in this problem, simplify it. Change it to a discrete problem: the side can be 1, 3, or 5, each with probability 1/3. The expected value of the side length is still 3. 1/3 of the cubes have volume 1, 1/3 have volume 27, and 1/3 have volume 125. The expected value of the volume is 51. Think about why it is 51, not 27, and you'll see why it is not 27 for the continuous case. In general, if you have a random variable X, and some function of that random variable, f(X), then it is NOT true that expected value of f(X) = f(expected value of X).
- dropdownmenu 13y ago27 would be correct if each side were independent random variables rather than the cube of a random variable. The way the problem is set up you are suppose to solve for E[a^3] (the third moment of the random variable) rather than (E[a])^3.
- deleted 13y ago[deleted]
- SatvikBeri 13y agoIf the side length isn't constrained to integers, the expected volume is 39 inches cubed. In a bit more detail: take the integral of x^3 (the volume function) from 1 to 5 and you get 5^4/4 - 1^4/4 = 624/4 = 156. Then we divide by the length of the line segment (4) to get 39. If the side lengths have to be integers, then it's just (1 + 8 + 27 + 64 + 125)/5 = 45 inches. Edit: corrected division mistake, thanks to dxbydt Edit 2: and corrected a second mistake thanks to tzs.
- dxbydt 13y agonot 59, 39.
- SatvikBeri 13y agoHeh, failed at the simplest step. Thanks for the correction.
- drdeca 13y ago156/4=39
- tzs 13y ago> Edit: corrected division mistake, thanks to dxbydt Well, one of the mistakes: > If the side lengths have to be integers, then it's just (1 + 8 + 27 + 125)/4 = 40.25 inches If I'm not mistaken, 4 is an integer, and so should not have cruelly snubbed when you sent out invitations to your summation of the cubes of the integers from 1 to 5. Sure, 4 is not a cool integer like the others in 1 to 5...he's got a reputation as a square, but that doesn't mean he doesn't have feelings.
- SatvikBeri 13y agoOy. Someone needs to revoke my math license. Thanks for the correction!
- dxbydt 13y agoMy, my, 2 mistakes on a silly uniform distribution! You must atone for this sin. Explain what the volume would be if the side came from a normal distribution over [1,5] (ie. mean 3, sigma 2/3) Otherwise I will personally call the MAA director on my speed dial & haul your ass back to stat101 :) But seriously, you write rather well on Quora & I'm sure the crowd would want to know what happens to the volume were you to choose a normal distribution instead of a uniform, so I hope you respond.
- vladimirralev 13y agoHe was staring at it because he was looking for a shortcut that must make the problem obvious enough to be done in 10 secs. If you don't provide context on such tasks, that's expected.
- pseut 13y agoThe shortcut's E h(X) = ∫ h(x) f(x) dx. So, math.
- vasilipupkin 13y agoIt's stories like this why I keep coming back to Hacker News