Skip to content

Instantly share code, notes, and snippets.

@fitomad
Created February 18, 2020 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fitomad/a88b82b2c0857c81400c5dbcb8aea895 to your computer and use it in GitHub Desktop.
Save fitomad/a88b82b2c0857c81400c5dbcb8aea895 to your computer and use it in GitHub Desktop.
...
# Creamos el modelo
model = tc.recommender.item_similarity_recommender.create(training_data,
user_id='user_id',
item_id='show_id')
# Series similares a Stranger Things
recommendations = model.get_similar_items(items=[ 66732 ])
...
#
# Y aquí la recomendación si te ha gustado Stranger Things
#
+---------+---------+--------------------+------+----------------+------+
| show_id | similar | score | rank | name | year |
+---------+---------+--------------------+------+----------------+------+
| 66732 | 1396 | 0.6000000238418579 | 1 | Breaking Bad | 2008 |
| 66732 | 60573 | 0.5 | 5 | Silicon Valley | 2014 |
| 66732 | 65494 | 0.3999999761581421 | 6 | The Crown | 2016 |
| 66732 | 87108 | 0.375 | 7 | Chernobyl | 2019 |
| 66732 | 71446 | 0.375 | 8 | Money Heist | 2017 |
| 66732 | 63247 | 0.3333333134651184 | 9 | Westworld | 2016 |
| 66732 | 42009 | 0.3333333134651184 | 10 | Black Mirror | 2011 |
+---------+---------+--------------------+------+----------------+------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment