Skip to content

1kosmostars/Movie-Recommender

Repository files navigation

🎬 Movie Recommendation System

A Java-based movie recommendation engine using Weighted Cosine Similarity.
Given a movie or personal preferences, the system finds the 3 most similar movies from a CSV dataset.


📁 Project Structure

project/
├── movies.csv
├── lib/
│   └── junit-platform-console-standalone-1.10.0.jar
└── src/
    └── netflix/
        ├── Movie.java
        ├── CsvReader.java
        ├── RecommendationEngine.java
        ├── Main.java
        └── RecommendationEngineTest.java

⚙️ How It Works

Each movie is represented as a feature vector (values between 0.0 and 1.0).
The CSV file contains:

  • Row 1 – feature names (e.g. action, comedy, romance...)
  • Row 2 – feature weights (importance in the matching algorithm)
  • Row 3+ – movie name and its feature values

Similarity is calculated using Weighted Cosine Similarity:

  • Score of 1.0 = perfect match
  • Score of 0.0 = completely different

🚀 How to Run

Compile

javac -cp lib/junit-platform-console-standalone-1.10.0.jar -d out src/netflix/*.java

Run the program

java -cp out netflix.Main

Run tests

java -jar lib/junit-platform-console-standalone-1.10.0.jar --cp out --select-class=netflix.RecommendationEngineTest

🖥️ Menu Options

Option Description
1 Pick a movie from the list — get 3 similar movies
2 Rate features (0–5) — get 3 movies matching your taste
3 Exit

🧪 Unit Tests (RecommendationEngineTest)

Test Description
testIdenticalVectors Identical vectors must return similarity 1.0
testOrthogonalVectors Orthogonal vectors must return similarity 0.0
testWeightedSimilarity Higher weights must influence the final score
testLengthMismatch Mismatched vector lengths must throw IllegalArgumentException

🛠️ Requirements

  • Java 17+
  • JUnit Jupiter 5.10 (jar included in lib/)

📄 CSV Format

name,action,comedy,romance,sci-fi,horror
weights,0.8,0.5,0.4,0.7,0.6
The Matrix,0.9,0.1,0.2,1.0,0.3
Interstellar,0.6,0.1,0.5,1.0,0.2
...

About

Simple Movie Recommendation System

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages