{ "cells": [ { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "b3vIWjxfy4uB" }, "source": [ "\n", "
\n", "# **Chapter 4 | 추천시스템**\n", "참고사이트 : https://www.machinelearningplus.com/nlp/cosine-similarity/\n", "## **1 데이터 불러오기**" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": {}, "colab_type": "code", "id": "_-fO8fCqy4uD" }, "outputs": [], "source": [ "! apt-get update\n", "! apt-get install g++ openjdk-8-jdk \n", "! pip3 install nltk konlpy matplotlib gensim \n", "\n", "! apt-get install fonts-nanum-eco\n", "! apt-get install fontconfig\n", "! fc-cache -fv\n", "! cp /usr/share/fonts/truetype/nanum/Nanum* /usr/local/lib/python3.6/dist-packages/matplotlib/mpl-data/fonts/ttf/\n", "! rm -rf /content/.cache/matplotlib/*" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 72 }, "colab_type": "code", "id": "nBagMLpZzEyD", "outputId": "57224cf2-c10e-4148-e7d7-3f5bf539d896" }, "outputs": [], "source": [ "import nltk\n", "nltk.download('wordnet')\n", "\n", "import pandas as pd\n", "import io, requests\n", "url = \"https://raw.githubusercontent.com/YongBeomKim/nltk_basic/master/data/movies_metadata.csv\"\n", "response = requests.get(url).content\n", "movies = pd.read_csv(io.StringIO(response.decode('utf-8')),\n", " usecols=['original_title', 'overview', 'title'], low_memory=False)\n", "movies = movies.dropna(axis=0)\n", "movies.shape" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 138 }, "colab_type": "code", "id": "anzxC1Kxy4uH", "outputId": "c9d4aee2-a4eb-4e43-bae1-7abe04e80f8f" }, "outputs": [], "source": [ "movie_plot_li = movies['overview']\n", "movie_info_li = movies['title']\n", "movies.head(3)" ] } ], "metadata": { "colab": { "collapsed_sections": [], "name": "04-Recommand.ipynb", "provenance": [], "version": "0.3.2" }, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.3" } }, "nbformat": 4, "nbformat_minor": 2 }