Coder Social home page Coder Social logo

dmunasingha / trip-recommendation-algorithm Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 3 KB

A PHP-based tool that recommends new trips based on the tags of trips the user has previously visited. The system filters out trips that the user has already explored and suggests new trips with similar tags, ensuring personalized recommendations aligned with the user's known interests.

PHP 100.00%
alrogithm personalization php recommendation-system tag-based travel

trip-recommendation-algorithm's Introduction

Trip Recommendation System

Overview

This PHP-based Trip Recommendation System suggests new trips to users based on the tags of trips they have previously visited. The system filters out trips with tags not associated with the user’s known preferences and avoids recommending trips that the user has already visited.

Features

  • Tag-Based Recommendations: Recommends trips based on tags from trips the user has visited.
  • Excludes Visited Trips: Avoids recommending trips the user has already visited.
  • Customizable: Easily modify the list of trips and user data.

Requirements

  • PHP 7.0 or higher
  • Basic knowledge of PHP

Installation

  1. Clone the Repository

    git clone https://github.com/dmunasingha/Trip-Recommendation-Algorithm
    cd Trip-Recommendation-Algorithm
  2. Set Up Your Environment

    Ensure PHP is installed and configured on your system. No additional packages are required beyond PHP.

Usage

  1. Define Your Trips

    Edit the $trips array in recommendation.php to include your trips data. Each trip should have an id and a list of tags.

    $trips = [
        ['id' => 1, 'tags' => ['beautiful', 'hot', 'sunny']],
        ['id' => 2, 'tags' => ['cold', 'beautiful']],
        ['id' => 3, 'tags' => ['sunny', 'hot']],
        ['id' => 4, 'tags' => ['cold', 'snowy']],
    ];
  2. Set User Visits

    Update the $userVisitedTrips array with the IDs of trips the user has visited.

    $userVisitedTrips = [1, 3];
  3. Run the Script

    Execute the PHP script from the command line:

    php recommendation.php
  4. View Recommendations

    The script will output recommended trip IDs and details based on the tags of trips the user has previously visited.

Functions

  • calculateTagSimilarity($tags1, $tags2): Computes similarity between two sets of tags.
  • filterTripsByUserTags($trips, $userTags, $visitedTrips): Filters trips based on user tags and excludes visited trips.
  • recommendTrips($trips, $userTags, $visitedTrips): Generates recommendations by calculating tag similarity and excluding visited trips.

Example Output

Array
(
    [0] => 2
    [1] => 4
)
Array
(
    [id] => 2
    [tags] => Array
        (
            [0] => cold
            [1] => beautiful
        )
)
Array
(
    [id] => 4
    [tags] => Array
        (
            [0] => cold
            [1] => snowy
        )
)

Contribution

Feel free to contribute to this project by submitting issues or pull requests. Please ensure to follow the code of conduct and contribution guidelines.

License

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

Contact

For any inquiries, please contact [email protected].


trip-recommendation-algorithm's People

Contributors

dmunasingha avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.