GithubHelp home page GithubHelp logo

jpaulynice / demo-api-java-spring Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oatfin-os/demo-api-java-spring

0.0 1.0 0.0 0 B

Java and Spring demo API for the Oatfin platform.

Java 100.00%
java docker mahout mysql recommendation-engine spring

demo-api-java-spring's Introduction

Movie Recommendation Engine

Build Status Coverage Status

A simple movie recommendation engine based on Apache Mahout machine learning library. This is a Jersey REST API with persistence using Spring Data/Hibernate/JPA. Although it's a simple application, it is a real recommendation engine with data stored in a MySQL database.

The idea is simple. Given:

  1. A list of users
  2. A list of movies
  3. Similarity between movie 1 and movie 2
  4. Partial users' preferences for the movies

Recommend a set of movies that the user would enjoy.

Setup

  1. Install docker and docker-compose if not already installed brew install docker && brew install docker-compose
  2. run ./gradlew clean build -x test to skip tests
  3. optionally run ./gradlew clean build, update test.properties with correct username/password to local database
  4. run dockerdocker-compose up

On Startup, the application runs these 2 scripts under: src/main/resources/META-INF/data/sql :

  1. recreate tables
  2. populate data

Database schema:

REST API Example:

GET http://localhost:8080/movies/api/v1/users/2/recommendations?limit=2

API Response:

[
  {
    "genre": "DRAMA",
    "id": 4,
    "imdb_id": "tt0120338",
    "name": "titanic",
    "img": "http://ia.media-imdb.com/images/M/MV5BMjExNzM0NDM0N15BMl5BanBnXkFtZTcwMzkxOTUwNw@@._V1_SX300.jpg"
  },
  {
    "genre": "FAMILY",
    "id": 5,
    "imdb_id": "tt0317219",
    "name": "cars",
    "img": "http://ia.media-imdb.com/images/M/MV5BMTg5NzY0MzA2MV5BMl5BanBnXkFtZTYwNDc3NTc2._V1_SX300.jpg"
  }
]

Try an invalid user with id 9000:

GET http://localhost:8080/movies/api/v1/users/9000/recommendations?limit=2

Response:

{
    "status": 404,
    "info": "No user found with id: 9000",
    "requestId": "880a6889-3969-43dc-9de1-4692d69ff807"
}

demo-api-java-spring's People

Contributors

jpaulynice 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.