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

Questions regarding the logger #138

Closed
HeleNoir opened this issue Nov 4, 2022 · 5 comments
Closed

Questions regarding the logger #138

HeleNoir opened this issue Nov 4, 2022 · 5 comments
Labels
discussion There is some decision that can not be made alone question Further information is requested

Comments

@HeleNoir
Copy link
Collaborator

HeleNoir commented Nov 4, 2022

I came across some question/problems with our current logging procedure:

  • We do not automatically log the final values. However, I think we should.
  • In examples\coco.rs we use log_common_sets and then set another trigger for logging other values. This results in two triggers and a lot of useless lines in the data. While it is not really a problem, it is nevertheless not nice.

I'm not quite sure if and how we want to adress these issues, so I'm asking for some feedback @luleyleo @Saethox .

@HeleNoir HeleNoir added question Further information is requested discussion There is some decision that can not be made alone labels Nov 4, 2022
@Saethox
Copy link
Collaborator

Saethox commented Nov 15, 2022

We do not automatically log the final values. However, I think we should.

Yeah, we log only every 10 iterations or so, so we may lose the values of the last 9 iterations. Fixes that I can think of include

  • using the Change trigger to log the best objective value, so we certainly know that the value has not changed if it's not logged anymore,
  • or appending a second Logger at the very end, after the loop, to log final values.

In examples\coco.rs we use log_common_sets and then set another trigger for logging other values. This results in two triggers and a lot of useless lines in the data. While it is not really a problem, it is nevertheless not nice.

You can use Logger::builder().log_set(LogSet::common().with_logger(...)) to append to the same trigger used by the common LogSet's. Is this what you mean? In the special case of coco.rs, you could also use Logger::builder().log_common_single_objective_sets() directly.

@HeleNoir
Copy link
Collaborator Author

Thanks for the tipps! I think I managed to resolve the issue with the final values by adding two new trigger options. They may be not nice, but in contrast to your first idea they provide a value for the last iteration/evaluation. However, your idea to append a second Logger might be better.

Towards log_common_sets: I think if we configure more logging options and trigger for a specific experiment, it is not necessary to use this anyway. It might, as in my case, only add useless entries. But it is still helpful for a general overview of the runs.

@HeleNoir
Copy link
Collaborator Author

HeleNoir commented Dec 7, 2022

And another question (I knew there would be some problems when trying to create the first experiment, but I'm getting a bit tired...): Can we log only the diversity value of the DiversityState? @Saethox @luleyleo

At the moment, the whole state is logged. This makes it more complex to prepare the data for evaluation. I could resolve this in Python by reformatting the data, but this will take forever to run with larger experiments...

@luleyleo
Copy link
Collaborator

luleyleo commented Dec 7, 2022

Can we log only the diversity value of the DiversityState?

Yes, we have two options here:

  1. Change the struct definition of diversity state to serialize only the normalized diversity value.
  2. Use a custom logging function which logs only the normalized diversity value and ignores the rest.

The latter is certainly the more flexible option, but the prior might be more convenient.

Option 1:

/// State for logging/tracking population diversity.
#[derive(Debug, Serialize)]
#[serde(transparent)]
pub struct DiversityState<I> {
    /// Normalized diversity.
    pub diversity: f64,

    /// Non-normalized maximal diversity.
    #[serde(skip)]
    pub max_diversity: f64,
    
    #[serde(skip)]
    phantom: PhantomData<I>,
}

Option 2:

pub fn normalized_diversity<I>(state: &State) -> Entry {
    Entry {
        name: type_name::<DiversityState<I>>(),
        value: Box::new(state.get::<DiversityState<I>>().diversity)
    }
}

@HeleNoir
Copy link
Collaborator Author

HeleNoir commented Dec 7, 2022

Thanks! I think I prefer and will use Option 2, especially as there might be some similar cases in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion There is some decision that can not be made alone question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants