-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fix files format #2
Conversation
Welcome to Codecov 🎉Once merged to your default branch, Codecov will compare your coverage reports and display the results in this comment. Thanks for integrating Codecov - We've got you covered ☂️ |
@abelsiqueira would you mind double-checking that all is in place for this package? I think after fixing the formats, the basic set up is there, but just to double-check. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks right to me. I made a small comment on the equation, but that is a separate issue.
@NLobjective( | ||
model, | ||
Min, | ||
(sum((profile_values[i])^x for i = 1:total_hours) - target_mean * total_hours)^2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be useful to write the math for this in the docs. Something like
It would also make it easier to read with less parenthesis, that's why I moved things around.
I had the impression the problem was
i.e., you want each p_i^x
to be close to \mu
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind my comment, I read that you are just worried about the mean of the new p_i^x
, not the individual p_i^x
value, so the first definition is correct. I would maybe write as
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized something about the problem. You are doing nonlinear least squares of a single variable with a single equation. So it makes sense to ask whether the equation already has a solution. Under conditions on the profile values and the target_mean, it has, and in that case it would be simpler to use a root-finding algorithm.
For instance:
using Roots
profile_values = [0.2, 0.5, 0.9, 1.0, 0.4, 0.1, 0.0]
target_mean = 0.5
find_zero(
x -> sum(profile_values .^ x .- target_mean),
[1e-2, 1.0],
)
Depending on what you want, and the assumptions that you can make, this can be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abelsiqueira Thanks for the proposal. German and I have reviewed it and we think it makes sense to have the solution from the find_zero function. We believe that in most cases, there will be a solution to the equation. However, in the unlikely event that there is no solution, we want to at least have the coefficient that minimizes the error. Therefore, we want to modify the function to start with the "find_zero" function and if it cannot find a solution, then go for the optimization. What do you think? In any case, I will create an issue for it. 😄
Pull request details
Describe the changes made in this pull request
Fixing files format according to the pre-commit hooks
List of related issues or pull requests
Closes #1
Collaboration confirmation
As a contributor I confirm