Categorical Parameter as a context variable
mmilanek37 opened this issue · 4 comments
I am trying to use a categorical variable as a context variable. When I compute_next_points with the candidate_point_calculator, I get the following error:
~\anaconda3\envs\intinker_ml\lib\site-packages\emukit\core\encodings.py in get_encoding(self, category)
94 index = self.categories.index(category)
95 except ValueError:
---> 96 raise ValueError("Unknown category {}" + str(category))
97
98 return self.encodings[index].tolist()
ValueError: Unknown category {}[[1 0 0 0]]
However, when I check if the point is in the domain directly, it returns True:
categorical_variable.check_in_domain(np.array([[1, 0, 0, 0]]))
I can provide a sample Jupyter Notebook to help you understand the problem, but I am wondering if I am missing something here since an example doesn't exist for what I'm trying to do. I would also be willing to collaborate to make an example for creating a context variable with OneHotEncoding, as well as using the categorical parameter as a context variable.
Yeah, categorical aren't easy because of back and forth conversion that has to be done. It can very well be inconsistency in our API. If you could share complete Colab notebook that reproduces the error, it would be very helpful
Just pinging if you could share the codeto reproduce in this issue, @mmilanek37 . Thanks!
Thanks for the reminder--I made a workaround and have some code that I can share that would benefit the community. I'll have to take it out of the context of my project, but then I'll have that and sample code to reproduce the problem, probably near the end of the weekend