[20140830, Pycon2014] NetworkX를 이용한 네트워크 분석Kyunghoon Kim
UNIST(유니스트)
NaturalScience Mathematical Sciences Kyunghoon Kim
자연과학부 수리과학과 김경훈
기본적인 네트워크 분석
Python Library NetworkX Tutorial Korean Version
http://www.pycon.kr/2014/program/7
Slideshare View 창에서는 슬라이드의 링크들이 모두 적용되지 않는 것 같습니다.
Save 하셔서 보시면 모든 링크들을 사용하실 수 있습니다.
19년 4월 1일, 서울대학교 SNCC와 공동 주최로 열린 논문 정보 수집과 연구 동향 분석 공개 세미나 발표 자료 입니다.
논문 정보를 수집할 수 있는 NetMiner 확장프로그램, Biblio Data Collector 에 대한 소개와 이를 활용한 분석 사례 소개로 구성되어 있습니다.
그리고 마지막 깜짝 발표, NetMiner 또 다른 확장프로그램 SNS Data Collector 의 업데이트 소식(인스타그램 수집)까지 보실 수 있습니다.
세미나 현장 영상 보기 >> https://www.youtube.com/channel/UCEyZjvgAc4uEIuHKRI5Jk0w
세미나 결과 보기 >> https://cyram.tistory.com
Predictions of links in graphs based on content and information propagations.
Lecture for the M. Sc. Data Science, Sapienza University of Rome, Spring 2016.
[20140830, Pycon2014] NetworkX를 이용한 네트워크 분석Kyunghoon Kim
UNIST(유니스트)
NaturalScience Mathematical Sciences Kyunghoon Kim
자연과학부 수리과학과 김경훈
기본적인 네트워크 분석
Python Library NetworkX Tutorial Korean Version
http://www.pycon.kr/2014/program/7
Slideshare View 창에서는 슬라이드의 링크들이 모두 적용되지 않는 것 같습니다.
Save 하셔서 보시면 모든 링크들을 사용하실 수 있습니다.
19년 4월 1일, 서울대학교 SNCC와 공동 주최로 열린 논문 정보 수집과 연구 동향 분석 공개 세미나 발표 자료 입니다.
논문 정보를 수집할 수 있는 NetMiner 확장프로그램, Biblio Data Collector 에 대한 소개와 이를 활용한 분석 사례 소개로 구성되어 있습니다.
그리고 마지막 깜짝 발표, NetMiner 또 다른 확장프로그램 SNS Data Collector 의 업데이트 소식(인스타그램 수집)까지 보실 수 있습니다.
세미나 현장 영상 보기 >> https://www.youtube.com/channel/UCEyZjvgAc4uEIuHKRI5Jk0w
세미나 결과 보기 >> https://cyram.tistory.com
Predictions of links in graphs based on content and information propagations.
Lecture for the M. Sc. Data Science, Sapienza University of Rome, Spring 2016.
Who to follow and why: link prediction with explanationsNicola Barbieri
Presentation @KDD 2014.
In this paper we study link prediction with explanations for user recommendation in social networks. For this problem we propose WTFW (“Who to Follow and Why”), a stochastic topic model for link prediction over directed and nodes-attributed graphs. Our model not only predicts links, but for each predicted link it decides whether it is a “topical” or a “social” link, and depending on this decision it produces a different type of explanation.
빅데이터 기술의 소프트웨어 공학 적용
1. 빅데이터 기술의 활용 사례 - 빅데이터 기술은 이미 많은 적용 사례를 가지고 있고, IoT 기술과 더불어 일상의 기술이 되어 가고 있다 (Pervasive & Invisible Analytics).
2. Spark 플랫폼 - 이전에 Hadoop으로 대표되는 빅데이터의 분산 처리 기술은 계속 발전하고 있고, Spark는 메모리 기반 데이터 처리로 기존 대비 성능을 10~100배 개선하였다. 특히, Spark는 Scala라는 함수형 언어로 구현되었고, 이전에 Java 기반의 빅데이터 처리 코드를 보다 명료하고 Compact하게 구현할 수 있다. 데이터 분석에는 Imperative 언어보다 함수형 언어가 보다 적합하다.
3. 소프트웨어 공학에서의 데이터 분석 사례 - 최근 Software Analytics, Repository Mining 등 데이터 분석 사례들이 있고, 최근 GitHub 이나 StackOverflow 분석과 같은 빅데이터 분석 연구들이 진행되고 있다.
4. Spark를 활용한 Word Count 예
5. Big Data Software Engineering - 큰 데이터 처리 외에도, 실시간 데이터 처리 (Velocity), 다양한 데이터 처리 (Variety) 부분에도 소프트웨어 공학 적용이 필요하다. 또한, Big Data Software를 Engineering하는 부분에도 관심이 필요하다. Big Data 분석 코드 역시 SE의 대상으로 바라보고, Test Driven Dev, Agile Methodology와 같은 개발 방법의 적용을 살펴볼 필요가 있다.
마지막으로, 현재 빅데이터 기술에 대한 진입 장벽은 많이 낮아졌고, 사용 가능한 오픈소스들이 많다. 소프트웨어 공학자라면 빅데이터 분석을 직접 시도해 볼 필요가 있고, 특히, Spark-Scala는 향 후 더욱 발전 확대될 기술이다.
오픈스택이 가진 기술에 대하여 설명합니다.
1. 오픈소스기반 OpenStack 클라우드 시스템
2. OpenStack 기술 개요 및 동향
3. OpenStack 의 Community 개발 체계
4. OpenStack HA를 위한 방안
5. OpenStack SDN 개발 동향
6. Neutron OVS-DPDK 가속화와 구현방안
Who to follow and why: link prediction with explanationsNicola Barbieri
Presentation @KDD 2014.
In this paper we study link prediction with explanations for user recommendation in social networks. For this problem we propose WTFW (“Who to Follow and Why”), a stochastic topic model for link prediction over directed and nodes-attributed graphs. Our model not only predicts links, but for each predicted link it decides whether it is a “topical” or a “social” link, and depending on this decision it produces a different type of explanation.
빅데이터 기술의 소프트웨어 공학 적용
1. 빅데이터 기술의 활용 사례 - 빅데이터 기술은 이미 많은 적용 사례를 가지고 있고, IoT 기술과 더불어 일상의 기술이 되어 가고 있다 (Pervasive & Invisible Analytics).
2. Spark 플랫폼 - 이전에 Hadoop으로 대표되는 빅데이터의 분산 처리 기술은 계속 발전하고 있고, Spark는 메모리 기반 데이터 처리로 기존 대비 성능을 10~100배 개선하였다. 특히, Spark는 Scala라는 함수형 언어로 구현되었고, 이전에 Java 기반의 빅데이터 처리 코드를 보다 명료하고 Compact하게 구현할 수 있다. 데이터 분석에는 Imperative 언어보다 함수형 언어가 보다 적합하다.
3. 소프트웨어 공학에서의 데이터 분석 사례 - 최근 Software Analytics, Repository Mining 등 데이터 분석 사례들이 있고, 최근 GitHub 이나 StackOverflow 분석과 같은 빅데이터 분석 연구들이 진행되고 있다.
4. Spark를 활용한 Word Count 예
5. Big Data Software Engineering - 큰 데이터 처리 외에도, 실시간 데이터 처리 (Velocity), 다양한 데이터 처리 (Variety) 부분에도 소프트웨어 공학 적용이 필요하다. 또한, Big Data Software를 Engineering하는 부분에도 관심이 필요하다. Big Data 분석 코드 역시 SE의 대상으로 바라보고, Test Driven Dev, Agile Methodology와 같은 개발 방법의 적용을 살펴볼 필요가 있다.
마지막으로, 현재 빅데이터 기술에 대한 진입 장벽은 많이 낮아졌고, 사용 가능한 오픈소스들이 많다. 소프트웨어 공학자라면 빅데이터 분석을 직접 시도해 볼 필요가 있고, 특히, Spark-Scala는 향 후 더욱 발전 확대될 기술이다.
오픈스택이 가진 기술에 대하여 설명합니다.
1. 오픈소스기반 OpenStack 클라우드 시스템
2. OpenStack 기술 개요 및 동향
3. OpenStack 의 Community 개발 체계
4. OpenStack HA를 위한 방안
5. OpenStack SDN 개발 동향
6. Neutron OVS-DPDK 가속화와 구현방안
Nnstreamer stream pipeline for arbitrary neural networksNAVER Engineering
In the recent decade, we have witnessed widespread of deep neural networks and their applications. With the evolution of consumer electronics, the range of applicable devices for such deep neural networks is expanding as well to personal, mobile, or even wearable devices. The new challenge of such systems is to efficiently manage data streams between sensors (cameras, mics, radars, lidars, and so on), media filters, neural network models and their post processors, and applications. In order to tackle the challenge with less effort and more effect, we propose to implement general neural network supporting filters for Gstreamer, which is actively developed and tested at https://github.com/nnsuite/nnstreamer
With NNStreamer, neural network developers may easily configure streams with various sensors and models and execute the streams with high efficiency. Besides, media stream developers can now use deep neural networks as yet another media filters with much less efforts.
– Elastic stack과 Data pipeline의 개념
– 데이터의 종류와 형태 / Document 데이터 모델링 (mapping, data type)
– 분산 데이터 저장소 관점에서의 Elasticsearch (index, shard & replica, segment)
https://learningspoons.com/course/detail/elastic-stack/
Next Normal - Humans and AI Collaborate: Toron AI and AI Perfumer
일시:❍ 2024.2.1.(목), 14:00~16:00
장소: 판교 테크노밸리 산업수학혁신센터 세미나실
경기 성남시 수정구 대왕판교로 815, 기업지원허브 231호 국가수리과학연구소
무료주차는 2시간 지원됩니다.
발표자: 김경훈 대표(코어닷투데이)
최근 인공지능(AI) 기술의 발전은 기존에 상상조차 하지 못했던 창의적이고 혁신적인 가능성을 제시하고 있습니다. 특히 생성형 AI는 텍스트, 이미지, 시계열 등 다양한 데이터 분야에서 인간과 유사한 창조력을 발휘하며 놀라운 성과를 이루고 있습니다. 이러한 맥락에서, 본 강연은 두 개의 발전된 AI 시스템, 토론 AI 김컴재와 AI 조향사 센트리아를 중심으로, 생성형 AI의 현재 상황과 미래에 대해 논의하며, 다음의 두 가지 사항을 고려합니다. 첫째, 토론 AI 김컴재와 AI 조향사 센트리아의 대화와 토론을 통해 생성형 AI가 우리 사회와 산업에 미치는 영향과 가능성을 탐색합니다. 이를 통해 생성형 AI의 기술적 진보와 그로 인해 생겨난 새로운 기회를 이해합니다. 둘째, 생성형 AI의 윤리적, 사회적 측면에 대해 조명합니다. 무엇보다 생성형 AI의 발전이 미치는 영향과 이에 대한 사회적 대응은 무엇보다 중요한 논의 주제입니다. 이를 통해 생성형 AI의 위험과 제약사항, 그리고 이를 극복하기 위한 방안을 탐색합니다. 본 강연은 생성형 AI의 미래를 선도할 기술적 혁신과 사회적 대응 방안을 고민해 보고, 유익한 통찰과 함께 뜻깊은 논의의 기회를 제공합니다.
How the machine understands Korean
기계와 대화를 하려면 어떻게 해야 할까요? 우리는 그 동안 기계가 이해할 수 있는 프로그래밍 언어를 만들어서, 그 언어를 통해 소통해 왔습니다. 하지만 2010년 들어서며 급물살을 탄 AI 연구는 이러한 소통의 영역까지 침투하여, 기계가 인간의 언어를 이해하고, 소통할 수 있는 단계로 다가서고자 노력하고 있습니다. 그 근간에는 선형대수학의 여러 이론들이 사용되고 있는데요, 특히 인간의 언어를 기호화하고 이를 벡터공간에 투영하는 방법들이 핵심으로 여겨지고 있습니다. 이러한 방법을 임베딩(embedding)이라 지칭하고, 단어부터 문장, 문서에 이르기까지 인간의 언어를 다양한 형태로 벡터화하고, 이를 이용해 언어의 의미 유사성, 관계 유사성 등을 벡터 공간에서 벡터 연산을 통해 내재적인 의미를 도출합니다.
이번 세미나에서는 벡터공간모델(Vector Space Model, VSM)의 전통적인 방법(TF-IDF, SVD 등)부터 신경망 방법(word2vec, sent2vec 등)에 이르는 다양한 언어 모델링들을 살펴보고, 이를 한국어에 적용했을 때 기계가 어떻게 의미를 이해하는 것으로 해석할 수 있는지 다양한 관점에서 실험을 통해 살펴보도록 하겠습니다.
신문이나 뉴스를 보다보면 본 적이 없다고 할 수 없는 게 인공지능이란 단어가 아닌가 싶습니다. 인공지능이 이렇게 대두되기 까지는 기계학습, 얕은학습, 깊은학습 등이 혼재 되어 그 성장을 이끌었다고 할 수 있습니다. 이번 발표에서는 그러한 개념들에 대한 특징과 연결고리, 구분되는 차이점에 대해 이해하고, 그간의 발전해 온 애플리케이션들을 살펴봅니다. 특히, 기계학습에서 다섯 종족(Tribes)이라 불리는 기호주의자(Symbolists), 연결주의자(Connectionists), 진화주의자(Evolutionaries), 베이즈 주의자(Bayesians), 유추주의자(Analogizers)의 철학과 성격을 살펴보고, 각 종족이 갖는 영향력을 논의합니다. 또한 인공지능을 4단계로 구분하여, 기계를 학습시키는 연구들이 어떻게 인공지능에 받아들여 졌는지 지능과 관련지어 논의해 보겠습니다. 이후 시간이 허락한다면 앞으로의 인공지능의 발전 방향과 예측되는 불확실한 미래에 대해 논의할 예정입니다.
Naive bayes Classification using Python3Kyunghoon Kim
If the text on the screen of slideshare is broken, please download the PDF.
Chapter 1. Bayes Rule
Chapter 2. Classification
Chapter 3. Bayes & Classification
Chapter 4. Naive Bayes Classification
If the text on the screen of slideshare is broken, please download the PDF.
Chapter 1. Drawing / Matplotlib
- Ex1. Temperature graph
Chapter 2. Bayes Rule
- Ex1. A Family with two children
- Ex2. Testing for a rare disease
- Ex3. M&M problem
- Ex4. Monty Hall problem
[20160813, PyCon2016APAC] 뉴스를 재미있게 만드는 방법; 뉴스잼Kyunghoon Kim
https://www.pycon.kr/2016apac/program/1
How to make news fun?
Slideshare의 폰트 인식 문제로 인해 위 파일은 이미지 PDF로 업로드 되어 있습니다.
텍스트가 선택되는 PDF의 다운로드는 아래 링크를 이용하세요.
https://github.com/pythonkr/pyconapac-2016-files/raw/master/20160813-101-1-KimKyunghoon.pdf
1. 상암동 누리꿈스퀘어
NetworkX를 이용한 네트워크 링크 예측
김경훈
유니스트 수리과학과
kyunghoon@unist.ac.kr
2015년 8월 29일
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 1 / 68
2. 이번 TALK의 목적
1 데이터 조종의 자유로움
2 아이디어 구현의 자유로움
3 융합의 자유로움
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 2 / 68
3. About me
Speaker
김경훈 (대학원생)
UNIST (Ulsan National Institute of Science and Technology)
자연과학부 수리과학과
Lab
Adviser : Bongsoo Jang
Homepage : http://amath.unist.ac.kr
“Be the light that shines the world with science and technology.”
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 3 / 68
4. 도수 중심성 (Degree Centrality)
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 4 / 68
5. 매개 중심성 (Betweenness Centrality)
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 5 / 68
6. 목차
1 PyCon2014 피드백
K-means Algorithm
얼마나 큰 행렬을 다룰 수 있나요?
네트워크 공부를 위한 기본 서적
2 링크를 예측하기 위한 준비 운동
NumPy
Pandas
3 네트워크 링크 예측
네트워크 링크 예측이란?
네트워크 링크 예측의 매력
4 데모
ipython과 d3.js
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 6 / 68
8. K-means Algorithm
from sklearn import cluster
k = 2
kmeans = cluster.KMeans(n_clusters=k)
kmeans.fit(data)
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 8 / 68
10. 얼마나 큰 행렬을 다룰 수 있나요?
NetworkX는 기본 네트워크 구조로 “dictionary of dictionaries of
dictionaries”를 사용
dict-of-dicts-of-dicts 자료 구조의 장점:
Find edges and remove edges with two dictionary look-ups.
Prefer to “lists” because of fast lookup with sparse storage.
Prefer to “sets” since data can be attached to edge.
G[u][v] returns the edge attribute dictionary.
n in G tests if node n is in graph G.
for n in G: iterates through the graph.
for nbr in G[n]: iterates through neighbors.
https://networkx.github.io/documentation/latest/reference/introduction.html
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 10 / 68
11. 얼마나 큰 행렬을 다룰 수 있나요?
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 11 / 68
12. 얼마나 큰 행렬을 다룰 수 있나요?
Million-scale Graphs Analytic Frameworks
SNAP : http://snap.stanford.edu/snappy/index.html
Billion-scale Graphs Analytic Frameworks
Apache Hama : https://hama.apache.org/ (소개글)
Pegasus : http://www.cs.cmu.edu/~pegasus/
s2graph : https://github.com/daumkakao/s2graph (슬라이드)
Graph Database
Neo4j : http://neo4j.com/
OrientDB : http://orientdb.com/
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 12 / 68
13. 네트워크 공부를 위한 기본 서적
1 Networks: An Introduction by Mark Newman
2 링크 : 21세기를 지배하는 네트워크 과학 LINKED The New Science of Networks
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 13 / 68
14. 링크를 예측하기 위한 준비 운동
1 NumPy : 계산 속도에 최적화된 모듈
2 Pandas : 데이터 구조
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 14 / 68
15. NumPy: Numerical Python
다차원 배열
1 근접 메모리를 사용하고, C언어로 구성됨
2 하나의 데이터 타입
3 연산이 한 번에 배열 내의 모든 요소에 적용됨
http://www.numpy.org/
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 15 / 68
16. NumPy: Numerical Python
tic = timeit.default_timer()
for index, value in enumerate(b):
b[index] = value*1.1
toc = timeit.default_timer()
print toc-tic
1.82178592682
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 16 / 68
17. NumPy: Numerical Python
import numpy as np
import timeit
a = np.arange(1e7)
b = list(a)
tic = timeit.default_timer()
a = a*1.1
toc = timeit.default_timer()
print toc-tic
0.029629945755
사용 방법에 따라, ndarray의 연산 속도는 list()보다 훨씬 빠름.
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 17 / 68
18. Pandas: Python Data Analysis Library
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 18 / 68
19. Pandas / get data yahoo
%pylab inline
import pandas as pd
import pandas.io.data
import datetime
start=datetime.datetime(2015,1,1); end=datetime.datetime(2015,8,26)
text = """A, AAPL, AMCC, AMD, AMGN, AMKR, AMNT.OB, AMZN, APC, ASOG.P
text = text.replace(’ ’, ’’).split(’,’)
corps = []
for t in text:
if ’.’ not in t:
corps.append(t)
Code : https://goo.gl/8ddrnS
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 19 / 68
20. Pandas / get data yahoo
df = pd.io.data.get_data_yahoo(corps, start=start, end=end)
df[’Adj Close’].head()
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 20 / 68
21. Pandas / Return Value
returns = df[’Adj Close’].pct_change()
corr = returns.corr()
corr
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 21 / 68
22. Pandas / Correlation
bm = corr>0.5
bm.astype(int)
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 22 / 68
23. Pandas / Convert to array
mat = bm.astype(int).values
mat
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 23 / 68
24. NetworkX / from numpy matrix
import networkx as nx
graph = nx.from_numpy_matrix(mat)
graph = nx.relabel_nodes(graph, dict(enumerate(bm.columns)))
nx.draw(graph, with_labels=True)
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 24 / 68
26. NetworkX / figsize
first = sorted(nx.connected_components(graph),
key=len, reverse=True)[0]
G = graph.subgraph(first)
nx.draw(G, with_labels=True)
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 26 / 68
27. NetworkX / 결국 Gephi에서 작업?
nx.write_gexf(G, ’graph.gexf’)
Gephi에서 gexf 열기
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 27 / 68
33. mecab api
import Umorpheme.morpheme as um
from collections import OrderedDict
s = ’유니스트는 울산에 있습니다’
server = ’http://information.center/api/korean’
apikey = ’’ # Register at http://information.center/korean
data = um.analyzer(s, server, apikey, ’유니스트,UNIST’, 1)
temp =
for key, value in data.items():
temp[int(key)] = value
data = OrderedDict(sorted(temp.items()))
for i, j in data.iteritems():
print i, j[’data’], j[’feature’]
0 유니스트 CUSTOM
1 는 JX
2 울산 NNP
3 에 JKB
4 있 VV
5 습니다 EC
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 33 / 68
34. Pandas에 대한 자세한 내용은..
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 34 / 68
35. 링크 예측이란?
사회망(social networks)에서 링크 예측이란
지금의 네트워크에서 빠진 링크를 예측하는 것
미래의 네트워크에서 새롭게 나타나거나 사라질 링크를 예측하는 것
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 35 / 68
38. 링크 예측 연구 상황
키워드 “link prediction social network”
Wang, Peng, et al. ”Link prediction in social networks: the state-of-the-art.” Science China Information Sciences 58.1 (2015):
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 38 / 68
39. 네트워크 링크 예측의 매력
1 추천 시스템
친구 추천 (12’)
공동저자 추천 (07’)
온라인 쇼핑몰의 상품 추천 (11’)
특허 추천 (13’)
타분야 협력자 추천 (12’)
연락처 추천 (11’)
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 39 / 68
40. 네트워크 링크 예측의 매력
2 복잡계 연구
네트워크 진화 연구 (02’)
웹사이트 링크 예측 (02’)
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 40 / 68
41. 네트워크 링크 예측의 매력
3 다양한 분야에 적용
헬스케어 (12’)
단백질 네트워크 (12’)
비정상적 커뮤니케이션 확인 (09’)
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 41 / 68
42. 네트워크 링크 예측
사회망
G(V , E) at t
에 대해,
링크가 생기거나 사라지는 것을 (t′ > t)
빠진 링크나 관찰되지 않은 링크가 있는 것을 (at t)
찾아내는 것.
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 42 / 68
43. 링크 예측 프레임워크
Wang, Peng, et al. ”Link prediction in social networks: the state-of-the-art.”
Science China Information Sciences 58.1 (2015): 1-38.
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 43 / 68
45. 링크 예측의 세분화
Wang, Peng, et al. ”Link prediction in social networks: the state-of-the-art.”
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 45 / 68
46. 링크 예측의 세분화
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 46 / 68
47. 링크 예측의 기본 정의
Γ(x) : 점 x의 이웃들의 집합
|Γ(x)| : 점 x의 이웃들의 개수
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 47 / 68
48. 공통 이웃들
공통 이웃들(Common Neighbors):
CN(u, v) = |Γ(u) ∩ Γ(v)|
본 그래프는 실제가 아닌 가상으로 설정된 상황임을 알려드립니다
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 48 / 68
49. 리소스 할당 지수
리소스 할당 지수(Resource Allocation Index):
w∈Γ(u)∩Γ(v)
1
|Γ(w)|
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 49 / 68
50. 리소스 할당 지수
리소스 할당 지수(Resource Allocation Index):
w∈Γ(u)∩Γ(v)
1
|Γ(w)|
preds = nx.resource_allocation_index(G)
for u, v, p in preds:
print ’(%s, %s) -> %.8f’ % (u, v, p)
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 50 / 68
51. 리소스 할당 지수
(수지, 혜리) -> 0.33333333
(수지, 경훈) -> 0.83333333
(아이유, 민호) -> 1.00000000
(혜리, 민호) -> 0.00000000
(혜리, 경훈) -> 0.33333333
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 51 / 68
52. 리소스 할당 지수
w∈Γ(u)∩Γ(v)
1
|Γ(w)|
(수지, 혜리) -> 0.33333333
(수지, 경훈) -> 0.83333333
(아이유, 민호) -> 1.00000000
(혜리, 민호) -> 0.00000000
(혜리, 경훈) -> 0.33333333
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 52 / 68
53. 한국어 표시하기
pip install --upgrade
git+https://github.com/koorukuroo/networkx_for_unicode
import matplotlib.font_manager as fm
fp1 = fm.FontProperties(fname="./NotoSansKR-Regular.otf")
nx.set_fontproperties(fp1)
G = nx.Graph()
G.add_edge(u’한국어’,u’영어’)
nx.draw(G, with_labels=True)
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 53 / 68
54. 선호적 연결
선호적 연결(Preferential attachment):
|Γ(u)||Γ(v)|
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 54 / 68
55. 선호적 연결
nx.draw_networkx_nodes(G, pos, node_size=500, node_color=’yellow’)
nx.draw_networkx_edges(G, pos, alpha=0.2)
nx.draw_networkx_labels(G, pos, font_size=20);
selected_lines = []
for u in G.nodes_iter():
preds = nx.preferential_attachment(G, [(u, v) for v in nx.non_neighbors(G, u)])
largest = heapq.nlargest(5, preds, key = lambda x: x[2])
for l in largest:
selected_lines.append(l)
subG = nx.Graph()
for line in selected_lines:
print line[0], line[1], line[2]
if line[2]>1:
subG.add_edge(line[0], line[1])
pos_subG = dict()
for s in subG.nodes():
pos_subG[s] = pos[s]
nx.draw_networkx_edges(subG, pos_subG, edge_color=’red’)
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 55 / 68
57. 선호적 연결
degree = nx.degree_centrality(G)
nx.draw_networkx_nodes(G, pos, node_color=’yellow’, nodelist=degree.keys(),
node_size=np.array(degree.values())*10000)
nx.draw_networkx_edges(G, pos, alpha=0.2)
nx.draw_networkx_labels(G, pos, font_size=20);
selected_lines = []
for u in G.nodes_iter():
preds = nx.preferential_attachment(G, [(u, v) for v in nx.non_neighbors(G, u)])
largest = heapq.nlargest(5, preds, key = lambda x: x[2])
for l in largest:
selected_lines.append(l)
subG = nx.Graph()
for line in selected_lines:
print line[0], line[1], line[2]
if line[2]>1:
subG.add_edge(line[0], line[1])
pos_subG = dict()
for s in subG.nodes():
pos_subG[s] = pos[s]
nx.draw_networkx_edges(subG, pos_subG, edge_color=’red’)
김경훈 (UNIST) NetworkX with Link Prediction 2015년 8월 29일 57 / 68