alchemist-nrel 0.2.1__py3-none-any.whl → 0.3.0__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 +14 -6
- alchemist_core/audit_log.py +594 -0
- alchemist_core/data/experiment_manager.py +69 -5
- alchemist_core/models/botorch_model.py +6 -4
- alchemist_core/models/sklearn_model.py +44 -6
- alchemist_core/session.py +600 -8
- alchemist_core/utils/doe.py +200 -0
- {alchemist_nrel-0.2.1.dist-info → alchemist_nrel-0.3.0.dist-info}/METADATA +57 -40
- alchemist_nrel-0.3.0.dist-info/RECORD +66 -0
- {alchemist_nrel-0.2.1.dist-info → alchemist_nrel-0.3.0.dist-info}/entry_points.txt +1 -0
- {alchemist_nrel-0.2.1.dist-info → alchemist_nrel-0.3.0.dist-info}/top_level.txt +1 -0
- api/main.py +19 -3
- api/models/requests.py +71 -0
- api/models/responses.py +144 -0
- api/routers/experiments.py +117 -5
- api/routers/sessions.py +329 -10
- api/routers/visualizations.py +10 -5
- api/services/session_store.py +210 -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-C0_glioA.js +4084 -0
- api/static/assets/index-CB4V1LI5.css +1 -0
- api/static/index.html +14 -0
- api/static/vite.svg +1 -0
- run_api.py +55 -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_nrel-0.2.1.dist-info/RECORD +0 -54
- {alchemist_nrel-0.2.1.dist-info → alchemist_nrel-0.3.0.dist-info}/WHEEL +0 -0
- {alchemist_nrel-0.2.1.dist-info → alchemist_nrel-0.3.0.dist-info}/licenses/LICENSE +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
|
]
|
|
@@ -392,10 +392,13 @@ class BoTorchAcquisition(BaseAcquisition):
|
|
|
392
392
|
if self.batch_size > 1:
|
|
393
393
|
result_points = []
|
|
394
394
|
|
|
395
|
+
# Use original feature names (before encoding)
|
|
396
|
+
feature_names = self.model.original_feature_names
|
|
397
|
+
|
|
395
398
|
# Convert each point in the batch to a dictionary with feature names
|
|
396
399
|
for i in range(best_candidates.shape[0]):
|
|
397
400
|
point_dict = {}
|
|
398
|
-
for j, name in enumerate(
|
|
401
|
+
for j, name in enumerate(feature_names):
|
|
399
402
|
value = best_candidates[i, j]
|
|
400
403
|
|
|
401
404
|
# If this is a categorical variable, convert back to original value
|
|
@@ -418,8 +421,11 @@ class BoTorchAcquisition(BaseAcquisition):
|
|
|
418
421
|
return result_points
|
|
419
422
|
|
|
420
423
|
# For single-point results (q = 1)
|
|
424
|
+
# Use original feature names (before encoding)
|
|
425
|
+
feature_names = self.model.original_feature_names
|
|
426
|
+
|
|
421
427
|
result = {}
|
|
422
|
-
for i, name in enumerate(
|
|
428
|
+
for i, name in enumerate(feature_names):
|
|
423
429
|
value = best_candidates[0, i]
|
|
424
430
|
|
|
425
431
|
# If this is a categorical variable, convert back to original value
|
|
@@ -448,10 +454,11 @@ class BoTorchAcquisition(BaseAcquisition):
|
|
|
448
454
|
return bounds_tensor
|
|
449
455
|
|
|
450
456
|
# Get feature names from model to ensure proper order
|
|
451
|
-
if not hasattr(self.model, '
|
|
452
|
-
raise ValueError("Model doesn't have
|
|
457
|
+
if not hasattr(self.model, 'original_feature_names'):
|
|
458
|
+
raise ValueError("Model doesn't have original_feature_names attribute")
|
|
453
459
|
|
|
454
|
-
|
|
460
|
+
# Use original_feature_names (before encoding) for bounds extraction
|
|
461
|
+
feature_names = self.model.original_feature_names
|
|
455
462
|
|
|
456
463
|
# Get categorical variables
|
|
457
464
|
categorical_variables = []
|
|
@@ -636,8 +643,9 @@ class BoTorchAcquisition(BaseAcquisition):
|
|
|
636
643
|
best_candidate = best_x.cpu().numpy().reshape(1, -1)
|
|
637
644
|
|
|
638
645
|
# Convert to dictionary and then to DataFrame
|
|
646
|
+
feature_names = self.model.original_feature_names
|
|
639
647
|
result = {}
|
|
640
|
-
for i, name in enumerate(
|
|
648
|
+
for i, name in enumerate(feature_names):
|
|
641
649
|
value = best_candidate[0, i]
|
|
642
650
|
|
|
643
651
|
# If this is a categorical variable, convert back to original value
|