Travel Purpose Prediction Library
Project description
TravelPurpose: Travel Intent & Classification (Phase 2)
TravelPurpose is a specialized library for analyzing travel data, predicting trip purposes (Business, Leisure, etc.) using AI, and tagging city destinations. Phase 2 introduces advanced explainability and ambiguity scoring using Shannon entropy.
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
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
travelpurpose-2.2.0.tar.gz
(46.6 kB
view details)
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 travelpurpose-2.2.0.tar.gz.
File metadata
- Download URL: travelpurpose-2.2.0.tar.gz
- Upload date:
- Size: 46.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e42abcaa720bc1c6b73eb8dbdcabbba4800c85e12b853e8c9c147461a92aadc
|
|
| MD5 |
bbe6d57d152be4914fb1b9d99a6f9840
|
|
| BLAKE2b-256 |
b86a7a718b7629c03853a82a693ce933e9fd6cdc4440ccacfa21379b3a7cda66
|
File details
Details for the file travelpurpose-2.2.0-py3-none-any.whl.
File metadata
- Download URL: travelpurpose-2.2.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12c0f62daaeb4352a5edb0a7a8bc2dcbf1a7eb392e275ac311437f3741583bcb
|
|
| MD5 |
2dfcff00416f278d7bfd6b24ec798bf5
|
|
| BLAKE2b-256 |
60b4bbf1225be56a843cf6dc65c1b398c7535d17283a395e566879ab290c3060
|