Live data from Hacker News

My Most Interesting Interview Problem

austinrochford.com

21–30 of 56 posts

Re: My Most Interesting Interview Problem

#22
post #21

What kind of job was this for? After stumbling through questions involving trees, arrays and other data structures, I have come to the conclusion that I'm a mathematician dressed up as a mediocre programmer.

This interview was for a data scientist position. I am also a mathematician masquerading as a programmer.

Re: My Most Interesting Interview Problem

#24
in clear probability related context, the guy uses "uniformly distributed" and "normally distributed" interchangeably. I usually fail interview with such guys.

The most recent spectacular failure happened when interviewer asked about sets, i described Java Set interface as an example (they are Java shop so i thought the choice was right), looking dissatisfied he asked to talk about "sets" in general, and got, lets say, really confused, when i tried to elicit whether he means naive set theory - seeing that i didn't hit what he wanted, i offered along the lines of Russel's theory of types, ... the guy got almost angry and said "just sets in general", and i kind of supposed that we settled on naive, though it sounded like he didn't like "naive"... he asked what we can do with a set, like for example iterate over its elements, i noted that that of course depends on the set's cardinality ... by look on his face at that moment it was really clear that the interview is finished.

Re: My Most Interesting Interview Problem

#25
post #2

For the interested, the easieat way of generating random points on a circle is drawing (x,y) component-wise from a normal distribution and then normalizing the vector. (And two independent Gaussian variables can be easily sampled using the Box-Muller transformation.)

[deleted]

Re: My Most Interesting Interview Problem

#26
post #2

For the interested, the easieat way of generating random points on a circle is drawing (x,y) component-wise from a normal distribution and then normalizing the vector. (And two independent Gaussian variables can be easily sampled using the Box-Muller transformation.)

Good point, but if you wanted to work with an arbitrary distribution in the plane as a generalisation of this I think you'd need to look for an equal-area map from R2 to S2? (eg http://en.m.wikipedia.org/wiki/Lambert_azimuthal_equal-area_...)

Edit: I mean R2 to S2 (although this is bijective)

Re: My Most Interesting Interview Problem

#28
post #3

Earlier quoted context omitted.

I'd rather take a random uniform distribution from 0 to pi and take it as the arc-length. Why is your construction 'uniform' on the circle?

> Why is your construction 'uniform' on the circle? That's a very good question, and the sort of thing that would need to be in a comment somewhere. The answer is that the bi-normal distribution is rotationally symmetrical, a fact that is not immediately obvious. > I'd rather take a random uniform distribution > from 0 to pi and take it as the arc-length. That's a good solution for the simple one-dimensional circle i…

Use a space-filling curve?

Re: My Most Interesting Interview Problem

#29
post #20
post #14

Earlier quoted context omitted.

No, because the two angles can't easily be combined to make the resulting point uniform on the sphere. For instance, if you call one of the angles "latitude", and one "longitude", then you will get too many samples near the poles -- think about how the lines of constant longitude start out widely spaced on the equator, but then converge at the poles. This would cause points to pile up at the poles. Your proposal hits…

Ah, of course, thanks.

you can use longitude and z (height "up the axis") (it's uniform because a ring of thickness dz at height z is of area 2pi * z * cos(lat) * dz/cos(lat) (so the latitude cancels nicely - it's a trick used for equal area map projections).

Re: My Most Interesting Interview Problem

#30

What are the practical applications to something like this?

Random search. You evaluate a function (say, a loss function for a statistical model given certain parameters) at a random point, and then randomly displace it by a constant amount in a random direction.

Random search is quite useful for hyperparameter optimization, and it can be a useful building block for something like simulated annealing or parallel tempering.

Post reply on HN