Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cap rates to a minimum of 0.1 #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

rohieb
Copy link
Contributor

@rohieb rohieb commented Aug 14, 2021

With lower rates than 0.1, the algorithm to calculate the allowed kcal values can takes a very long time to run, and the plot also explodes in the y axis. Print a warning in that case, and cap the value to a minimum of 0.1.

With lower rates than 0.1, the algorithm to calculate the allowed kcal
values can takes a very long time to run, and the plot also explodes in
the y axis. Print a warning in that case, and cap the value to a
minimum of 0.1.
@blinry
Copy link
Owner

blinry commented Aug 17, 2021

As we discussed in-person, this feels like the wrong solution to me. Rates of 0 (and especially, negative rates, for people who want to gain weight) should be supported by the tool, and it should adapt the part which makes future predictions in that case.

What would be a better approach? Capping all future calculations to at most 3 years or something?

@rohieb rohieb force-pushed the for-master branch 2 times, most recently from 1220d84 to 04a3dd4 Compare November 14, 2021 11:48
@rixx
Copy link
Contributor

rixx commented Oct 20, 2022

Is there a reason for the "allowed kcal" algorithm to explode with low rates? Apart from special-casing 0, it feels like the rate shouldn't influence the bare calculation for kalories, and only the prognosis part would take long?

Adding to the discussed options: Another (or maybe an additional?) version could be to disable future calculation ("you'll hit weight x in y time") with a flag, both for terminal and SVG display. I, for one, tend to ignore the future calculation (because it's unrealistic anyways, and I don't want to see an unrealistic prognosis), and I particularly dislike it in the SVG plot, where I usually just hide the prognosis dots.

Alternatively, you could do basically what this PR does, but add a special case for 0, and also allow negative values, so that 0 < x < 0.1 gets rounded up and -0.1 < x < 0 gets rounded down.

@rohieb
Copy link
Contributor Author

rohieb commented Oct 20, 2022

Yes, I think I talked with @blinry about such a flag already (but sadly I don't remember the outcome of that discussion…)

@blinry
Copy link
Owner

blinry commented Oct 21, 2022

I think what takes long for rates close to zero is the "prediction" part, which inserts prediction weights for each day until the target weight is reached. This both has an effect for doing the plot, as well as for printing the "you'll reach your goal in xx months".

My favorite solution would be to cap how far into the future the predictions are calculated - maybe not longer than two years or so? And in this case, we could just drop displaying the "you'll reach your goal in xx months" message.

I'd also welcome a flag to hide the future! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants