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

add threshold_lo_ & threshold_hi_ #816

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

Conversation

Youhaojen
Copy link

fix the issue "If the system has exploded, unphysical structures may be saved since no upper bound is set on the uncertainty threshold."

Summary
The active learning workflow can be used with active <interval> <has_velocity> <has_force> <threshold_lo> <threshold_hi>

Modification
Rename threshold_ to threshold_lo_, and add threshold_hi

Others

fix the issue "If the system has exploded, unphysical structures may be saved since no upper bound is set on the uncertainty 
threshold."
@brucefan1983
Copy link
Owner

Thanks for the contribution. It seems you separated changes into two pull requests? Could you complete one and delete the other?

@Youhaojen
Copy link
Author

Dear Prof. Fan,

Thanks for your reply. One is for modifying active.cu another one is for modifying activate.cuh. I’m not sure how to delete another pull request. Could you merge the two in one pull request?

Thanks

Hao-Jen You

@brucefan1983
Copy link
Owner

OK, I will take care of it. I need to study the code more carefully when I have enough time. I will contact you if I have more questions.

@@ -238,7 +241,7 @@ void Active::process(
}
}
write_uncertainty(step, global_time, uncertainty);
if (uncertainty > threshold_) {
if (threshold_hi_ > uncertainty && uncertainty > threshold_lo_) {
Copy link
Owner

@brucefan1983 brucefan1983 Dec 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, it is correct. read it wrongly.

@brucefan1983
Copy link
Owner

@elindgren Do you think it is necessary to have an upper limit?

Copy link
Collaborator

@elindgren elindgren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Youhaojen I think it makes sense to have an upper cutoff for the use case that you describe. The high cutoff could potentially be an internal value, but it would probably be difficult to know what an appropriate value would be in general.

For readability, I would suggest renaming threshold_lo_ to threshold_high_ and threshold_hi_ to threshold_high_, respectively.

Also, modify the documentation for the active keyword to reflect the new usage, including the examples. The relevant file can be found here: https://github.com/brucefan1983/GPUMD/blob/master/doc/gpumd/input_parameters/active.rst

Comment on lines +152 to +153
" will check if uncertainties exceed %f and %f every %d iterations.\n",
threshold_lo_, threshold_hi_,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
" will check if uncertainties exceed %f and %f every %d iterations.\n",
threshold_lo_, threshold_hi_,
" will check if uncertainties exceed %f and are below %f every %d iterations.\n",
threshold_lo_, threshold_hi_,

Comment on lines +144 to +147
if (!is_valid_real(param[4], &threshold_lo_)) {
PRINT_INPUT_ERROR("threshold should be a real number.\n");
}
if (!is_valid_real(param[5], &threshold_hi_)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!is_valid_real(param[4], &threshold_lo_)) {
PRINT_INPUT_ERROR("threshold should be a real number.\n");
}
if (!is_valid_real(param[5], &threshold_hi_)) {
if (!is_valid_real(param[4], &threshold_low_)) {
PRINT_INPUT_ERROR("threshold_low should be a real number.\n");
}
if (!is_valid_real(param[5], &threshold_high_)) {

if (!is_valid_real(param[4], &threshold_lo_)) {
PRINT_INPUT_ERROR("threshold should be a real number.\n");
}
if (!is_valid_real(param[5], &threshold_hi_)) {
PRINT_INPUT_ERROR("threshold should be a real number.\n");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
PRINT_INPUT_ERROR("threshold should be a real number.\n");
PRINT_INPUT_ERROR("threshold_high should be a real number.\n");

@@ -238,7 +241,7 @@ void Active::process(
}
}
write_uncertainty(step, global_time, uncertainty);
if (uncertainty > threshold_) {
if (threshold_hi_ > uncertainty && uncertainty > threshold_lo_) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (threshold_hi_ > uncertainty && uncertainty > threshold_lo_) {
if (threshold_high_ > uncertainty && uncertainty > threshold_low_) {

@elindgren
Copy link
Collaborator

@elindgren Do you think it is necessary to have an upper limit?

I have not encountered this situation personally, but I can see it potentially being an issue. My main concern is if it should be set by the user, or be an internal fixed parameter. As I said in my other comment, I think it's difficult to set a good value for an internal parameter however.

@Youhaojen
Copy link
Author

@elindgren I agree. The value of the upper cutoff sometimes requires some experience to choose. However, this functionality mainly references the exploration part of dpgen. Therefore, I think we might be able to implement this functionality here as well.

BTW, don't forget to modify the active.cuh together. #817

@brucefan1983
Copy link
Owner

@elindgren I agree. The value of the upper cutoff sometimes requires some experience to choose. However, this functionality mainly references the exploration part of dpgen. Therefore, I think we might be able to implement this functionality here as well.

BTW, don't forget to modify the active.cuh together. #817

I think you need to take care of this. We cannot merge a broken code.

@brucefan1983 brucefan1983 marked this pull request as draft December 30, 2024 21:24
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