Last active
August 29, 2015 14:10
-
-
Save pcolazurdo/f998e4d893cff257c190 to your computer and use it in GitHub Desktop.
# Basic HITS Algorithm for the Stanford MMDS Course
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
# Basic HITS Algorithm for the Stanford MMDS Course | |
import numpy as np | |
# L = [[ 0.,1.,1.,1.,0.], [1.,0.,0.,1.,0.], [0.,0.,0.,0.,1.], [0.,1.,1.,0.,0.], [0.,0.,0.,0.,0.]] | |
L = [[0,1,1,0],[1,0,0,0],[0,0,0,1],[0,0,1,0]] | |
Lt = np.transpose(L) | |
h = np.matrix([1.,1.,1.,1.]).T | |
for i in range(1,3): | |
a = np.dot(Lt,h) | |
a = np.dot(a,1/a.max()) | |
#print a | |
h = np.dot(L,a) | |
h = np.dot(h,1/h.max()) | |
#print h | |
print h #Hubiness |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment