Commit 7d65e3ba authored by Kumarasinghe S.M's avatar Kumarasinghe S.M

Update user navigating system/content-based-filtering.py, user navigating system/member.csv files

parent 1ae1e2bb
# -*- coding: utf-8 -*-
"""Untitled0.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1azOWgncdssP40BQnyGVyxkVsYf2ZtNuJ
"""
import pandas as pd
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer
df = pd.read_csv('member.csv')
tfidf = TfidfVectorizer(stop_words='english')
df['des'] = df['des'].fillna("")
tfidf_matrix = tfidf.fit_transform(df['des'])
from sklearn.metrics.pairwise import linear_kernel
cs = linear_kernel(tfidf_matrix, tfidf_matrix)
indices = pd.Series(df.index, index=df['occ']).drop_duplicates()
indices
def get_reco(title, cs = cs):
idx = indices[title]
ss = enumerate(cs[idx])
ss = sorted(ss, key=lambda x: x[1], reverse=True)
ss = ss[0:3]
si = [i[0]for i in ss]
print(df['occ'].iloc[si])
get_reco('tattoo artist')
occ,des,,
tattoo artist,tattoo based in Colombo,,
fashion designer,"fashion, model, designer",,
tattoo professional,tattoo artist based in Colombo,,
graphic designer,mbbnb,,
teacher,b nb n nb ,,
doctor,jhjhvjhvjhjhvjhv,,
,,,
,,,0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment