The Gaussian frequency was a cool idea, however.
Also, I would speculate that projected sales would likely be a continuous function in most cases, so I'm curious why they didn't try fitting a function based on initial results.
Ah, good point. To be honest, interpolation didn't even cross my mind.
The model output wasn't just one number, it was a messy JSON with a 12-week forecast. Trying to average two of those felt like a whole other task, and with the deadline, my brain was just stuck on how to pick the right numbers to cache.
But yeah, it's a really great idea. Will definitely keep it in mind for the next demo.
Also, fwiw, I really wouldn't expect clients slider clicks to follow a normal distribution. A normal distribution occurs when you have the sum of a large number of random variables with Finite (and bounded) expectation and variance; or alternatively, when you're modelling a process with known Expectation and Variance, but not any higher order moments. If anything, I'd expect human beings to play with the slider more around extremal points, like the start and end.
If I understand the setting, you are estimating the demand curve for a given price... And there are only 40 such curves to compute.
Surely each curve is fit with only a few parameters, probably fewer than five. (I think for small price ranges the demand curve is usually approximated as something trivial like y=mx+b or y=a/(x+b)+c)
Why does evaluating the model at a particular price need to take milliseconds, yet alone 15 seconds?
If I was a user, I might be confused why the increment is not consistent across the whole range.
Just increase the increment size, or if you really want 1c increments you could precompute every 5c or so and then just do linear interpolation between them.
Linear interpolation on small intervals is like, a model of a model. And that’s exactly what differentiable functions are, anyway. And if you want to be fancier then sample the model and fit some polynomials to interpolate between those samples.
If they were really time constrained they could precompute things sparsely first (for a demo the next day) and then progressively refine the values in between.
Why did this trend on HN?
Please don’t take this personal, but IMHO that’s not solving the problem. That’s coming up with a workaround.
>I remembered this from my engineering days at the College of Engineering, Trivandrum. It’s called the Normal Distribution, or Gaussian distribution. It’s based on the idea that data near the mean (the average) is more frequent than data far from the mean.
There are a lot of non-normal distributions where that's the case. The normal distribution is a specific thing that arises from summing together lots of small random variables.
It's not a good model of people moving sliders on a UI: a person's decision to set the value to e.g. 0.8 is really one discrete thing, not a sum of a bunch of independent micro-decisions. There's no physical/statistical law preventing someone from grabbing the slider and thrusting all the way to the left or the right, and in fact people do this all the time on UIs. The client can move the slider however he pleases ...
So I think you just got lucky that the client didn't do that. Don't rely on it not happening in the future!
(You could also imagine fitting a normal distribution to user behaviour, but it turns out the standard deviation is just really large. That would be technically defensible but also useless for your situation, since there would be substantial probability at the min/max values of the finite range. It would be close to uniform.)
(Also, who's to say the mean is in the middle of the slider range?)
Anyway I'm curious what the ML model was doing that took 15 seconds. Are you sure there's no way to speed it up?
alomaki•3d ago