MySQLRecommender module

Module performs actual recommendation for evaluation.

class MySQLRecommender.MySQLRecommender(conn)

Bases: object

Class performs actual recommendation for evaluation.

get_classified_condition_statement(property_objects)

Function builds SQL statement for including classifying properties in the recommendation computation process.

Parameters:property_objects (dict) – properties and according objects on current subject
Returns:SQL-string to include classifying properties (WHERE-clause).
Return type:string
get_classifying_property_ids()

Function retrieves ids for classifying properties (specified via text).

Returns:classifying properties
Return type:list
get_random_subjects(no_subjects=1000, subject_offset=0)

Retrieve random subjects from MySQL.

Parameters:
  • no_subjects (int) – number of random subjects to be retrieved
  • subject_offset (int) – offset to be used for retrieving random subjects
Returns:

random subjects (id and text)

Return type:

list

get_recommendations(properties_objects)

Function computes recommendations based on given rules and the given recommendation algorithm.

Parameters:properties_objects (dict) – properties and objects appearing on subject to be evaluated
Returns:property recommendations
Return type:list
get_subject_properties_objects(subject_id, long_tail_limit)

Retrieves set of properties and according objects appearing on given subject. Only retrieves subjects with number of properties > long_tail_limit.

Parameters:
  • subject_id (int) – id of subject to retrieve properties and objects for.
  • long_tail_limit (int) – minimum number of properties appearing on subject
Returns:

properties and objects of given subject

Return type:

dict