alchemist-nrel 0.2.1__py3-none-any.whl → 0.3.1__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.
- alchemist_core/__init__.py +14 -7
- alchemist_core/acquisition/botorch_acquisition.py +15 -6
- alchemist_core/audit_log.py +594 -0
- alchemist_core/data/experiment_manager.py +76 -5
- alchemist_core/models/botorch_model.py +6 -4
- alchemist_core/models/sklearn_model.py +74 -8
- alchemist_core/session.py +788 -39
- alchemist_core/utils/doe.py +200 -0
- alchemist_nrel-0.3.1.dist-info/METADATA +185 -0
- alchemist_nrel-0.3.1.dist-info/RECORD +66 -0
- {alchemist_nrel-0.2.1.dist-info → alchemist_nrel-0.3.1.dist-info}/entry_points.txt +1 -0
- api/example_client.py +7 -2
- api/main.py +21 -4
- api/models/requests.py +95 -1
- api/models/responses.py +167 -0
- api/routers/acquisition.py +25 -0
- api/routers/experiments.py +134 -6
- api/routers/sessions.py +438 -10
- api/routers/visualizations.py +10 -5
- api/routers/websocket.py +132 -0
- api/run_api.py +56 -0
- api/services/session_store.py +285 -54
- api/static/NEW_ICON.ico +0 -0
- api/static/NEW_ICON.png +0 -0
- api/static/NEW_LOGO_DARK.png +0 -0
- api/static/NEW_LOGO_LIGHT.png +0 -0
- api/static/assets/api-vcoXEqyq.js +1 -0
- api/static/assets/index-DWfIKU9j.js +4094 -0
- api/static/assets/index-sMIa_1hV.css +1 -0
- api/static/index.html +14 -0
- api/static/vite.svg +1 -0
- ui/gpr_panel.py +7 -2
- ui/notifications.py +197 -10
- ui/ui.py +1117 -68
- ui/variables_setup.py +47 -2
- ui/visualizations.py +60 -3
- alchemist_core/models/ax_model.py +0 -159
- alchemist_nrel-0.2.1.dist-info/METADATA +0 -206
- alchemist_nrel-0.2.1.dist-info/RECORD +0 -54
- {alchemist_nrel-0.2.1.dist-info → alchemist_nrel-0.3.1.dist-info}/WHEEL +0 -0
- {alchemist_nrel-0.2.1.dist-info → alchemist_nrel-0.3.1.dist-info}/licenses/LICENSE +0 -0
- {alchemist_nrel-0.2.1.dist-info → alchemist_nrel-0.3.1.dist-info}/top_level.txt +0 -0
alchemist_core/__init__.py
CHANGED
|
@@ -10,6 +10,7 @@ Main Components:
|
|
|
10
10
|
- ExperimentManager: Manage experimental data
|
|
11
11
|
- Models: Surrogate modeling backends (sklearn, BoTorch)
|
|
12
12
|
- Acquisition: Acquisition function strategies
|
|
13
|
+
- AuditLog: Reproducible audit trail for optimization decisions
|
|
13
14
|
|
|
14
15
|
Example:
|
|
15
16
|
>>> from alchemist_core import OptimizationSession, SearchSpace, ExperimentManager
|
|
@@ -26,10 +27,10 @@ Example:
|
|
|
26
27
|
>>> # Get next experiment suggestion
|
|
27
28
|
>>> next_point = session.suggest_next(acq_func="ei")
|
|
28
29
|
|
|
29
|
-
Version: 0.
|
|
30
|
+
Version: 0.3.0-beta.1
|
|
30
31
|
"""
|
|
31
32
|
|
|
32
|
-
__version__ = "0.
|
|
33
|
+
__version__ = "0.3.0b1"
|
|
33
34
|
__author__ = "Caleb Coatney"
|
|
34
35
|
__email__ = "caleb.coatney@nrel.gov"
|
|
35
36
|
|
|
@@ -37,6 +38,9 @@ __email__ = "caleb.coatney@nrel.gov"
|
|
|
37
38
|
from alchemist_core.data.search_space import SearchSpace
|
|
38
39
|
from alchemist_core.data.experiment_manager import ExperimentManager
|
|
39
40
|
|
|
41
|
+
# Audit log and session metadata
|
|
42
|
+
from alchemist_core.audit_log import AuditLog, SessionMetadata, AuditEntry
|
|
43
|
+
|
|
40
44
|
# Event system
|
|
41
45
|
from alchemist_core.events import EventEmitter
|
|
42
46
|
|
|
@@ -48,16 +52,19 @@ from alchemist_core.session import OptimizationSession
|
|
|
48
52
|
|
|
49
53
|
# Public API
|
|
50
54
|
__all__ = [
|
|
51
|
-
#
|
|
55
|
+
# Session API
|
|
52
56
|
"OptimizationSession",
|
|
53
|
-
|
|
54
57
|
# Data structures
|
|
55
58
|
"SearchSpace",
|
|
56
59
|
"ExperimentManager",
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
# Audit log
|
|
61
|
+
"AuditLog",
|
|
62
|
+
"SessionMetadata",
|
|
63
|
+
"AuditEntry",
|
|
64
|
+
# Event system
|
|
59
65
|
"EventEmitter",
|
|
66
|
+
# Configuration
|
|
60
67
|
"configure_logging",
|
|
61
68
|
"get_logger",
|
|
62
|
-
"set_verbosity"
|
|
69
|
+
"set_verbosity"
|
|
63
70
|
]
|
|
@@ -268,6 +268,7 @@ class BoTorchAcquisition(BaseAcquisition):
|
|
|
268
268
|
"batch_limit": batch_limit,
|
|
269
269
|
"maxiter": max_iter,
|
|
270
270
|
"ftol": 1e-3, # More relaxed convergence criteria
|
|
271
|
+
"factr": None, # Required when ftol is specified
|
|
271
272
|
}
|
|
272
273
|
else:
|
|
273
274
|
# Standard parameters for other acquisition functions
|
|
@@ -392,10 +393,13 @@ class BoTorchAcquisition(BaseAcquisition):
|
|
|
392
393
|
if self.batch_size > 1:
|
|
393
394
|
result_points = []
|
|
394
395
|
|
|
396
|
+
# Use original feature names (before encoding)
|
|
397
|
+
feature_names = self.model.original_feature_names
|
|
398
|
+
|
|
395
399
|
# Convert each point in the batch to a dictionary with feature names
|
|
396
400
|
for i in range(best_candidates.shape[0]):
|
|
397
401
|
point_dict = {}
|
|
398
|
-
for j, name in enumerate(
|
|
402
|
+
for j, name in enumerate(feature_names):
|
|
399
403
|
value = best_candidates[i, j]
|
|
400
404
|
|
|
401
405
|
# If this is a categorical variable, convert back to original value
|
|
@@ -418,8 +422,11 @@ class BoTorchAcquisition(BaseAcquisition):
|
|
|
418
422
|
return result_points
|
|
419
423
|
|
|
420
424
|
# For single-point results (q = 1)
|
|
425
|
+
# Use original feature names (before encoding)
|
|
426
|
+
feature_names = self.model.original_feature_names
|
|
427
|
+
|
|
421
428
|
result = {}
|
|
422
|
-
for i, name in enumerate(
|
|
429
|
+
for i, name in enumerate(feature_names):
|
|
423
430
|
value = best_candidates[0, i]
|
|
424
431
|
|
|
425
432
|
# If this is a categorical variable, convert back to original value
|
|
@@ -448,10 +455,11 @@ class BoTorchAcquisition(BaseAcquisition):
|
|
|
448
455
|
return bounds_tensor
|
|
449
456
|
|
|
450
457
|
# Get feature names from model to ensure proper order
|
|
451
|
-
if not hasattr(self.model, '
|
|
452
|
-
raise ValueError("Model doesn't have
|
|
458
|
+
if not hasattr(self.model, 'original_feature_names'):
|
|
459
|
+
raise ValueError("Model doesn't have original_feature_names attribute")
|
|
453
460
|
|
|
454
|
-
|
|
461
|
+
# Use original_feature_names (before encoding) for bounds extraction
|
|
462
|
+
feature_names = self.model.original_feature_names
|
|
455
463
|
|
|
456
464
|
# Get categorical variables
|
|
457
465
|
categorical_variables = []
|
|
@@ -636,8 +644,9 @@ class BoTorchAcquisition(BaseAcquisition):
|
|
|
636
644
|
best_candidate = best_x.cpu().numpy().reshape(1, -1)
|
|
637
645
|
|
|
638
646
|
# Convert to dictionary and then to DataFrame
|
|
647
|
+
feature_names = self.model.original_feature_names
|
|
639
648
|
result = {}
|
|
640
|
-
for i, name in enumerate(
|
|
649
|
+
for i, name in enumerate(feature_names):
|
|
641
650
|
value = best_candidate[0, i]
|
|
642
651
|
|
|
643
652
|
# If this is a categorical variable, convert back to original value
|