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

[Doc] Document the value of UniformFloatHyperparameter should be in [0, 1] #290

Open
eddiebergman opened this issue Jan 18, 2023 · 1 comment · May be fixed by #346
Open

[Doc] Document the value of UniformFloatHyperparameter should be in [0, 1] #290

eddiebergman opened this issue Jan 18, 2023 · 1 comment · May be fixed by #346

Comments

@eddiebergman
Copy link
Contributor

def get_neighbors(
self,
value: Any,
rs: np.random.RandomState,
number: int = 4,
transform: bool = False,
std: float = 0.2
) -> List[float]:
neighbors = [] # type: List[float]
while len(neighbors) < number:
neighbor = rs.normal(value, std) # type: float
if neighbor < 0 or neighbor > 1:
continue
if transform:
neighbors.append(self._transform(neighbor))
else:
neighbors.append(neighbor)
return neighbors

I tried with an actual value generated from the HP and it caused obscene numbers

@eddiebergman
Copy link
Contributor Author

So this was because get_neighbors isn't clear that the value should be in vectorized form. #346 now introduces two methods neighbours_values(value, ...) and neighbours_vectorized(vector, ...) to distinguish between the two. The transform= argument was also removed, i.e. you can call hp.to_value(hp.neighbors_vectorized(1.0, rs)) if you'd like to transform them. This is a re-occuring theme in the refactor where value indicates value space and vector indicates vectorized space, removing the word transform which was ambiguous as to the direction.

The function still exists but is marked as deprecated. Will mark this issue as closed by #346

@eddiebergman eddiebergman linked a pull request Apr 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants