项目作者: adrianmarino

项目描述 :
Tourism recommendation system
高级语言: Jupyter Notebook
项目地址: git://github.com/adrianmarino/recommendations-toy-example.git


Tourism recommendation system

A toy example.

Requirements

Setup project

Step 1: Create conda environment to run project notebook.

  1. conda env create -f environment.yml

Step 2: Enable installed environment.

  1. conda activate tourism-recommendation-system

Step 3: Install a upyter extension required to support a progress bar in a notebook.

  1. jupyter labextension install @jupyter-widgets/jupyterlab-manager

Getting started Notebook

Step 1: Enable installed environment.

  1. conda activate tourism-recommendation-system

Step 2: run jupyter lab IDE:

  1. jupyter lab

Step 3: Open toy-example jupyter notebook.

Note: Can use query browser from http://localhost:7474.

Getting started API

Step 1: Enable installed environment.

  1. conda activate tourism-recommendation-system

Step 2: Start api server.

  1. ./start-api

Step 3: Query trends and recommendations.

More purchased hotels in last 60 days

  1. curl -X GET "http://localhost:8080/api/recommendations/hotels/more-purchased?time-window=60" | json_pp
  1. {
  2. "hotels": [
  3. {
  4. "destination": "SLA",
  5. "name": "Posada Santana",
  6. "score": 4
  7. },
  8. {
  9. "destination": "RIO",
  10. "name": "Hakuna Matata Hotel Bar",
  11. "score": 3
  12. },
  13. {
  14. "destination": "RIO",
  15. "name": "Rio See Resort",
  16. "score": 3
  17. },
  18. {
  19. "destination": "BCN",
  20. "name": "Barcelona Hotel",
  21. "score": 2
  22. },
  23. {
  24. "destination": "MIA",
  25. "name": "Madagascar Palace",
  26. "score": 1
  27. }
  28. ]
  29. }

More searched hotels in last 60 days

  1. curl -X GET "http://localhost:8080/api/recommendations/hotels/more-searched?time-window=60" | json_pp
  1. {
  2. "hotels" : [
  3. {
  4. "destination" : "MIA",
  5. "score" : 23
  6. },
  7. {
  8. "destination" : "BCN",
  9. "score" : 20
  10. },
  11. {
  12. "destination" : "SLA",
  13. "score" : 15
  14. },
  15. {
  16. "destination" : "RIO",
  17. "score" : 10
  18. },
  19. {
  20. "destination" : "COR",
  21. "score" : 5
  22. }
  23. ]
  24. }

More purchased flights in last 60 days

  1. curl -X GET "http://localhost:8080/api/recommendations/flights/more-purchased?time-window=60" | json_pp
  1. {
  2. "flights" : [
  3. {
  4. "airline" : "LA",
  5. "destination" : "SLA",
  6. "score" : 3
  7. },
  8. {
  9. "airline" : "AA",
  10. "destination" : "RIO",
  11. "score" : 2
  12. },
  13. {
  14. "airline" : "LA",
  15. "destination" : "RIO",
  16. "score" : 2
  17. },
  18. {
  19. "airline" : "EK",
  20. "destination" : "BCN",
  21. "score" : 1
  22. },
  23. {
  24. "airline" : "AA",
  25. "destination" : "MIA",
  26. "score" : 1
  27. }
  28. ]
  29. }

More purchased flights in last 60 days

  1. curl -X GET "http://localhost:8080/api/recommendations/flights/more-searched?time-window=60" | json_pp
  1. {
  2. "flights": [
  3. {
  4. "destination": "SLA",
  5. "score": 42
  6. },
  7. {
  8. "destination": "BCN",
  9. "score": 25
  10. },
  11. {
  12. "destination": "RIO",
  13. "score": 25
  14. },
  15. {
  16. "destination": "MIA",
  17. "score": 16
  18. },
  19. {
  20. "destination": "COR",
  21. "score": 5
  22. }
  23. ]
  24. }

Recommended hotels for users that bought flights for a given destination in last 60 days

  1. curl -X GET "http://localhost:8080/api/recommendations/cross-selling/hotels?email=adrian.marino@almundo.com&time-window=60" | json_pp
  1. {
  2. "hotels": [
  3. {
  4. "city": "SLA",
  5. "id": "8",
  6. "name": "Posada Santana",
  7. "score": 4
  8. },
  9. {
  10. "city": "RIO",
  11. "id": "12",
  12. "name": "Hakuna Matata Hotel Bar",
  13. "score": 3
  14. },
  15. {
  16. "city": "RIO",
  17. "id": "10",
  18. "name": "Rio See Resort",
  19. "score": 2
  20. },
  21. {
  22. "city": "MIA",
  23. "id": "2",
  24. "name": "See Palace Resort",
  25. "score": 1
  26. },
  27. {
  28. "city": "RIO",
  29. "id": "11",
  30. "name": "Pipa Hotel",
  31. "score": 1
  32. }
  33. ]
  34. }

Recommended airlines for users that bought hotels in a given city in last 60 days

  1. curl -X GET "http://localhost:8080/api/recommendations/cross-selling/airlines?email=adrian.marino@almundo.com&time-window=60" | json_pp
  1. {
  2. "airlines": [
  3. {
  4. "destination": "SLA",
  5. "name": "LATAM",
  6. "score": 3
  7. },
  8. {
  9. "destination": "RIO",
  10. "name": "American Airlines",
  11. "score": 2
  12. },
  13. {
  14. "destination": "RIO",
  15. "name": "LATAM",
  16. "score": 2
  17. },
  18. {
  19. "destination": "MIA",
  20. "name": "American Airlines",
  21. "score": 1
  22. }
  23. ]
  24. }