Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

trade-model-validation

This repository provides a tool for analyzing trade flows using Gravity Models and Artificial Neural Networks (ANNs) in wood markets. It supports flexible configuration, allowing users to customize input parameters, data selection, and model settings.

Python Version:

This code was developed and tested using Python 3.12.6. To ensure compatibility and reproducibility, it is recommended to use this version.

Installation

To set up the project, follow these steps:

  1. Clone the repository:

    git clone https://github.com/ChristianMorland/trade-model-validation
  2. Create a virtual environment:

    py -3.12 -m venv venv
  3. Activate the virtual environment:

    1. On Windows:
     venv\Scripts\activate
    1. On macOS/Linux:
     source venv/bin/activate
  4. Install required dependencies:

     pip install -r requirements.txt

User Input Parameters

You can customize the program's behavior using the following input parameters:

General Input

input_file: Path to the folder containing the input data.
gravity_output_folder: Folder to save outputs of the Gravity Models.
ann_output_folder: Folder to save outputs of the ANN models.
model_analytics_folder: Folder for saving descriptive analytics.
commodity_id: Specific commodity ID to analyze.
traditional_gravity_model: Set to True to apply only the traditional Gravity Model.
two_way_fix_effects_estimation: Set to True to apply Gravity Models with two-way fixed effects.
show_plots: Set to True to display plots during execution.
loop_over_commodities: Set to True to loop through all commodity groups (overwrites commodity_id).
loop_over_batches: Set to True to repeat the analysis multiple times for validation.
number_of_batches: Number of batches for repeated analysis.
random_state: Random seed for reproducibility. If looping over batches, the batch number is used as the seed.

Data Selection

min_year: Minimum year of data to include in the analysis.
max_year: Maximum year of data to include in the analysis.
rhs_list: List of independent variables to use.

ANN Parameters

grid_search: Set to True to perform a grid search for hyperparameter optimization.
TEST_SIZE: Proportion of data to allocate for the test set.
VAL_SIZE: Proportion of data to allocate for the validation set.
NEURONS_PER_LAYER: Number of nodes in each layer of the ANN.
NUMBER_OF_LAYER: Number of layers in the ANN.
ACTIVATION: Activation function for the ANN (e.g., ReLU, sigmoid).
EPOCH: Number of training epochs for the ANN.

Usage

Configure the input parameters in your script or a configuration file.
Run the program with the desired settings to analyze trade flows and generate outputs for Gravity Models and ANNs.

Authors

About

This repository provides a tool for analyzing trade flows using Gravity Models and Artificial Neural Networks (ANNs) in wood markets. It supports flexible configuration, allowing users to customize input parameters, data selection, and model settings.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages