This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="jquery-2.1.1.min.js"></script> | |
<!-- template --> | |
<table> | |
<tbody> | |
<tr> | |
<td></td> | |
<td><div class='h'>12a</div></td> | |
<td><div class='h'>1a</div></td> | |
<td><div class='h'>2a</div></td> | |
<td><div class='h'>3a</div></td> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import copy | |
with open('/Users/wy/Desktop/hw2dataset/graph_1.txt','r') as f: | |
tl=[] | |
f = f.readlines() | |
for s in f: | |
s=s.rstrip() | |
s=s.split(',') | |
tl.append(s[0]) | |
tl.append(s[1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import copy | |
with open('/Users/wy/Desktop/hw2dataset/graph_3.txt','r') as f: | |
tl=[] | |
f = f.readlines() | |
for s in f: | |
s=s.rstrip() | |
s=s.split(',') | |
tl.append(s[0]) | |
tl.append(s[1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
# normalize 歸一化 sum(0)為每一點被連接點個數的陣列 | |
def normalize(G): | |
s = G.sum(0) | |
return G/s | |
''' | |
simrank 公式: | |
S = C*(W^T ∙ S ∙ W)+(1-C) ∙ I | |
S 相似度陣列 | |
C 阻尼係數 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import numpy as np | |
def proEdge(g,l): | |
for t in l: | |
t = t.split(',') | |
i = int(t[0]) | |
j = int(t[1]) | |
if i > 0: | |
if g[i-1][j]==1: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%pylab inline | |
import math | |
import random | |
import numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
class point: | |
def __init__(self,dimension,pmin,pmax): | |
self.feature = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import numpy as np | |
class point: | |
def __init__(self,vfeature,vlabel): | |
self.feature = vfeature | |
self.label = vlabel | |
class cluster: | |
def __init__(self,numbercluster): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 產生data List , data List為兩年份 | |
def date(): | |
month31=[1,3,5,7,8,10,12] | |
month30=[4,6,9,11] | |
year2=['2013','2014'] | |
nday31=range(1,32) | |
nday30=range(1,31) | |
nday28=range(1,29) | |
day10=['01','02','03','04','05','06','07','08','09'] | |
month12=day10+['10','11','12'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import numpy as np | |
# 關鍵字所屬分類 P P S S T T | |
# 新聞 分類 賓士 寶馬 籃球 路跑 手機 App | |
# ---------------------------------------------- | |
# C63發表會 P 15 25 0 5 8 3 | |
# BMW i8 P 35 40 1 3 3 2 | |
# 林書豪 S 5 0 35 50 0 0 | |
# 湖人隊 S 1 5 32 15 0 0 | |
# Android 5.0 T 10 5 7 0 2 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
# linalg:Linear algebra | |
# 日式 中式 美式 泰式 韓式 | |
# --------------------------- | |
# sam 2 0 0 4 4 | |
#john 5 5 5 3 3 | |
# tim 2 4 2 1 2 | |
#以下矩陣可看此 user 對 item 進行評分 | |
#藉由協同過濾 猜出 sam對中式和美式的評價後,推薦sam吃什麼 |
OlderNewer