Skip to content

Commit

Permalink
added Project folder
Browse files Browse the repository at this point in the history
  • Loading branch information
ektmf7890 committed Jan 16, 2021
1 parent da2d80d commit b3730d3
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 11 deletions.
114 changes: 103 additions & 11 deletions .ipynb_checkpoints/Content_Based-checkpoint.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"from ast import literal_eval"
]
Expand Down Expand Up @@ -97,7 +98,9 @@
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -275,6 +278,47 @@
"print(f'CountVectorizer가 찾은 장르 갯수: {len(cv.get_feature_names())}')"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['action',\n",
" 'adventure',\n",
" 'animation',\n",
" 'comedy',\n",
" 'crime',\n",
" 'documentary',\n",
" 'drama',\n",
" 'family',\n",
" 'fantasy',\n",
" 'fiction',\n",
" 'foreign',\n",
" 'history',\n",
" 'horror',\n",
" 'movie',\n",
" 'music',\n",
" 'mystery',\n",
" 'romance',\n",
" 'science',\n",
" 'thriller',\n",
" 'tv',\n",
" 'war',\n",
" 'western']"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cv.get_feature_names()"
]
},
{
"cell_type": "code",
"execution_count": 8,
Expand Down Expand Up @@ -324,7 +368,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -334,7 +378,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 11,
"metadata": {},
"outputs": [
{
Expand All @@ -355,7 +399,7 @@
" 1. ]])"
]
},
"execution_count": 14,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -366,7 +410,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 12,
"metadata": {},
"outputs": [
{
Expand All @@ -375,7 +419,7 @@
"(4803, 4803)"
]
},
"execution_count": 15,
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -386,11 +430,61 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"def get_recommend_movie_list(df, movie_title, top=30):\n",
"titles = data['title']\n",
"indices = pd.Series(data.index, index=data['title'])\n",
"\n",
"def get_recommend_movie_list(title, top=30):\n",
" index = indices[title]\n",
" sim_scores = list(enumerate(similartiy_matrix[index]))\n",
" sim_scores = sorted(sim_scores, key=lambda x: x[1], reverse=True)\n",
" sim_scores = sim_scores[1:top+1]\n",
" movie_indices = [i[0] for i in sim_scores]\n",
" return titles.iloc[movie_indices]"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"5 Spider-Man 3\n",
"9 Batman v Superman: Dawn of Justice\n",
"Name: title, dtype: object"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"get_recommend_movie_list('Pirates of the Caribbean: At World\\'s End',2 )"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "unexpected EOF while parsing (<ipython-input-15-3ff715fddfb5>, line 3)",
"output_type": "error",
"traceback": [
"\u001b[1;36m File \u001b[1;32m\"<ipython-input-15-3ff715fddfb5>\"\u001b[1;36m, line \u001b[1;32m3\u001b[0m\n\u001b[1;33m \u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m unexpected EOF while parsing\n"
]
}
],
"source": [
"# 사용자에게 영화 리뷰를 입력받고 추천 리스트를 출력해주는 함수\n",
"def recommend():\n",
" "
]
},
Expand All @@ -399,9 +493,7 @@
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def "
]
"source": []
}
],
"metadata": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 4
}
32 changes: 32 additions & 0 deletions ProjectFolder/TripRecommender.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"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.8.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
20 changes: 20 additions & 0 deletions Recommender.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,23 @@
#코사인 유사도 계산
from sklearn.metrics.pairwise import cosine_similarity
similartiy_matrix = cosine_similarity(c_vector_genres, c_vector_genres)

titles = data['title']
indices = pd.Series(data.index, index=data['title'])

def get_recommend_movie_list(title, top=30):
index = indices[title]
sim_scores = list(enumerate(similartiy_matrix[index]))
sim_scores = sorted(sim_scores, key=lambda x: x[1], reverse=True)
sim_scores = sim_scores[1:top+1]
movie_indices = [i[0] for i in sim_scores]
return titles.iloc[movie_indices]

# 사용자에게 영화 리뷰를 입력받고 추천 리스트를 출력해주는 함수
def recommend():
print("킁")


if __name__ == '__main__':
recommend()

1 change: 1 addition & 0 deletions 이혜림_crawling.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
driver = webdriver.Chrome(ChromeDriverManager().install())
driver.implicitly_wait(25)

search_list = []

#main
for i in range(6, 12):
Expand Down

0 comments on commit b3730d3

Please sign in to comment.