hypertune 1.1.0rc45__py3-none-any.whl → 1.2.0rc0__py3-none-any.whl

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.
hypertune/matrix/utils.py CHANGED
@@ -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
hypertune/pkg.py CHANGED
@@ -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.
@@ -34,17 +34,18 @@ Requires-Python: >=3.8
34
34
  Description-Content-Type: text/markdown
35
35
  License-File: LICENSE
36
36
  Provides-Extra: all
37
- Requires-Dist: scikit-learn ; extra == 'all'
38
- Requires-Dist: hyperopt ; extra == 'all'
37
+ Requires-Dist: scikit-learn; extra == "all"
38
+ Requires-Dist: hyperopt; extra == "all"
39
39
  Provides-Extra: dev
40
- Requires-Dist: pandas ; extra == 'dev'
41
- Requires-Dist: ipython ; extra == 'dev'
42
- Requires-Dist: numpy ; extra == 'dev'
43
- Requires-Dist: scipy <1.11 ; extra == 'dev'
44
- Requires-Dist: scikit-learn <1.3 ; extra == 'dev'
45
- Requires-Dist: hyperopt <0.2.8 ; extra == 'dev'
40
+ Requires-Dist: pandas; extra == "dev"
41
+ Requires-Dist: ipython; extra == "dev"
42
+ Requires-Dist: numpy; extra == "dev"
43
+ Requires-Dist: scipy; extra == "dev"
44
+ Requires-Dist: scikit-learn<1.6; extra == "dev"
45
+ Requires-Dist: hyperopt<0.2.8; extra == "dev"
46
+ Requires-Dist: setuptools; extra == "dev"
46
47
  Provides-Extra: polyaxon
47
- Requires-Dist: polyaxon ; extra == 'polyaxon'
48
+ Requires-Dist: polyaxon; extra == "polyaxon"
48
49
 
49
50
  [![License: Apache 2](https://img.shields.io/badge/License-apache2-green.svg)](LICENSE)
50
51
  [![hypertune](https://github.com/polyaxon/hypertune/actions/workflows/hypertune.yml/badge.svg)](https://github.com/polyaxon/hypertune/actions/workflows/hypertune.yml)
@@ -1,17 +1,17 @@
1
1
  hypertune/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
2
2
  hypertune/iteration_lineage.py,sha256=z515AFwiJd9w8LjmS_9fZ3Isi3XWB1deNQtr_OssoaE,2886
3
3
  hypertune/logger.py,sha256=IHyqYlPIbssr8aCrewsPyxUBpgYPFWqvRithcGd7RDc,56
4
- hypertune/pkg.py,sha256=ilLZ17hvGb5E5TI2dClhd-K9u9ZwvXW1Ixv8bc1Y78g,245
4
+ hypertune/pkg.py,sha256=O7wVEQwLQ-4VWF9qihaJCRjsh7ZqsYzMDjdtyTz1SAs,244
5
5
  hypertune/matrix/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
6
6
  hypertune/matrix/dist.py,sha256=4d0jdcmaMGkTjpZvkRsnsA5PgzvO4g323LZ9mVdiDuA,1442
7
7
  hypertune/matrix/hyperopt.py,sha256=d4q50BaHQCU62YnpEKr8-m7NAvMR73aRhB1tDPXHwzo,2175
8
- hypertune/matrix/utils.py,sha256=KsTuTItUptoQvHlo4UGpXOBpVS2Sb_A_WO6pBy5FJGo,9430
8
+ hypertune/matrix/utils.py,sha256=SQFV3uGr3UGTfHRSKqLjRexsFoNEzTixUeocP3Q8PcM,12335
9
9
  hypertune/search_managers/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
10
10
  hypertune/search_managers/base.py,sha256=IIPiJYBqexlIF9T-2JdPyVzoWSsrN-XDOOHuYltoGfA,539
11
11
  hypertune/search_managers/spec.py,sha256=Z0Vq14yaA5MEz1lbaay8QSCIRIjTWnYQjPzaU0KhRfY,725
12
12
  hypertune/search_managers/utils.py,sha256=8gLvRNTmFTm6xUDx3HgHv4h4_Dl5ywGHpAffIM6Tm5E,134
13
13
  hypertune/search_managers/bayesian_optimization/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
14
- hypertune/search_managers/bayesian_optimization/acquisition_function.py,sha256=Hhxiks3poJ0vK6CQUo1uPYCDoknieVg4l2xcrYButX4,4711
14
+ hypertune/search_managers/bayesian_optimization/acquisition_function.py,sha256=W524peBo9rGvahBhlb4s96isR-Pk0f7Z7K7wX-x2xVo,4706
15
15
  hypertune/search_managers/bayesian_optimization/manager.py,sha256=D9onVt4EWkTjNQcVf1yQo1J4sPmLB1sqfQ6-sctpc60,1268
16
16
  hypertune/search_managers/bayesian_optimization/optimizer.py,sha256=fNxLnBpSFPVWeGNhDp_OGUwhT6h_VzOV32pY9TeNzJQ,1304
17
17
  hypertune/search_managers/bayesian_optimization/space.py,sha256=gNXMHeUeCyaMurkImNuKRb7Lbo2e1ar6LbOxqN0N4o0,5265
@@ -25,8 +25,8 @@ hypertune/search_managers/mapping/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZ
25
25
  hypertune/search_managers/mapping/manager.py,sha256=nDeS5PkD2FEX151MUpB2GWelpO_V6Yvh46NZzVVDqC8,632
26
26
  hypertune/search_managers/random_search/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
27
27
  hypertune/search_managers/random_search/manager.py,sha256=NhkRCAtrkVm63YC7TCdzeQJcvK2xRYoMzU1ImZinnJY,1850
28
- hypertune-1.1.0rc45.dist-info/LICENSE,sha256=86kroZbQUDsmSWOomB7dpceG65UXiVSPob4581tStBc,11349
29
- hypertune-1.1.0rc45.dist-info/METADATA,sha256=KCjpCi8ZFdLzP0jbS7puluKvOdbdjVO2R73A7sJkfEE,3313
30
- hypertune-1.1.0rc45.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
31
- hypertune-1.1.0rc45.dist-info/top_level.txt,sha256=96t0aNwmDTWYuj8VXyzogiQ8zBV06FCXZic8xyMTY14,10
32
- hypertune-1.1.0rc45.dist-info/RECORD,,
28
+ hypertune-1.2.0rc0.dist-info/LICENSE,sha256=86kroZbQUDsmSWOomB7dpceG65UXiVSPob4581tStBc,11349
29
+ hypertune-1.2.0rc0.dist-info/METADATA,sha256=hUjcrs66q1C5jYCzA6huKaYRGBp3Ej5Qsnicq0usAUQ,3337
30
+ hypertune-1.2.0rc0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
31
+ hypertune-1.2.0rc0.dist-info/top_level.txt,sha256=96t0aNwmDTWYuj8VXyzogiQ8zBV06FCXZic8xyMTY14,10
32
+ hypertune-1.2.0rc0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.2)
2
+ Generator: bdist_wheel (0.45.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5