Live data from Hacker News

Fizz Buzz in Tensorflow

joelgrus.com

31–40 of 85 posts

Re: Fizz Buzz in Tensorflow

#31
post #29
post #24

Earlier quoted context omitted.

> Shouldn't a junior programmer be able to solve fizz buzz? Yes, which is why when I would ask it of a someone who calls themselves a senior programmer I was dumbfounded at how many could not answer the question.

FWIW, please be mindful of your biases. I recently had an interviewer with a major bank conglomerate who had some silly puzzle. I outlined a system for solving it in algorithmic notation, and the interviewer had no idea that such a response was appropriate and said sorry, that they were looking for someone with programming experience, not specific, just "many languages" ... Not saying you do this, but what if someone…

If someone answered FizzBuzz in Coq, I'd question their judgement. On the other hand, usually in situations like that I'd ask the interviewee to explain their solution. If they can explain it well, that's fine.

Re: Fizz Buzz in Tensorflow

#32
post #7
post #5

This whole thing is making fun of asking fizz-buzz to a senior programmer, but yet I've found it to be one of the best phone screen questions possible. For someone who is truly a senior programmer, they knock it out in about 30 seconds and we move on. For the ones who pretend to be senior programmers on their resume, it trips them up and I know right away that their resume is either a pack of lies or their previous c…

It's just a jape, not to be taken seriously, made in the great comic tradition of FizzBuzz Enterprise Edition: https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris...

Joking aside, this example does a great job to show one of my complaints with common (edit: enterprise) Java practices - Where is the logic?

Re: Fizz Buzz in Tensorflow

#33
post #7

Earlier quoted context omitted.

It's just a jape, not to be taken seriously, made in the great comic tradition of FizzBuzz Enterprise Edition: https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris...

Joking aside, this example does a great job to show one of my complaints with common (edit: enterprise) Java practices - Where is the logic?

Common enterprise OO problems. It is neither confined to Java nor representative of Java as used outside enterprise development.

Re: Fizz Buzz in Tensorflow

#34
post #5

This whole thing is making fun of asking fizz-buzz to a senior programmer, but yet I've found it to be one of the best phone screen questions possible. For someone who is truly a senior programmer, they knock it out in about 30 seconds and we move on. For the ones who pretend to be senior programmers on their resume, it trips them up and I know right away that their resume is either a pack of lies or their previous c…

I do warm-up problems like this even when starting hour long code interviews. I don't like FizzBuzz though, I like to use same difficulty questions that can be expanded onto other tasks, a point-in-rect sample question can turn into a real bounding box question.

Re: Fizz Buzz in Tensorflow

#35
post #12
post #9

Earlier quoted context omitted.

Yeah, secretly I was surprised that it worked as well as it did!

What architecture do you need to get 100% accuracy? Don't forget to use a validation set for the model and hyperparameter selection though!

You could encode the input with one-hot decimal digits. Then checking divisibility by 5 is just seeing whether input 0 or 5 of the least significant digit is high. Divisibility by 3 requires checking whether the digit sum is divisible by 3 which you could easily do by connecting a neuron to all inputs, weighing the inputs proportional to the digit they represent and activate if the sum is divisible by 3. For the three digit numbers from 0 to 999 this would require 30 inputs, one neuron to check divisibility by 5, twenty neurons to check divisibility by 3 and four neurons in the output layer to create the desired outputs. You could reduce the number of neurons a bit if you added another layer and did the divisibility by 3 in one additional step, I think twelve would do if you subtracted 10 or 20 with four neurons and just checked for 0, 3, 6 and 9 with eight neurons. You could also choose the input encoding to be one-hot base 15 digits which would make the net trivial and offload the hard part into the input encoding. Whether you could easily arrive at that design by training is of course a whole different question.

Re: Fizz Buzz in Tensorflow

#36
post #26

Earlier quoted context omitted.

I suspect that there is no way to predict in advance the smallest model which can represent any given function. However, we should be able to at least develop an intuition for depth and breadth that is sufficient on any given problem. Classically, division circuits are large and complex, so I naively expect a NN built out of add, mul, and Heaviside(x)*x to also be large and complex. As with many models, I suspect tha…

