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

Sampling of categorical variables returns indicies instead of categorical values #700

Open
wxyeah opened this issue Dec 18, 2024 · 2 comments

Comments

@wxyeah
Copy link

wxyeah commented Dec 18, 2024

I'm using MixedIntegerContext. In the design space I have categorical variables, float variables, and integer variables. I found that the sampled values for the categorical variables are actually the indicies to the categorical values instead of directly the categorical values. This is inconvenient and sometimes confusing (e.g., in my case I'm using integers as categorical values, so it took me some time to realize the sampled values are actually indicies). I think that this should be fixed to behave in the same way as for float variables and integer variables. Thank you.

@relf
Copy link
Member

relf commented Dec 24, 2024

At the moment the values returned by sampling from MixedIntegerContext can be fed directly in surrogate set_training_values() method which was actually the original purpose of MixedIntegerContext.

I agree its documentation has fallen a bit behind since we introduce DesignSpace in SMT 2.0 which covers the handling of mixed integer variable now.

At the moment, you can retrieve actual values with: design_space.decode_values(sampling)

@wxyeah
Copy link
Author

wxyeah commented Jan 6, 2025

At the moment the values returned by sampling from MixedIntegerContext can be fed directly in surrogate set_training_values() method which was actually the original purpose of MixedIntegerContext.

I agree its documentation has fallen a bit behind since we introduce DesignSpace in SMT 2.0 which covers the handling of mixed integer variable now.

At the moment, you can retrieve actual values with: design_space.decode_values(sampling)

Sorry for the late reply, and thank you for your kind clarification. I now understand the issue.

In my case, I'm not doing surrogate modeling, and I only use the MixedIntegerContext to help handle mixed variables. I.e., what I need is just the samples. But it's great to hear that I can retrieve actual values with design_space.decode_values(sampling), which I wasn't aware of.

Thank you again, and please feel free to resolve this open issue if you see fit.

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

No branches or pull requests

2 participants