이분 그래프와 추천 시스템

Python 중급 네트워크 분석

Eric Ma

Data Carpentry instructor and author of nxviz package

추천 시스템

  • 이전: 사용자 간 연결 추천
  • 그래프: "단일 파트"(사용자 전용) 버전
  • 이제: "이분"(저장소-사용자) 버전
  • 사용자가 작업할 저장소 추천
Python 중급 네트워크 분석

추천 시스템

ch1-3.007.png

Python 중급 네트워크 분석

추천 시스템

ch1-3.008.png

Python 중급 네트워크 분석

추천 시스템

ch1-3.009.png

Python 중급 네트워크 분석

코드: 노드 집합

list(G.nodes(data=True))
[('repo3', {'bipartite': 'repositories'}),
 ('repo1', {'bipartite': 'repositories'}),
 ('user1', {'bipartite': 'users'}),
 ('user2', {'bipartite': 'users'}),
 ('repo2', {'bipartite': 'repositories'}),
 ('user3', {'bipartite': 'users'})]
list(G.edges())
[('repo1', 'user3'),
 ('user1', 'repo2'),
 ('user2', 'repo2'),
 ('repo2', ‘user3')]
Python 중급 네트워크 분석

코드: 노드 집합

user1_nbrs = G.neighbors('user1')

user1_nbrs
['repo2']
user3_nbrs = G.neighbors('user3')
user3_nbrs
['repo2', 'repo1']
Python 중급 네트워크 분석

코드: 노드 집합

set(user1_nbrs).intersection(user3_nbrs)
{'repo2'}
set(user3_nbrs).difference(user1_nbrs)
{'repo1'}
Python 중급 네트워크 분석

연습해 봅시다!

Python 중급 네트워크 분석

Preparing Video For Download...