architecture-designlisted
Install: claude install-skill jessevanwyk1/claude-scholar
# Architecture Design - ML Project Template
This skill defines the standard code architecture for machine learning projects based on the template structure. When modifying or extending code, follow these patterns to maintain consistency.
## Overview
The project follows a modular, extensible architecture with clear separation of concerns. Each module (data, model, trainer, analysis) is independently organized using factory and registry patterns for maximum flexibility.
## Core Design Patterns
### Factory Pattern
Each module uses a factory to create instances dynamically:
```python
# Example from data_module/dataset/__init__.py
DATASET_FACTORY: Dict = {}
def DatasetFactory(data_name: str):
dataset = DATASET_FACTORY.get(data_name, None)
if dataset is None:
print(f"{data_name} dataset is not implementation, use simple dataset")
dataset = DATASET_FACTORY.get('simple')
return dataset
```
For detailed guidance, refer to `references/factory_pattern.md`.
### Registry Pattern
Components register themselves via decorators:
```python
# Example from data_module/dataset/simple_dataset.py
@register_dataset("simple")
class SimpleDataset(Dataset):
def __init__(self, data):
self.data = data
```
For detailed guidance, refer to `references/registry_pattern.md`.
### Auto-Import Pattern
Modules automatically discover and import submodules:
```python
# Example from data_module/dataset/__init__.py
models_dir = os.path.dirname(__file__)
import_m