modified: Figure_1.png
modified: checkpoints/forward/best_tcn_model.pt modified: checkpoints/forward/training_history.csv new file: checkpoints_mlp/task1_feature_mlp/best_feature_mlp.pt new file: checkpoints_mlp/task1_feature_mlp/training_history.csv new file: checkpoints_rms/forward_rms/best_rms_model.pt new file: checkpoints_rms/forward_rms/training_history.csv modified: evaluation_outputs/forward/evaluation_forward_test_b0_s0.png new file: evaluation_outputs/forward/evaluation_forward_val_b0_s0.png new file: evaluation_outputs/forward/evaluation_forward_val_b3_s0.png new file: evaluation_outputs/forward_rms/evaluation_test_all_samples.csv new file: evaluation_outputs/forward_rms/evaluation_test_s0.png new file: evaluation_outputs/forward_rms/evaluation_train_all_samples.csv new file: evaluation_outputs/forward_rms/evaluation_val_all_samples.csv new file: evaluation_outputs/forward_rms/evaluation_val_s0.png new file: evaluation_outputs/forward_rms/evaluation_val_s0_waveform.png new file: evaluation_outputs/task1_feature_mlp/evaluation_train_all_samples.csv new file: evaluation_outputs/task1_feature_mlp/evaluation_train_curve.png new file: evaluation_outputs/task1_feature_mlp/evaluation_val_all_samples.csv new file: evaluation_outputs/task1_feature_mlp/evaluation_val_curve.png new file: evaluation_outputs/task1_feature_mlp/evaluation_val_s0.png new file: evaluation_outputs/task1_feature_mlp/harmonic_5mm_0.75Hz_prediction.png new file: evaluation_outputs/task1_feature_mlp/harmonic_5mm_1.55Hz_prediction.png new file: scripts/__pycache__/config.cpython-310.pyc new file: scripts/__pycache__/dataset.cpython-310.pyc new file: scripts/__pycache__/model.cpython-310.pyc new file: scripts/config.py new file: scripts/dataset.py new file: scripts/evaluate.py new file: scripts/model.py new file: scripts/predict_single.py new file: scripts/train.py modified: src/__pycache__/config.cpython-310.pyc modified: src/__pycache__/dataset.cpython-310.pyc modified: src/__pycache__/model.cpython-310.pyc modified: src/config.py modified: src/dataset.py modified: src/model.py new file: src_new/__pycache__/config.cpython-310.pyc new file: src_new/__pycache__/dataset.cpython-310.pyc new file: src_new/__pycache__/evaluate.cpython-310.pyc new file: src_new/__pycache__/model.cpython-310.pyc new file: src_new/__pycache__/train.cpython-310.pyc new file: src_new/config.py new file: src_new/dataset.py new file: src_new/evaluate.py new file: src_new/model.py new file: src_new/train.py
This commit is contained in:
103
src_new/config.py
Normal file
103
src_new/config.py
Normal file
@@ -0,0 +1,103 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@dataclass
|
||||
class DataConfig:
|
||||
project_root: Path = field(default_factory=lambda: Path(__file__).resolve().parents[1])
|
||||
scenario: str = "Non_TMD"
|
||||
train_split_name: str = "train"
|
||||
val_split_name: str = "val"
|
||||
test_split_name: str = "test"
|
||||
csv_pattern: str = "*.csv"
|
||||
|
||||
code_column: str = "code"
|
||||
time_column: str = "time"
|
||||
base_sensor_code: str = "WSMS00012"
|
||||
base_axis: str = "value1"
|
||||
response_sensor_code: str = "WSMS00007"
|
||||
response_axis: str = "value3"
|
||||
|
||||
max_sequence_length: int = 4096
|
||||
min_sequence_length: int = 512
|
||||
batch_size: int = 8
|
||||
num_workers: int = 0
|
||||
pin_memory: bool = True
|
||||
use_weighted_train_sampler: bool = True
|
||||
train_weight_power: float = 1.0
|
||||
train_weight_min: float = 0.5
|
||||
train_weight_max: float = 8.0
|
||||
low_frequency_emphasis_power: float = 1.25
|
||||
low_frequency_reference_hz: float = 1.0
|
||||
|
||||
use_steady_state_only: bool = True
|
||||
steady_state_start_ratio: float = 0.50
|
||||
steady_state_min_samples: int = 256
|
||||
|
||||
interpolation_method: str = "linear"
|
||||
normalization_eps: float = 1e-6
|
||||
|
||||
downloads_dir: Path = field(init=False)
|
||||
scenario_dir: Path = field(init=False)
|
||||
train_dir: Path = field(init=False)
|
||||
val_dir: Path = field(init=False)
|
||||
test_dir: Path = field(init=False)
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
self.project_root = Path(self.project_root).resolve()
|
||||
self.downloads_dir = self.project_root / "downloads"
|
||||
self.scenario_dir = self.downloads_dir / self.scenario
|
||||
self.train_dir = self.scenario_dir / self.train_split_name
|
||||
self.val_dir = self.scenario_dir / self.val_split_name
|
||||
self.test_dir = self.scenario_dir / self.test_split_name
|
||||
|
||||
|
||||
@dataclass
|
||||
class ModelConfig:
|
||||
input_channels: int = 1
|
||||
tcn_channels: tuple[int, ...] = (32, 32, 64, 64)
|
||||
kernel_size: int = 7
|
||||
dropout: float = 0.15
|
||||
dilation_base: int = 2
|
||||
pooled_feature_dim: int = 128
|
||||
|
||||
|
||||
@dataclass
|
||||
class TrainConfig:
|
||||
epochs: int = 120
|
||||
learning_rate: float = 1e-3
|
||||
weight_decay: float = 1e-4
|
||||
seed: int = 42
|
||||
device: str = "cuda"
|
||||
grad_clip_norm: float = 1.0
|
||||
use_amp: bool = True
|
||||
lr_scheduler_patience: int = 8
|
||||
lr_scheduler_factor: float = 0.5
|
||||
min_learning_rate: float = 1e-6
|
||||
early_stop_patience: int = 15
|
||||
checkpoint_dir: str = "checkpoints_rms"
|
||||
best_model_name: str = "best_rms_model.pt"
|
||||
history_name: str = "training_history.csv"
|
||||
|
||||
|
||||
@dataclass
|
||||
class LossConfig:
|
||||
relative_rms_weight: float = 1.0
|
||||
log_rms_weight: float = 0.5
|
||||
mae_weight: float = 0.25
|
||||
waveform_l1_weight: float = 0.03
|
||||
waveform_huber_weight: float = 0.05
|
||||
|
||||
|
||||
@dataclass
|
||||
class ExperimentConfig:
|
||||
data: DataConfig = field(default_factory=DataConfig)
|
||||
model: ModelConfig = field(default_factory=ModelConfig)
|
||||
train: TrainConfig = field(default_factory=TrainConfig)
|
||||
loss: LossConfig = field(default_factory=LossConfig)
|
||||
|
||||
|
||||
def make_rms_forward_config() -> ExperimentConfig:
|
||||
return ExperimentConfig()
|
||||
Reference in New Issue
Block a user