Dan6erbond / jolt

The social hub for your media server. Rate, review and recommend movies and shows, as well as manage your watchlist, follow friends and more.
MIT License
167 stars 3 forks source link

More Sophisticated Movie Recommendation Algorithm and Database Structure #10

Open Dan6erbond opened 1 year ago

Dan6erbond commented 1 year ago

What is the problem?

Since recommended movies are fetched from TMDB's movie recommendations API, and scored by the ratings given to their source movie, scores can easily be inflated by having them appear in lots of movies' recommendations.

Solution

The following models could improve the recommendation algorithm by using a normalized scoring system based on averages of the associated ratings:

type Suggestion struct {
  gorm.Model
  MediaType         string  // movies or tvs
  MediaID           uint
  UserID            uint
  SuggestionSources []SuggestionSource
}

func (s *Suggestion) Score() {
  return AvgScore(s.SuggestionSources)
}

type SuggestionSource struct {
  gorm.Model
  SuggestionID uint
  Suggestion   Suggestion
  MediaType    string
  MediaID      uint
  ReviewID     uint
  Review       Review
}

func (s *SuggestionSource) Score() {
  return s.Review.Rating
}