Skip to main content

Travel Purpose Prediction Library

Project description

🗺️ TravelPurpose: City Destination Intelligence

PyPI version License: MIT

TravelPurpose is a sophisticated library for classifying world cities by their travel persona and operational characteristics. By analyzing multi-dimensional city data, it identifies if a city is a "Business Hub," "Cultural Gem," "Adventure Paradise," or a seasonal mix of several purposes.


🌟 Vision

To enhance the personalization of travel platforms and urban planning by providing a deep, data-driven understanding of city personas and how they evolve over time.

🚀 Key Features

  • 🏷️ Multi-Label Classification: Cities aren't just one thing. Classify across multiple personas (e.g., Luxury + Cultural).
  • ⏳ Temporal Awareness: Understand how a city's primary purpose shifts across different seasons (e.g., Ibiza in Summer vs. Winter).
  • 🔎 XAI (Explainability): Get detailed insights into why a city was classified a certain way, including contributing markers.
  • 🧬 City Fingerprinting: Generate a unique "Purpose Signature" (radar-chart data) for every city on earth.
  • 🎲 Privacy-Safe Simulation: Generate synthetic city datasets for testing travel algorithms without using real personal data.

📦 Installation

pip install travelpurpose

🛠️ Premium Usage

1. Unified Facade (TravelPurpose)

The TravelPurpose class provides a modern, fluent interface for all features.

from travelpurpose import TravelPurpose

# Initialize the engine
tp = TravelPurpose()

# 1. Predict purpose with Explainability
result = tp.predict("Istanbul", explain=True)
print(f"City: {result.city_name}")
print(f"Primary Purpose: {result.purpose}")
print(f"Confidence: {result.confidence:.2f}")

# 2. Check XAI Markers
print("\n--- Key Markers ---")
for marker, weight in result.explanation.markers.items():
    print(f"- {marker}: {weight:.2f}")

# 3. Seasonal Awareness
winter_purpose = tp.predict("Alps", season="winter")
print(f"\nAlps Purpose (Winter): {winter_purpose.purpose}")

✅ Verified Output

City: Istanbul
Primary Purpose: cultural_monument
Confidence: 0.94

--- Key Markers ---
- historic_sites: 0.85
- culinary_diversity: 0.78
- bridge_of_continents: 0.92

Alps Purpose (Winter): adventure_ski

2. City Fingerprinting

Visualize the DNA of a city's travel persona.

from travelpurpose import TravelPurpose

tp = TravelPurpose()

# Get the unique signature for Paris
fingerprint = tp.get_fingerprint("Paris")

# Fingerprint contains 0-1 scores for all possible tags
print(f"Paris Signature:")
for tag, score in fingerprint.scores.items():
    if score > 0.5:
        print(f"  {tag}: {score:.2f}")

✅ Verified Output

Paris Signature:
  cultural_landmark: 0.98
  luxury_shopping: 0.92
  culinary_arts: 0.88
  romantic_escape: 0.95

📊 API Reference

TravelPurpose (Facade)

  • predict(city_name: str, explain: bool, season: str) -> Prediction: Core classification entry point.
  • get_fingerprint(name: str) -> CityFingerprint: Get the 12-dimensional purpose vector.
  • search(query: str) -> List[City]: Search the internal city knowledge base.
  • generate_synthetic_city() -> City: Create a randomized city for simulation.

Advanced Modules

  • ExplainabilityEngine: Provides the evidence-weighting behind every prediction.
  • TemporalEngine: Handles seasonal shift logic and climatology-purpose mapping.
  • SyntheticCityEngine: Generates realistic urban profiles for ML training.

⚙️ How it Works

TravelPurpose doesn't just look at names. It processes a fusion of:

  1. Linguistic Markers: Key terms and historical naming conventions.
  2. POI Density: Concentration of cultural, commercial, or natural landmarks.
  3. Temporal Flux: Climate and event data that shifts city appeal.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

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

travelpurpose-2.2.3.tar.gz (49.0 kB view details)

Uploaded Source

Built Distribution

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

travelpurpose-2.2.3-py3-none-any.whl (65.2 kB view details)

Uploaded Python 3

File details

Details for the file travelpurpose-2.2.3.tar.gz.

File metadata

  • Download URL: travelpurpose-2.2.3.tar.gz
  • Upload date:
  • Size: 49.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for travelpurpose-2.2.3.tar.gz
Algorithm Hash digest
SHA256 3356dfcb7451c36b710f13002be3a8f2870b3001d755c66f74e19dfb5815c31a
MD5 1958e9dd6427b6737837b8b51a233f5b
BLAKE2b-256 ef8fe6d4b4427e29931ffbf6dca673471d7f6e89d26c8d45e0981212cbc0ab4f

See more details on using hashes here.

File details

Details for the file travelpurpose-2.2.3-py3-none-any.whl.

File metadata

  • Download URL: travelpurpose-2.2.3-py3-none-any.whl
  • Upload date:
  • Size: 65.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for travelpurpose-2.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c91add09c42ec8be5e104cc1a4b267d8d0cfc44747d371e12c3dec643b960dea
MD5 e2f99d49bd638cb89ebffb94a9c60b47
BLAKE2b-256 24c3af7285f69cd788798c2a85847f93c49813b7015b2ec5170ab7f78496adae

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