Skip to main content

GeoEvo

Project description

GeoEvo

A software for Geographic Evolutionary Multi-Task Optimization Framework for Automated Hyperparameter Tuning on Spatially Stratified Machine Learning Models (GeoEvo).

Introduction

The rapid growth of spatial data across various fields has made data-driven machine learning (ML) methods increasingly essential for spatial analysis. However, the performance of ML methods heavily depends on hyperparameter tuning (HPT), which becomes particularly challenging when dealing with spatial stratified heterogeneity (SSH). SSH causes significant variability in statistical characteristics across sub-regions, requiring separate local models. Traditional HPT methods either apply uniform hyperparameters or treat each model independently, ignoring spatial associations between adjacent models. To address this gap, we propose a geographic evolutionary multi-task optimization framework (GeoEvo) that leverages spatial associations for collaborative HPT of local ML models under SSH. GeoEvo formulates a multi-task constrained single objective optimization problem to jointly optimize hyperparameters across multiple local models. The framework introduces a geographic proximity differential evolution operator (Geo-DE) to enable collaboration among spatially adjacent models and a geographic selection operator (Geo-SL) to promote hyperparameter sharing, improving resource utilization and accelerating convergence.

Potential Application Scenarios

  • Hyperparameter Tuning for Multiple Spatially Localized Models
    Ideal for scenarios with Spatially Stratified Heterogeneity (SSH), including:

    • Climate zone-specific weather prediction models
    • Real estate price forecasting across urban sub-regions
    • Traffic flow analysis with road network segmentation
    • Agricultural yield prediction in heterogeneous soil regions
  • Algorithmic Extensions for Spatial Optimization
    The framework's evolutionary mechanisms can be adapted to:

    • Distributed urban infrastructure layout optimization
    • Ecological monitoring network sensor deployment
    • Collaborative planning systems for logistics distribution routes

Installation:

$ pip install geoevo

Dependencies

  • matplotlib: 3.7.1
  • numpy: 2.2.1
  • pandas: 2.2.3
  • scikit-learn: 1.3.0
  • scipy: 1.14.1

Example

A complete example for using this software can be found at the folder './src/geoevo/example.py' with data.

Simplified step

1.Import package:

from geoevo import GeoEvoOptimizer
import pandas as pd

2.Load data:

train_df = pd.read_csv('xxx') # training dataset
val_df = pd.read_csv('xxx') # validation dataset
adjmat = pd.read_csv('xxx') # 2D array of spatial adjacent matrix
zoneslist = ['1','2'] # list of region identifier (e.g., ['zone1', 'zone2'])

3.Define problem:

bounds = [(100,500), (1,len(feature_name))] # the range of hyperparameters
dim = len(bounds)
def objfunc(zone_data, zone_val, param):
    ### User-define objective function ###

4.Initialize algorithm

popsize = 50 # population size
its = 100 # iteration times
cpu = 1 # Number of CPU cores for parallel processing
optimizer = GeoEvoOptimizer(popsize, its, dim, objfunc, cpu, zoneslist, adjmat, True)

5.Start optimization and output results

best_param, best_obj = optimizer.optimize(bounds, train_df, val_df)
print(f'The best hyperparameter is\n {best_param}\n with objective value\n {best_obj}')

Citations

If this software is useful for your research or application, please cite our paper:

default

We also recommend our previous works below as basis models for GeoEvo:

Cheng, S., Zhang, W., Luo, P., Wang, L., & Lu, F. (2024). An explainable spatial interpolation method considering spatial stratified heterogeneity. International Journal of Geographical Information Science, 39(3), 600–626. https://doi.org/10.1080/13658816.2024.2426067

Acknowledgement

The example data is from an open dataset:

Poeplau, C., Don, A., Flessa, H., Heidkamp, A., Jacobs, A., Prietz, R., 2020. Erste Bodenzustandserhebung Landwirtschaft  Kerndatensatz. https://doi.org/10.3220/DATA20200203151139

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geoevo-0.0.3.tar.gz (151.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geoevo-0.0.3-py3-none-any.whl (152.5 kB view details)

Uploaded Python 3

File details

Details for the file geoevo-0.0.3.tar.gz.

File metadata

  • Download URL: geoevo-0.0.3.tar.gz
  • Upload date:
  • Size: 151.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for geoevo-0.0.3.tar.gz
Algorithm Hash digest
SHA256 59bd1bf132147d0e8825f1e04b290bea88deb8ba8cf235d899be2db2a306eeb8
MD5 059451adab6384a9b86c0901abd92a6f
BLAKE2b-256 3ab08723e79417c32897e4a179ff6dd1d747ca59b4b56ccd081d4a3c7c5d6990

See more details on using hashes here.

File details

Details for the file geoevo-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: geoevo-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 152.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for geoevo-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 80afd1a7d698a8619fb9f9963b528c54aa2330f7c3e546dc48207ef16258fcfb
MD5 80d5fb64e51224bb0462cf693b5c3ab1
BLAKE2b-256 c6f6ad885b663ccbcaec6c35b4b490e06ef4ea0f910bb598b5dde97d6dfe4b79

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page