https://github.com/michalredm/dm-project2
This repository contains the code for the second project for Data Mining classes at the Poznań University of Technology, created by the team Kung Fu Pandas.
https://github.com/michalredm/dm-project2
movie rating-prediction
Last synced: over 1 year ago
JSON representation
This repository contains the code for the second project for Data Mining classes at the Poznań University of Technology, created by the team Kung Fu Pandas.
- Host: GitHub
- URL: https://github.com/michalredm/dm-project2
- Owner: MichalRedm
- License: mit
- Created: 2024-05-22T11:43:32.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-05T21:01:02.000Z (about 2 years ago)
- Last Synced: 2025-01-15T10:34:13.264Z (over 1 year ago)
- Topics: movie, rating-prediction
- Language: Python
- Homepage:
- Size: 1.77 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DM-project2
[](https://github.com/MichalRedm/DM-project2/actions/workflows/python-package.yml)
[](https://opensource.org/licenses/MIT)
This repository contains the code for the second project for Data Mining classes at the Poznań University of Technology. The code in this repository has been created by the team *Kung Fu Pandas*, consisting of:
- [Piotr Balewski](https://github.com/PBalewski),
- [Adam Dobosz](https://github.com/addobosz),
- [Wiktor Kamzela](https://github.com/Wector1),
- [Michał Redmer](https://github.com/MichalRedm).
The general purpose of the code in this repository is to predict ratings given by different users for movies in the [Movie Lens dataset](https://grouplens.org/datasets/movielens/).
## Prequisities
To run the code from this repository, you need to have the following installed on your computer:
- [Python](https://www.python.org/downloads/) (version 3.10 or higher).
Additionally, to run code samples in the file `samples.ipynb` [Jupyer Notebook](https://jupyter.org/install) is needed (the file can alternatively be opened in [Google Colaboratory](https://colab.research.google.com/)).
## Setup
To download the respository to your local computer run the following command:
```
$ git clone https://github.com/MichalRedm/DM-project2.git
```
Then, you need to install all the Python dependencies. It is recommended to use [Python virtual environment](https://docs.python.org/3/library/venv.html) and install the necessary packages on it instead of installing them globally.
```
$ pip install -r requirements.txt
```
Since the files containing Movie Lens dataset are quite large, they are not stored on the repository. Instead, they can be pulled from the Movie Lens dataset website with the following script:
```
$ python download_data.py
```
Once this is done, you are ready to run the code.
## Rating prediction
The file `dm_project2/predict.py` is responsible for predicting a rating for a given user-movie pair and a given dataset:
```
$ python dm_project2/predict.py
```
Name of the dataset should be either `ml-latest-small` or `ml-latest`.
Example:
```
$ python dm_project2/predict.py 1 1 ml-latest-small
Predicted rating for movie "Toy Story (1995)" and user with userId=1: 4.432912849776076 (rounded: 4.5)
```
## Testing the results
To test how well our method works, use the script `dm_project2/test.py`.
```
python dm_project2/test.py
```
Name of the dataset should be either `ml-latest-small` or `ml-latest`; however, testing on the larger dataset is not recommended, as it is very slow and requires high computational power.
Example:
```
$ python dm_project2/test.py ml-latest-small 10000
Model MSE: 0.8084 (standarized: 0.7450)
Baseline MSE: 0.9664 (standarized: 0.8906)
```
## Code samples
To have some insight into how our function for data preprocessing operates, visit the file [samples.ipynb](https://github.com/MichalRedm/DM-project2/blob/main/dm_project2/samples.ipynb).