def test_train_recommender_with_impressions_only(self):


		if not self.debug:
			self.getResults()
			n_maxrows = 10 #amount of items fetched for training
			result = r.fetch_row(maxrows = n_maxrows) # fetch N row maximum
		else:
			result = self.mockMysqlResults()


		while (result):
			for result_item in result:
				'''
				the_id = result_item[0]
				userid = int(result_item[0])
				itemid = int(result_item[1])
				timestamp = str(result_item[2])
				domainid = 	int(result_item[3])
				'''
				json_string = result_item[3]


				http_conn = http_connector('localhost:5001')
				http_conn.send('/contest/incoming_message', json_string)


		# todo sleep for a short while

		# todo get a recommendation now
 def __init__(self, training_id = 5):
     """
     nothing to construct
     """
     self.training_id = training_id
     self.doc_id = 1
     self.baseurl = "localhost:5002"
     self.connection = http_connector( self.baseurl )
    def setUp(self):
        self.baseurl = "localhost:5002"
        self.connection = http_connector( self.baseurl )

        self.texts = ["Human machine interface for lab abc computer applications",
                "A survey of user opinion of computer system response time",
                "The EPS user interface management system",
                "System and human system engineering testing of EPS",
                "Relation of user perceived response time to error measurement",
                "The generation of random binary unordered trees",
                "The intersection graph of paths in trees",
                "Graph minors IV Widths of trees and well quasi ordering",
                "Graph minors A survey",
                "Human machine interface for lab abc computer applications",
                "A survey of user opinion of computer system response time",
                "The EPS user interface management system",
                "System and human system engineering testing of EPS",
                "Relation of user perceived response time to error measurement",
                "The generation of random binary unordered trees",
                "The intersection graph of paths in trees",
                "Graph minors IV Widths of trees and well quasi ordering",
                "Graph minors A survey"]
Esempio n. 4
0
		""" instead of using the current time we will just use the timestamp given by the contest as a timestamp """
		contest_timestamp = result[0][2]
		
		print contest_timestamp
		
		#2011-09-29 16:44:44
		contest_timestamp = datetime.strptime(contest_timestamp, "%Y-%m-%d %H:%M:%S")
		#contest_timestamp.
		timestamp_sec = getTimestamp.getTimeStampFromPythonDateTime(contest_timestamp)
		 
		#print timestamp_sec
		
		
		if ( not debug2 ):
			""" this step should simulate the normal process of the contest """
			http_conn = http_connector('localhost:5001')
			http_conn.send('/contest/incoming_message', json_string)
		else:
			""" this step is for debugging """
			#print json_string
			#rjm = rawJsonModel( json_string )
			#rjm.save()
			
			
			parser = FullContestMessageParser()
			flattenedJson = parser.parse(json_string)
			
			print flattenedJson
			
			""" lets save the data, each field a column """
			if ( flattenedJson ):