Permalink
Browse files

Merge branch 'master' of github.com:courserecommender/courserecommender

  • Loading branch information...
2 parents a733abc + 66ce268 commit 2d6494a954187aeb1d481fd4607980c97814c571 @josePhoenix josePhoenix committed Apr 7, 2012
Showing with 10 additions and 3 deletions.
  1. +0 −1 courserecommender/cluster.py
  2. +10 −2 courserecommender/models.py
@@ -17,7 +17,6 @@ def centroidify(cluster):
average_rankings.append(Ranking(course_id = course_id, value = average))
return User(rankings = average_rankings)
-
def cos_similarity(a, b):
a_rankings = a.rankings
@@ -4,7 +4,7 @@
from sqlalchemy.orm import backref, relationship, sessionmaker
Base = declarative_base()
-from sqlalchemy import Column, ForeignKey, Integer, String
+from sqlalchemy import Column, ForeignKey, Integer, String, Text
def init(url):
engine = create_engine(url, echo=True)
@@ -28,6 +28,8 @@ class User(Base, Store):
id = Column(Integer, primary_key=True)
username = Column(String)
+ cluster_id = Column(Integer)
+ cluster = relationship("Cluster", backref=backref("users"))
class Ranking(Base, Store):
__tablename__ = 'rankings'
@@ -46,4 +48,10 @@ def find_all_by_user_ids(klass, user_ids):
class Course(Base, Store):
__tablename__ = 'courses'
- id = Column(Integer, primary_key=True)
+ id = Column(Integer, primary_key=True)
+
+class Cluster(Base, Store):
+ __tablename__ = 'clusters'
+
+ id = Column(Integer, primary_key=True)
+ centroid = Column(Text)

0 comments on commit 2d6494a

Please sign in to comment.