hypertune 1.1.0rc45__tar.gz → 1.2.0rc0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/PKG-INFO +1 -1
  2. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/matrix/utils.py +92 -24
  3. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/pkg.py +1 -1
  4. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/search_managers/bayesian_optimization/acquisition_function.py +1 -1
  5. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune.egg-info/PKG-INFO +1 -1
  6. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune.egg-info/requires.txt +3 -2
  7. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/setup.cfg +1 -1
  8. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/MANIFEST.in +0 -0
  9. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/__init__.py +0 -0
  10. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/iteration_lineage.py +0 -0
  11. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/logger.py +0 -0
  12. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/matrix/__init__.py +0 -0
  13. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/matrix/dist.py +0 -0
  14. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/matrix/hyperopt.py +0 -0
  15. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/py.typed +0 -0
  16. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/search_managers/__init__.py +0 -0
  17. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/search_managers/base.py +0 -0
  18. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/search_managers/bayesian_optimization/__init__.py +0 -0
  19. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/search_managers/bayesian_optimization/manager.py +0 -0
  20. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/search_managers/bayesian_optimization/optimizer.py +0 -0
  21. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/search_managers/bayesian_optimization/space.py +0 -0
  22. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/search_managers/grid_search/__init__.py +0 -0
  23. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/search_managers/grid_search/manager.py +0 -0
  24. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/search_managers/hyperband/__init__.py +0 -0
  25. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/search_managers/hyperband/manager.py +0 -0
  26. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/search_managers/hyperopt/__init__.py +0 -0
  27. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/search_managers/hyperopt/manager.py +0 -0
  28. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/search_managers/mapping/__init__.py +0 -0
  29. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/search_managers/mapping/manager.py +0 -0
  30. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/search_managers/random_search/__init__.py +0 -0
  31. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/search_managers/random_search/manager.py +0 -0
  32. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/search_managers/spec.py +0 -0
  33. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune/search_managers/utils.py +0 -0
  34. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune.egg-info/SOURCES.txt +0 -0
  35. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune.egg-info/dependency_links.txt +0 -0
  36. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/hypertune.egg-info/top_level.txt +0 -0
  37. {hypertune-1.1.0rc45 → hypertune-1.2.0rc0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hypertune
3
- Version: 1.1.0rc45
3
+ Version: 1.2.0rc0
4
4
  Summary: A library for performing hyperparameter optimization with Polyaxon.
5
5
  Home-page: https://github.com/polyaxon/hypertune
6
6
  Author: Polyaxon, Inc.
@@ -2,7 +2,7 @@ import numpy as np
2
2
 
3
3
  from datetime import date, datetime
4
4
 
5
- from clipped.compact.pydantic import ValidationError
5
+ from clipped.compact.pydantic import PYDANTIC_VERSION, ValidationError
6
6
 
7
7
  from hypertune.matrix import dist
8
8
  from polyaxon.schemas import (
@@ -97,9 +97,25 @@ def get_length(matrix):
97
97
  V1HpLogNormal._IDENTIFIER,
98
98
  V1HpQLogNormal._IDENTIFIER,
99
99
  }:
100
- raise ValidationError(
101
- ["Distribution should not call `length`"], matrix.__class__
102
- )
100
+ error_msg = "Distribution should not call `length`"
101
+ if PYDANTIC_VERSION.startswith("2."):
102
+ raise ValidationError.from_exception_data(
103
+ title="Value Error",
104
+ line_errors=[
105
+ {
106
+ "type": "value_error",
107
+ "loc": ("get_length",),
108
+ # Location tuple indicating where the error occurred
109
+ "msg": error_msg,
110
+ "input": matrix.__class__, # The invalid input that caused the error
111
+ "ctx": {"error": error_msg},
112
+ }
113
+ ],
114
+ )
115
+ else:
116
+ raise ValidationError(
117
+ ["Distribution should not call `length`"], matrix.__class__
118
+ )
103
119
 
104
120
 
105
121
  def get_min(matrix):
@@ -175,13 +191,31 @@ def to_numpy(matrix):
175
191
  return matrix.value
176
192
 
177
193
  if matrix._IDENTIFIER == V1HpPChoice._IDENTIFIER:
178
- raise ValidationError( # TODO: Fix error message
179
- [
180
- "Distribution should not call `to_numpy`, "
181
- "instead it should call `sample`."
182
- ],
183
- matrix.__class__,
194
+ error_msg = (
195
+ "Distribution should not call `to_numpy`, instead it should call `sample`."
184
196
  )
197
+ if PYDANTIC_VERSION.startswith("2."):
198
+ raise ValidationError.from_exception_data(
199
+ title="Value Error",
200
+ line_errors=[
201
+ {
202
+ "type": "value_error",
203
+ "loc": ("get_length",),
204
+ # Location tuple indicating where the error occurred
205
+ "msg": error_msg,
206
+ "input": matrix.__class__, # The invalid input that caused the error
207
+ "ctx": {"error": error_msg},
208
+ }
209
+ ],
210
+ )
211
+ else:
212
+ raise ValidationError( # TODO: Fix error message
213
+ [
214
+ "Distribution should not call `to_numpy`, "
215
+ "instead it should call `sample`."
216
+ ],
217
+ matrix.__class__,
218
+ )
185
219
 
186
220
  if matrix._IDENTIFIER == V1HpDateRange._IDENTIFIER:
187
221
  return np.arange(**matrix.value.to_dict()).astype(date)
@@ -211,13 +245,31 @@ def to_numpy(matrix):
211
245
  V1HpLogNormal._IDENTIFIER,
212
246
  V1HpQLogNormal._IDENTIFIER,
213
247
  }:
214
- raise ValidationError(
215
- [
216
- "Distribution should not call `to_numpy`, "
217
- "instead it should call `sample`."
218
- ],
219
- matrix.__class__,
248
+ error_msg = (
249
+ "Distribution should not call `to_numpy`, instead it should call `sample`."
220
250
  )
251
+ if PYDANTIC_VERSION.startswith("2."):
252
+ raise ValidationError.from_exception_data(
253
+ title="Value Error",
254
+ line_errors=[
255
+ {
256
+ "type": "value_error",
257
+ "loc": ("get_length",),
258
+ # Location tuple indicating where the error occurred
259
+ "msg": error_msg,
260
+ "input": matrix.__class__, # The invalid input that caused the error
261
+ "ctx": {"error": error_msg},
262
+ }
263
+ ],
264
+ )
265
+ else:
266
+ raise ValidationError(
267
+ [
268
+ "Distribution should not call `to_numpy`, "
269
+ "instead it should call `sample`."
270
+ ],
271
+ matrix.__class__,
272
+ )
221
273
 
222
274
 
223
275
  def _sample(matrix, size=None, rand_generator=None):
@@ -295,11 +347,27 @@ def sample(matrix, size=None, rand_generator=None):
295
347
  try:
296
348
  return _sample(matrix, size=size, rand_generator=rand_generator)
297
349
  except Exception as e:
298
- raise ValidationError(
299
- [
300
- "Could not sample from matrix value: {} for kind: {} with size: {}".format(
301
- matrix.value, matrix._IDENTIFIER, size
302
- )
303
- ],
304
- matrix.__class__,
305
- ) from e
350
+ error_msg = (
351
+ "Could not sample from matrix value: {} for kind: {} with size: {}".format(
352
+ matrix.value, matrix._IDENTIFIER, size
353
+ )
354
+ )
355
+ if PYDANTIC_VERSION.startswith("2."):
356
+ raise ValidationError.from_exception_data(
357
+ title="Value Error",
358
+ line_errors=[
359
+ {
360
+ "type": "value_error",
361
+ "loc": ("get_length",),
362
+ # Location tuple indicating where the error occurred
363
+ "msg": error_msg,
364
+ "input": matrix.__class__, # The invalid input that caused the error
365
+ "ctx": {"error": error_msg},
366
+ }
367
+ ],
368
+ ) from e
369
+ else:
370
+ raise ValidationError(
371
+ [error_msg],
372
+ matrix.__class__,
373
+ ) from e
@@ -1,5 +1,5 @@
1
1
  NAME = "hypertune"
2
- VERSION = "1.1.0-rc45"
2
+ VERSION = "1.2.0-rc0"
3
3
  DESC = "A library for performing hyperparameter optimization with Polyaxon."
4
4
  URL = "https://github.com/polyaxon/hypertune"
5
5
  AUTHOR = "Polyaxon, Inc."
@@ -99,7 +99,7 @@ class UtilityFunction:
99
99
  # Find the minimum of minus the acquisition function
100
100
  res = minimize(
101
101
  lambda x: -self.compute(x.reshape(1, -1), y_max=y_max),
102
- x_try.reshape(1, -1),
102
+ x_try.flatten(),
103
103
  bounds=bounds,
104
104
  method="L-BFGS-B",
105
105
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hypertune
3
- Version: 1.1.0rc45
3
+ Version: 1.2.0rc0
4
4
  Summary: A library for performing hyperparameter optimization with Polyaxon.
5
5
  Home-page: https://github.com/polyaxon/hypertune
6
6
  Author: Polyaxon, Inc.
@@ -7,9 +7,10 @@ hyperopt
7
7
  pandas
8
8
  ipython
9
9
  numpy
10
- scipy<1.11
11
- scikit-learn<1.3
10
+ scipy
11
+ scikit-learn<1.6
12
12
  hyperopt<0.2.8
13
+ setuptools
13
14
 
14
15
  [polyaxon]
15
16
  polyaxon
@@ -1,5 +1,5 @@
1
1
  [metadata]
2
- description-file = README.md
2
+ description = file: README.md
3
3
 
4
4
  [isort]
5
5
  honor_noqa = True
File without changes
File without changes