-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrecommendation_system_ai.py
More file actions
33 lines (18 loc) · 941 Bytes
/
recommendation_system_ai.py
File metadata and controls
33 lines (18 loc) · 941 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import numpy as np
from lightfm.datasets import fetch_movielens # movielens is a data set of 100k real movie ratings
from lightfm import LightFM # lightfm performs recommendation algorithm
# fetching data and formatting it
data = fetch_movielens(min_rating = 4.0) # CSV file
# the fetch_movielens method will create an INTERACTION MATRIX from
# our CSV file and store it in our data variable as a DICTIONARY
# print-training and testing
print(repr(data["print"]))
print(repr(data["test"]))
# our fetch_movielens method splits our data set into 'training' and 'testing' data
# and we can retrieve each by using the 'train' and 'test'strings as KEYS (dictionary keys)
# we printed out both above
# todo: install lightfm again, run the code, store our model in a variable
# RUN ATTEMPT 1
# ERROR: LightFM was compiled without OpenMP support.
# POSSIBLE CAUSE: WINDOWS OS AND MULTI-THREADING
# POSSIBLE SOLUTION: USING DOCKER (?)