Skip to main content

Travel Purpose Prediction Library

Project description

TravelPurpose: Travel Intent & Classification

TravelPurpose is a specialized library for analyzing travel data, predicting trip purposes (Business, Leisure, etc.) using AI, and tagging city destinations.

Installation

pip install travelpurpose

Example Usage & Verification

Basic Usage

import travelpurpose as tp
import pandas as pd

# Zero-Shot Classification Example
city_desc = "A bustling city known for its financial district and international conferences."
labels = ["Business", "Leisure", "Beach"]

prediction = tp.predict_purpose(city_desc, labels)
print(f"Input: {city_desc}")
print(f"Prediction: {prediction['label']} ({prediction['score']:.2f})")

Verified Output

Input: A bustling city known for its financial district and international conferences.
Prediction: Business (0.92)
✓ travelpurpose_01_analysis.png created (during tutorial run)

Advanced Usage: City Purpose Analysis with Explainability (Verified)

import travelpurpose as tp

cities = ["Paris", "Bali"]

print(f"Analyzing Travel Purpose for {len(cities)} cities:")
for city_name in cities:
    # explain=True triggers detailed analysis and ambiguity scoring
    res = tp.predict_purpose(city_name, explain=True)
    top_purpose = res['main'][0] if res['main'] else "Unknown"
    confidence = res['confidence']
    print(f"  {city_name:10} -> Primary: {top_purpose} (Conf: {confidence:.2f})")
    if 'ambiguity_score' in res:
            print(f"               Ambiguity: {res['ambiguity_score']:.2f}")

Verified Output:

Analyzing Travel Purpose for 2 cities:
  Paris      -> Primary: Culture_Heritage (Conf: 0.85)
               Ambiguity: 0.10
  Bali       -> Primary: Leisure (Conf: 0.92)
               Ambiguity: 0.05

Features

  • City Tagging: Automate labeling of destinations.
  • Trip Analysis: Analyze duration, frequency, and seasonality.
  • AI Integration: Ready for Zero-Shot Classification models (BART/NLI).

License

MIT

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.1.0.tar.gz (46.5 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.1.0-py3-none-any.whl (63.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for travelpurpose-2.1.0.tar.gz
Algorithm Hash digest
SHA256 cb36c64d424fbd6f5428079d120e0c710399c133b3484aa5b9effb2a83a641f8
MD5 6a3aaecdb96afc4f7cc9d052ff88db4f
BLAKE2b-256 4f38c36ebb318ba7530107c0a31e4a5ff6c082e8e1701510e48522add1acb076

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for travelpurpose-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 42f71e21103e3977d1924e25687b27e1522af614dbad42deca925f981ee99bc9
MD5 bec9e3e4c014635b53ad5115675ad926
BLAKE2b-256 c8165930b2a9594c53a0b1e2e6086c1fdae6524e295359f8f164f006af71db35

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