Skip to content

Commit

Permalink
Actualización
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan2125 committed Mar 4, 2024
1 parent 4a977ab commit afd2fb1
Show file tree
Hide file tree
Showing 15 changed files with 308 additions and 200 deletions.
14 changes: 7 additions & 7 deletions 06-api-funciones.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -363,25 +363,25 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[{'Puesto 1': 'Ubisoft Montreal', 'recomendaciones': 3},\n",
" {'Puesto 2': 'Nadeo', 'recomendaciones': 2},\n",
" {'Puesto 3': 'Maxis™', 'recomendaciones': 2}]"
"[{'Puesto 1': 'The Behemoth', 'recomendaciones': 3},\n",
" {'Puesto 2': 'Daedalic Entertainment', 'recomendaciones': 3},\n",
" {'Puesto 3': 'Flying Wild Hog', 'recomendaciones': 2}]"
]
},
"execution_count": 11,
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Ejemplo de uso\n",
"año_ejemplo = 2008\n",
"año_ejemplo = 2012\n",
"resultado_ejemplo = UsersRecommend(año_ejemplo)\n",
"resultado_ejemplo\n"
]
Expand Down
195 changes: 70 additions & 125 deletions 07-modelo_recomendacion.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -47,132 +47,12 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>user_id</th>\n",
" <th>item_name</th>\n",
" <th>rating</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>76561197970982479</td>\n",
" <td>Killing Floor</td>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>evcentric</td>\n",
" <td>Risk of Rain</td>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>doctr</td>\n",
" <td>The Wolf Among Us</td>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>maplemage</td>\n",
" <td>Dark Souls: Prepare to Die Edition</td>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Wackky</td>\n",
" <td>LEGO® MARVEL Super Heroes</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>44087</th>\n",
" <td>76561198107177722</td>\n",
" <td>BattleBlock Theater</td>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>44088</th>\n",
" <td>kushikushigani</td>\n",
" <td>LEGO® Worlds</td>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>44089</th>\n",
" <td>76561198111410893</td>\n",
" <td>Unturned</td>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>44090</th>\n",
" <td>zaza147</td>\n",
" <td>Fistful of Frags</td>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>44091</th>\n",
" <td>lifeonhigh</td>\n",
" <td>Trove</td>\n",
" <td>3</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>44092 rows × 3 columns</p>\n",
"</div>"
],
"text/plain": [
" user_id item_name rating\n",
"0 76561197970982479 Killing Floor 3\n",
"1 evcentric Risk of Rain 4\n",
"2 doctr The Wolf Among Us 4\n",
"3 maplemage Dark Souls: Prepare to Die Edition 3\n",
"4 Wackky LEGO® MARVEL Super Heroes 2\n",
"... ... ... ...\n",
"44087 76561198107177722 BattleBlock Theater 4\n",
"44088 kushikushigani LEGO® Worlds 3\n",
"44089 76561198111410893 Unturned 3\n",
"44090 zaza147 Fistful of Frags 4\n",
"44091 lifeonhigh Trove 3\n",
"\n",
"[44092 rows x 3 columns]"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"modelo = pd.read_parquet('data/10-modelo-recomend.parquet')\n",
"modelo"
"item_similar = pd.read_parquet('data/13-item-similar.parquet')"
]
},
{
Expand Down Expand Up @@ -1395,7 +1275,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -1522,6 +1402,71 @@
"pq.write_table(pa.Table.from_pandas(item_similar), 'data/13-item-similar.parquet')\n",
"print('Se guardaron correctamente')"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"def recomendacionJuego(juego):\n",
" '''\n",
" Esta función muestra una lista de juegos similares a un juego dado.\n",
"\n",
" Parameters:\n",
" ----------\n",
" juego (str): El nombre del juego para el cual se desean encontrar juegos similares.\n",
"\n",
" Returns:\n",
" ----------\n",
" juegos_similares: Esta función imprime una lista de juegos 5 similares al dado.\n",
"\n",
" Pasos:\n",
" ----------\n",
" \n",
"Verificamos si el juego está en el DataFrame de similitud\n",
"Obtenemos la lista de juegos similares y mostrarlos\n",
"Imprimimos la lista de juegos similares\n",
"\n",
" '''\n",
"\n",
" # Paso 1\n",
" if juego not in item_similar.index:\n",
" print(f'No se encontraron juegos similares para {juego}.')\n",
" return\n",
"\n",
" # Paso 2\n",
" similar_juegos = item_similar.sort_values(by=juego, ascending=False).index[1:6] # Mostrar siempre los primeros 5\n",
"\n",
" # Paso 3\n",
" juegos_similares = [item for item in similar_juegos]\n",
"\n",
" return juegos_similares\n"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['Tap Heroes',\n",
" 'Counter-Strike: Condition Zero',\n",
" 'S.T.A.L.K.E.R.: Call of Pripyat',\n",
" 'World of Soccer online',\n",
" 'Hearts of Iron III']"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"recomendacion_juego('Age of Empires II: HD Edition')"
]
}
],
"metadata": {
Expand Down
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Imagen
FROM python:3.11.8

# directorio de trabajo de la app
WORKDIR /app

# Copia los requerimientos del anfitrion
COPY requirements.txt ./requirements.txt

# Instala los requerimientos
RUN pip install -r requirements.txt

# Copia todo lo del anfitrion (clonado de github)
COPY . .

# Argumentos para el comando entrypoint
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80"]
1 change: 1 addition & 0 deletions api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# repo-Deploy
Binary file removed api/data/05-ranking-genero.parquet
Binary file not shown.
Binary file modified api/data/08-user-time-year.parquet
Binary file not shown.
Binary file removed api/data/11-piv-norm.parquet
Binary file not shown.
Loading

0 comments on commit afd2fb1

Please sign in to comment.