A library and CLI tool for geodemographic classification using deep autoencoders.
Project description
DeepGeoDemo: Deep Embedding Geodemographics Made Simple
Overview
DeepGeoDemo makes it easy to build geodemographic classifications powered by deep embeddings. Configure your autoencoder in a simple YAML file and run the full pipeline from the command line, or import DeepGeoDemo as a Python library when you need more control.
Installation
The package is currently under development and can be installed from the repository. The package requires Python 3.12. The package can be installed using the following commands. This will install the package with the CPU dependencies --- i.e., the cpu version of PyTorch and scikit-learn for clustering.
Create a virtual environment, e.g. using conda.
conda create -n deepgeodemo python=3.12
conda activate deepgeodemo
Install the package via pip.
pip install deepgeodemo
Alternatively, the package can be installed with the GPU dependencies if available and RAPIDS for the clustering.
pip install --extra-index-url=https://pypi.nvidia.com deepgeodemo[gpu]
Usage
The commands below illustrate how to use the Command-Line Interface (CLI) to run the tool using the example configuration file example/example.yml and data (eight random blobs in sixteen dimensions). The -t flag is used to train the autoencoder and l to create the latent representation. The -s flag is used to search for the best k. The -c flag is used to run clustering using k-means. If available, the cuml backend is used for clustering. The -v flag is optional and is used to display the progress of the process.
Train the autoencoder.
deepgeodemo -tv example/example.yml
Create latent representation using on the previously trained autoencoder. Note that this will load a model from disk, and thus it will rais a warning message, as that can result in arbitrary code execution. Do it only if you got the file from a trusted source -- e.g., a model file you trained yourself, using the command above.
deepgeodemo -lv example/example.yml
Alternatively, you can train the autoencoder and create the latent representation in one go. In this case, the autoencoder will still be saved, but the latent representation will be created directly with the model in memory (rather than loading from the disk).
deepgeodemo -tlv example/example.yml
Run clustering in test mode to search for best k. Add -r for RAPIDS backend, default is scikit-learn.
deepgeodemo -sv example/example.yml
Run clustering using k-means. Add -r for RAPIDS backend, default is scikit-learn.
deepgeodemo -cv example/example.yml
Alternatively, you can run everything in one go as well.
deepgeodemo -tlscv example/example.yml
For a more concrete example, you can test the tool using the 2021 OAC data available from Jakub Wyszomierski's repo. Download the Clean data used to create the 2021 OAC, unzip the file and set the value of data: source to the location of one of the file datasets on your computer. It is advisable to normalise the data before training the autoencoder, e.g., using min-max scaling. Please increase the number of epochs and the number of clustering iteration to get meaninful results.
Unit Tests
If you want to run the unit tests, you can install the package in editable mode.
# Clone the repository
gh repo clone stefdesabbata/deepgeodemo
cd deepgeodemo
# Install the package
pip install -e .
Then run the tests.
python -m pytest tests/ -v
Acknowledgement
Many thanks to Owen Goodwin, Pengyuan Liu and Alex Singleton for their collaboration on this project and for testing the pre-alpha versions of the tool.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deepgeodemo-0.1.4.tar.gz.
File metadata
- Download URL: deepgeodemo-0.1.4.tar.gz
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df15e4d2e43706999ec49c3f6aecf7a2da41fa1fe449491c3fd782aa0ab0d053
|
|
| MD5 |
e970529ba516936a74cd1228512a6f9f
|
|
| BLAKE2b-256 |
243d30d6541ddd3c494dc025179f4da3d80ae141996e9d9ece8f646afb8235eb
|
Provenance
The following attestation bundles were made for deepgeodemo-0.1.4.tar.gz:
Publisher:
publish-to-pypi.yml on stefdesabbata/deepgeodemo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deepgeodemo-0.1.4.tar.gz -
Subject digest:
df15e4d2e43706999ec49c3f6aecf7a2da41fa1fe449491c3fd782aa0ab0d053 - Sigstore transparency entry: 1247214081
- Sigstore integration time:
-
Permalink:
stefdesabbata/deepgeodemo@12f3238bf7a88e31bfbfea7eb9f1f37fe7b3d789 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/stefdesabbata
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@12f3238bf7a88e31bfbfea7eb9f1f37fe7b3d789 -
Trigger Event:
push
-
Statement type:
File details
Details for the file deepgeodemo-0.1.4-py3-none-any.whl.
File metadata
- Download URL: deepgeodemo-0.1.4-py3-none-any.whl
- Upload date:
- Size: 24.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1e9bd8968bb4c7c5c3aa9bf46427d7c5edd1584317c4f0bcd1654909655331e
|
|
| MD5 |
f08f02e064ad0078b7911c78a4013a21
|
|
| BLAKE2b-256 |
03aa2f178b0c1036ff2f8d041295d108dbe06292769515e8c978796e08de3bae
|
Provenance
The following attestation bundles were made for deepgeodemo-0.1.4-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on stefdesabbata/deepgeodemo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deepgeodemo-0.1.4-py3-none-any.whl -
Subject digest:
d1e9bd8968bb4c7c5c3aa9bf46427d7c5edd1584317c4f0bcd1654909655331e - Sigstore transparency entry: 1247214096
- Sigstore integration time:
-
Permalink:
stefdesabbata/deepgeodemo@12f3238bf7a88e31bfbfea7eb9f1f37fe7b3d789 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/stefdesabbata
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@12f3238bf7a88e31bfbfea7eb9f1f37fe7b3d789 -
Trigger Event:
push
-
Statement type: