News for hackers. Stuff that matters.
Re:Predicting Weight Loss with Machine Learning by arijo on Saturday October 19, 2024 @02:47PM (#41889735)
I think most of the classical statistical methods for curve fitting happen to be some kind of variant of using least squares on a manually chosen parameterizable function - you'll have to chose between a linear, polynomial, exponential or some other moire complex forms.

The nice things of using a simple feedforward DNN is that it will automatically infer both the nonlinear function structure and parameters and for simple basic use cases like this that don't require a lot of training it works well and you can even validate the fit visually by looking at the graph output.

Re:Predicting Weight Loss with Machine Learning by apwheele on Saturday October 19, 2024 @05:17PM (#41890844)
I'm sorry but this model is wild and highly misleading. Based on one variable and 7 observations, days since you have started, you have fit a model with `2 + 128 + 64^2` parameters. It happens that a straight line is fine for this data, so it does OK approximating the two observations that are in the test split.

I was curious to see what would happen out of sample, I figured it would just be a straight line (and it is, despite the parameters being quite complex, print out `model.weights` to check them out!)

    outS = [[365],[400],[450],[500],[2*365],[3*365],[4*365]]
    outY = model.predict(scaler_X.transform(outS))
    outY = scaler_y.inverse_transform(outY)
Negative if you keep at it long enough.
Re:Predicting Weight Loss with Machine Learning by arijo on Saturday October 19, 2024 @05:39PM (#41890972)
I don't intend to use the model to predict more than a couple of weeks - the fact that it has no data to predict more than that is not that a big deal for this use case.

Not very important, but the weight loss curve usually decelerates with time and this pattern is not captured by a straight line either - as i say not a big deal, it just happens that by using a simple DNN model for a simple curve I don't have to spend time choosing the type of function I want the data to fit.

Also the model will improve as the number of measurements that are available increases.

Your comment does make sense, I just think for this use case and short term prediction it's not a major problem.

I'd be happy to learn how you'd apply some renormalization techniques to reduce the number of parameters and prevent the overfitting - I'm just a noob very curious to learn as most as I can about practical deep learning techniques.

Re:Predicting Weight Loss with Machine Learning by kcplate on Saturday October 19, 2024 @11:37PM (#41892672)
> the weight loss curve usually decelerates with time and this pattern is not captured by a straight line either

I have done keto for weight loss across several stints, one lasting 4 years (I had a lot of weight to lose). I encountered plateaus at various points were despite pretty consistent caloric intake (at the time I religiously tracked everything), activity, and normal body eliminations, I would have periods of several weeks where my weight would not move at all, only to dramatically fall in a later week and continue the steady loss. I found it demotivating and had to adjust weigh ins from weekly to monthly to avoid the frustration.

I wonder what the model would say about those periods. I wish I would have kept the data from that time, it would have been interesting

Re:Predicting Weight Loss with Machine Learning by arijo on Sunday October 20, 2024 @01:26AM (#41893090)
Some ketogenic therapy experts theorize that a possible cause for those plateaus is due to the body reducing its metabolism due to what it thinks is an abnormal calorie deficit, entering survival mode - then after a period of adaptation it returns its metabolism to normal and the weight loss process continues.

I didn’t happen to find a plateau yet but surely will share the data if that happens.