Upload config.py with huggingface_hub
Browse files
config.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Global configuration for the Physics-Informed Bayesian Optimization platform."""
|
| 2 |
+
|
| 3 |
+
from dataclasses import dataclass, field
|
| 4 |
+
from enum import Enum
|
| 5 |
+
from typing import Optional
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class OptimizerBackend(Enum):
|
| 9 |
+
BOTORCH = "botorch"
|
| 10 |
+
AX = "ax"
|
| 11 |
+
BOFIRE = "bofire"
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
class AcquisitionType(Enum):
|
| 15 |
+
EXPECTED_IMPROVEMENT = "EI"
|
| 16 |
+
UPPER_CONFIDENCE_BOUND = "UCB"
|
| 17 |
+
PROBABILITY_OF_IMPROVEMENT = "PI"
|
| 18 |
+
KNOWLEDGE_GRADIENT = "KG"
|
| 19 |
+
NOISY_EXPECTED_IMPROVEMENT = "NEI"
|
| 20 |
+
PHYSICS_INFORMED_EI = "PI_EI" # Custom: penalizes physically implausible regions
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
@dataclass
|
| 24 |
+
class OptimizationConfig:
|
| 25 |
+
"""Configuration for a Bayesian optimization run."""
|
| 26 |
+
|
| 27 |
+
# Backend selection
|
| 28 |
+
backend: OptimizerBackend = OptimizerBackend.BOTORCH
|
| 29 |
+
|
| 30 |
+
# Acquisition function
|
| 31 |
+
acquisition_type: AcquisitionType = AcquisitionType.EXPECTED_IMPROVEMENT
|
| 32 |
+
|
| 33 |
+
# Optimization settings
|
| 34 |
+
n_initial_samples: int = 10
|
| 35 |
+
batch_size: int = 1
|
| 36 |
+
max_iterations: int = 50
|
| 37 |
+
seed: int = 42
|
| 38 |
+
|
| 39 |
+
# GP settings
|
| 40 |
+
use_physics_mean: bool = True
|
| 41 |
+
learn_noise: bool = True
|
| 42 |
+
noise_variance: float = 0.01
|
| 43 |
+
|
| 44 |
+
# Physics model settings
|
| 45 |
+
physics_model_weight: float = 1.0 # Weight of physics prior (0=pure GP, 1=full physics)
|
| 46 |
+
physics_constraint_penalty: float = 10.0
|
| 47 |
+
|
| 48 |
+
# Multi-fidelity settings
|
| 49 |
+
use_multi_fidelity: bool = False
|
| 50 |
+
fidelity_weights: Optional[dict] = None
|
| 51 |
+
|
| 52 |
+
# Hardware
|
| 53 |
+
device: str = "cpu"
|
| 54 |
+
dtype: str = "float64"
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
@dataclass
|
| 58 |
+
class SearchSpaceConfig:
|
| 59 |
+
"""Configuration for the search/parameter space."""
|
| 60 |
+
|
| 61 |
+
normalize_inputs: bool = True
|
| 62 |
+
standardize_outputs: bool = True
|
| 63 |
+
input_transform: Optional[str] = None
|
| 64 |
+
output_transform: Optional[str] = None
|