The Areal Embedding-based Masked Multihead Attention-based Spatial Interpolation (AMMASI) is a cutting-edge framework aimed at predicting house prices by employing advanced spatial interpolation techniques. Building on the foundational work of ASI as presented by Viana et al. (2021), this repository introduces significant enhancements through the integration of masked multihead attention mechanisms.
This document elucidates the necessary procedures for setting up, executing, and interpreting the functionalities embedded in the AMMASI repository. Researchers and practitioners are encouraged to adhere meticulously to the prescribed steps to ensure fidelity to the intended experimental protocols.
- Operating System: Linux, macOS, or Windows (preferably Unix-based for compatibility).
- Memory: Minimum of 8 GB RAM (16 GB recommended).
- Processor: Multi-core processor (preferably with GPU support for enhanced computation).
- Disk Space: At least 10 GB of free disk space.
The repository leverages Python-based deep learning frameworks and spatial analysis tools. Prior to execution, ensure that the following dependencies are installed:
- Python Version: Python 3.8 or above.
- Required Libraries:
numpypandastorchtorchvisionscikit-learnmatplotlibseaborntqdm
For optimal performance, it is highly recommended to execute this framework on a system equipped with:
- GPU: NVIDIA GPUs with CUDA support.
- CUDA Toolkit: Version 11.0 or higher.
Upon extraction, the repository manifests the following directory structure:
AMMASI-main/
|-- asi_norm
|-- datasets
|-- figs
|-- mycode
|-- notebooks
|-- README.md
|-- train_model_norm.py
asi_norm/: Contains preprocessed datasets and normalization scripts.datasets/: Stores raw and prepared datasets.figs/: Includes visualizations and experimental results.mycode/: Houses implementation scripts and utility functions.notebooks/: Jupyter notebooks for exploratory data analysis and experimentation.train_model_norm.py: The main script to train the AMMASI model.
To initiate the process, clone the repository from the source or place the provided zip file into your working directory.
# Clone via GitHub
git clone <repository-url>
cd AMMASI-mainEstablish a Python virtual environment to avoid dependency conflicts:
# Create and activate a virtual environment
python3 -m venv ammasi_env
source ammasi_env/bin/activate
# Install dependencies
pip install -r requirements.txtIf the requirements.txt file is unavailable, manually install dependencies:
pip install numpy pandas torch torchvision scikit-learn matplotlib seaborn tqdmEnsure that the dataset files are placed under the datasets/ directory. The original dataset can be accessed from the ASI repository.
Use scripts in the asi_norm/ directory to normalize data as required.
# Example normalization command
python asi_norm/normalize.py --input datasets/raw_data.csv --output datasets/normalized_data.csvExecute the main training script to initiate the model training process:
python train_model_norm.py --config config.json--config: Path to the configuration file specifying hyperparameters and dataset details.--gpu: Enable GPU-based acceleration (default:True).
Post-training, the results can be evaluated and visualized using the scripts provided in the notebooks/ directory. Open a Jupyter notebook environment to explore the results interactively:
# Start Jupyter Notebook
jupyter notebook
# Navigate to notebooks/ for evaluation scriptsThe figs/ directory contains graphical representations of the model’s performance, including:
- Performance Comparison: Benchmark metrics against the baseline ASI model.
- Areal Embedding Visualizations: Intuitive depictions of the areal embedding process.
- Loss Curves: Training and validation loss plots to assess model convergence.
-
Dependency Issues:
- Verify Python version compatibility.
- Check for missing libraries and install as necessary.
-
Dataset Not Found:
- Ensure the dataset is placed in the
datasets/directory. - Confirm the dataset file paths in the configuration file.
- Ensure the dataset is placed in the
-
Performance Degradation:
- Validate hardware acceleration using the
torch.cuda.is_available()function. - Experiment with hyperparameters in
config.json.
- Validate hardware acceleration using the
If you use this repository in your research, kindly cite:
@article{viana2021asi,
title={ASI: Areal Spatial Interpolation for House Price Prediction},
author={Viana, Author},
year={2021}
}
This repository draws inspiration from the original ASI framework. We extend our gratitude to the authors for their foundational work.
Areal embedding based Masked Multihead Attention-based Spatial Interpolation for House Price Prediction
Improved on top of ASI [Viana2021].
Original data is uploaded in ASI.
- ASI with HA is the result from [Viana2021]
- ASI with HA+P is the result recorded in notebooks/{dname}/Training-norm.ipynb
※ The file name 'norm' has nothing to do with poi. Sorry for confusion.
In asi_norm/input_dataset.py (line 49):
def __call__(self):
assert isinstance(self.id_dataset, object)
data = np.load(PATH + '/datasets/'+ self.id_dataset + '/data_poi.npz', allow_pickle=True)
- Full results are reported in mycode/prediction/make_table-AMMASI.ipynb
- You can also check mycode/test_logs for the full experiment logs.
- You can also refer to ablation study (Fig.5).
[Viana2021] Viana, Darniton, and Luciano Barbosa. "Attention-based spatial interpolation for house price prediction." Proceedings of the 29th International Conference on Advances in Geographic Information Systems. 2021.





