Official Implementation of Mobility-Embedded POIs: Learning What A Place Is and How It Is Used from Human Movement
The code was developed with Python 3.13.2. From the repository root, install the dependencies:
python -m pip install -r requirements.txtBefore running either script, update config.json with paths for your data and
embeddings. In particular, check data_path, file_name, emb_path,
anchor_path, city, and save_dir. The configured paths may need to be
changed from the example paths in this repository.
Pretraining loads the visit dataset, text embeddings, and anchor data specified
in config.json. Run it from the repository root:
python run_pretrain.pySet pretraining_strategy to CL or MLM in config.json. When
save_pretrained_model is true, the resulting POI embeddings are written to
emb_path/poi_embeds.pt.
Evaluation fine-tunes and evaluates POI embeddings for the downstream task in
config.json. Run it after pretraining (or after providing a compatible
emb_path/poi_embeds.pt):
python run_eval.pyThe supported values for downstream_task are open_hours, and
is_closed. All three tasks use labels from the processed SafeGraph
dataset.
Evaluation also loads the text embedding files for the model names defined in
run_eval.py (e5, gtr-t5, gemini, nomic, mpnet, openai-large, and
openai-small) from emb_path.