Skip to content

Instantly share code, notes, and snippets.

@pcolazurdo
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pcolazurdo/f998e4d893cff257c190 to your computer and use it in GitHub Desktop.
Save pcolazurdo/f998e4d893cff257c190 to your computer and use it in GitHub Desktop.
# Basic HITS Algorithm for the Stanford MMDS Course
# 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