How rock-feller/hcnns_and_chaos works
Project Type and Purpose
• This is a research-oriented deep learning project focusing on modeling chaotic and climate (partially observable) systems.
• It implements custom HCNN and RNN modules from scratch in PyTorch, including specialized data handling, preprocessing, training strategies, and result management.
• The purpose is to provide a systematic experimental setup for advanced neural network architectures, with support for long-memory improvements and hardware acceleration (CUDA and Apple MPS).
Analyzing the File Structure
• Top-level directories include base implementations (HCNN, LSTM, RNN), distinct modeling frameworks (HCNNs_Chaos, RNNs_Chaos, HCNNs_Climate, RNNs_Climate), and utility/data folders (chaotic_data, data).
• Each modeling framework (for both chaos and climate) follows a similar structure featuring:
• A data section (or data_prep) that handles preparation, transformation, and normalization.
• A modules section (hcnn_modules / models) where the core network cells and architectures are defined.
• A modeling_strategy folder that encapsulates custom training functions and experimental strategies.
• The repo also includes test modules (under test/) and supplementary notebooks for simulations and visualizations.
• Configuration files and a clear separation of functionality indicate a modular, layered approach.
Key Components to Capture
a. Data Layer:
• Raw data sources and datasets (organized under the “data” folder, e.g., “climate_data” and “sunhours_data”).
• Specialized data processing modules (e.g., data_prep directories within HCNNs_Chaos, RNNs_Chaos, HCNNs_Climate, and RNNs_Climate; also “climate_wizard” for additional processing).
b. Model Definition Layer:
• Core network architecture modules found in HCNN, LSTM, RNN folders.
• Specialized implementations in the “hcnn_modules” and (for RNNs) in “models” directories.
c. Training/Modeling Strategy Layer:
• Custom training functions and strategies for chaotic systems (in the modeling_strategy folders under HCNNs_Chaos and RNNs_Chaos) and climate systems (in the corresponding HCNNs_Climate and RNNs_Climate directories).
d. Execution and Evaluation:
• Simulation scripts (simulation_instance_HCNNs.py, simulation_instance_RNNs.py, and notebooks in RNNs_Chaos) that drive experiments.
• Output handling components (described in the README’s “Training and Results Management” section, where outputs are organized into JSON metrics, CSV forecast files, and serialized state_dicts).
e. Testing and Visualization:
• Testing components (located in the “test” directory) to validate architectural properties.
• Visualization modules (found in HCNN/visualization.py, LSTM/visualization.py, RNN/visualization.py, and notebooks) to analyze results.
Relationships and Data Flows
• Raw data from the “data” folder flows into the data preprocessing modules (data_prep folders).
• Preprocessed data feeds into the network modules (HCNN_Cells, rnn_based_models, etc.).
• The forward pass and backward propagation (implemented in custom model files within HCNN, LSTM, and RNN directories) interact with the training strategy modules to optimize the models.
• During training, outputs (performance metrics, forecasts, trained models) are generated and stored in designated output folders.
• External simulation scripts and notebooks oversee the overall experiment flow, invoking both preprocessing and training components.
Architectural Patterns and Design Principles
• Modularization: Each major function (data handling, modeling, training, output management) is separated into distinct folders/modules, reflecting a layered architecture.
• Reusability & Extensibility: Parallel folders for chaos and climate ensure that similar functionalities (data preprocessing, modeling, training) can be extended or modified independently.