예제 #1
0
 def saveUsers(self, users, filename, force=False):
     fileOverWriteWarning(filename, force)
     with open(filename, 'w') as f:
         for i in range(len(users)):
             #print users[i].theta
             f.write(
                 json.dumps((users[i].id, users[i].theta.tolist())) + '\n')
예제 #2
0
 def saveUsers(self, users, filename, force=False):
     '''
     Save all users and their respective parameter values 
     in a json format in file.
     '''
     # Output warning message if going to overwrite
     # Otherwise, output warning if not supposed to overwrite and an existing file exist
     fileOverWriteWarning(filename, force)
     with open(filename, 'w') as f:
         # Loop through all users
         for i in range(len(users)):
             # print users[i].theta
             # Write a user and it's parameter values in a json list
             f.write(
                 json.dumps((users[i].id, users[i].theta.tolist())) + '\n')
예제 #3
0
파일: Users.py 프로젝트: qw2ky/CoLinUCB
	def saveUsers(self, users, filename, force = False):
		fileOverWriteWarning(filename, force)
		with open(filename, 'w') as f:
			for i in range(len(users)):
				print users[i].theta
				f.write(json.dumps((users[i].id, users[i].theta.tolist())) + '\n')