Pretty sure it's been proven that sufficiently large 3-layer networks can learn any function.

It's called the Universal Approximation Theorem [1].

[1] https://en.wikipedia.org/wiki/Universal_approximation_theore...

Re: Fizz Buzz in Tensorflow

#37
post #29
post #24

Earlier quoted context omitted.

> Shouldn't a junior programmer be able to solve fizz buzz? Yes, which is why when I would ask it of a someone who calls themselves a senior programmer I was dumbfounded at how many could not answer the question.

FWIW, please be mindful of your biases. I recently had an interviewer with a major bank conglomerate who had some silly puzzle. I outlined a system for solving it in algorithmic notation, and the interviewer had no idea that such a response was appropriate and said sorry, that they were looking for someone with programming experience, not specific, just "many languages" ... Not saying you do this, but what if someone…

> what if someone provided Fizz Buzz in COQ or Elixir

Wie waere es fuer dich, wenn ich in einer Sprache antworte, die du wahrscheinlich nicht verstehst?

Re: Fizz Buzz in Tensorflow

#38
post #29
post #24

Earlier quoted context omitted.

> Shouldn't a junior programmer be able to solve fizz buzz? Yes, which is why when I would ask it of a someone who calls themselves a senior programmer I was dumbfounded at how many could not answer the question.

FWIW, please be mindful of your biases. I recently had an interviewer with a major bank conglomerate who had some silly puzzle. I outlined a system for solving it in algorithmic notation, and the interviewer had no idea that such a response was appropriate and said sorry, that they were looking for someone with programming experience, not specific, just "many languages" ... Not saying you do this, but what if someone…

I hate puzzles too, especially the gotcha ones with esoteric knowledge required.

But for FizzBuzz I explain the problem, explain that there is no trick and the simplest answer that produces the correct output will be fine. To solve it you need to know about building a loop, what the mod operator does, and maybe keeping state depending on how you build it. I tell them to write it in the language they know best. None of those things should be "gotchas" in your favorite language.

Re: Fizz Buzz in Tensorflow

#39

Earlier quoted context omitted.

I would have given him the job

If that were a real situation, I wouldn't have, he over-engineered the shit out of it and while cool, I prefer devs who can solve simple problems simply; they get more work done for the price.

I prefer employers that don't treat me like a baby, so to each their own ;)

Re: Fizz Buzz in Tensorflow

#40
post #38
post #29

Earlier quoted context omitted.

FWIW, please be mindful of your biases. I recently had an interviewer with a major bank conglomerate who had some silly puzzle. I outlined a system for solving it in algorithmic notation, and the interviewer had no idea that such a response was appropriate and said sorry, that they were looking for someone with programming experience, not specific, just "many languages" ... Not saying you do this, but what if someone…

I hate puzzles too, especially the gotcha ones with esoteric knowledge required. But for FizzBuzz I explain the problem, explain that there is no trick and the simplest answer that produces the correct output will be fine. To solve it you need to know about building a loop, what the mod operator does, and maybe keeping state depending on how you build it. I tell them to write it in the language they know best. None o…

You don't need mod, loops or recursion to solve it. For instance:

    local remove = table.remove
    local insert = table.insert
    local print  = print
    
    local sequence = { 
        false  , false  , 'Fizz' , false  , 'Buzz',
        'Fizz' , false  , false  , 'Fizz' , 'Buzz' ,
        false  , 'Fizz' , false  , false  , 'FizzBuzz'
    }
    
    local function o(v)
      local name = remove(sequence,1)
      insert(sequence,name)
      print(name or v)
      return v + 1
    end
    
    local function t(v)
      return o(o(o(o(o(o(o(o(o(o(v))))))))))
    end
    
    local function h(v)
      t(t(t(t(t(t(t(t(t(t(v))))))))))
    end
    
    h(1)
It does rely upon state (the sequence table) but even that could probably be worked around if Lua had a slice syntax.
Post reply on HN