def register(userid,password,email):
    new_user=user_info()
    new_user.userid=userid
    new_user.password=password
    new_user.email=email
    make_new_user(new_user)
    username_list.append(userid)
    password_list.append(password)
    email_list.append(email)
#Now create bandits 
#total_bandits = range(0,k)
movie_dict = read_genre() # This gives us the actions for each of the bandits. Here the actions are movies specific to a genre
b_keys = movie_dict.keys()
bandit_dict = {}

bandits = [] # list of bandit objects 
for b in b_keys:
	acts = movie_dict[b]
	bandit = Bandit(b,acts)
	bandit.set_count()
	bandit_dict[b] = bandit

# Getting the point class information 
points = user_info('users.dat',bandit_dict)
#print points[0]

#print points

point_values = [x.value for x in points]

#Set the Q values for each of the points
for b in bandit_dict.values():
	for p in points:
		b.set_Q(p)

# Initialize some values


# sample some users for testing and recommendation
Example #3
0
from collections import defaultdict
from aff_clustering import *
from user_info import *

#Load the user and movie ratings dictionaries using pickle

user_rating_dict = pickle.load(open('user_rating_dict'))
movie_rating_dict = pickle.load(open('movie_rating_dict'))

# Now define the number of clusters ; it will be equal to the number of movies
no_of_movies = len(movie_rating_dict.keys())
k = 18 # Currently set to the number of genres

#Now let us perform one round of clustering and display the results
print 'The number of clusters is:' + str(k) + '\n'
points = user_info('users.dat')
clusters = kmeans(points,k)
#print clusters

'''
Initializing the affinity values for each of the data points.
Affinity values are stochastic for each of the data points. So initializing equal affinity scores for all the points
Investigate: Could it be a fuzzy set?
'''

init_affin = 1/k
aff_dict = defaultdict(list)
aff_list = []
for i in range(k):
	aff_list.append(init_affin)