def recommendation_pearson(): data = _recommendation(sim_pearson) person_one = 'Jack Mattehews' person_two = 'Gene Seymour' similiarity = data['similarity'][person_one, person_two] # Data for highchart example_chart_data = [ {'name': film, 'data': [{'x': CRITICS[person_one][film], 'y': CRITICS[person_two][film]}]} for film in data['film_names'] ] # Add pearson in linear representation example_chart_data += [{'data': [{'x': i, 'y': i * similiarity} for i in xrange(0, 6)]}] js_data = { 'chart': { 'series': example_chart_data, 'xAxis': person_one, 'yAxis': person_two } } data = _recommendation(sim_pearson) data['jsAppData'] = json.dumps(js_data) return render_to_template('recommendation_pirson.yammy', **data)
def items_suggestions(): movies = transform_prefs(CRITICS) matches = top_matches(movies, 'Superman Returns') recommended_critics = get_recommendations(movies, 'Superman Returns') data = { 'matches': matches, 'recommended_critics': recommended_critics } return render_to_template('recommendation_items_suggestions.yammy', **data)
def items_recommendation(): # Recommendations for Toby data = { 'recommendations': get_recommendations(CRITICS, 'Toby', sim_pearson), 'recommendations_evclid': get_recommendations(CRITICS, 'Toby', sim_distance), 'critics': CRITICS, 'film_names': FILM_NAMES } return render_to_template('recommendation_items.yammy', **data)
def recommendation_evclid(): film_one = 'Superman Returns' film_two = 'Snakes on a Plane' # Data for highchart example_chart_data = [ {'name': critic, 'data': [{'x': films[film_one], 'y': films[film_two]}]} for critic, films in CRITICS.iteritems() ] js_data = { 'chart': { 'series': example_chart_data, 'xAxis': film_one, 'yAxis': film_two } } data = _recommendation(sim_distance) data['jsAppData'] = json.dumps(js_data) return render_to_template('recommendation_evclid.yammy', **data)
def home(): return render_to_template('base.yammy')
def render(self): return render_to_template('base/brick/text_with_link.html', dict(brick=self))
def render(self): return render_to_template('base/article.html', dict(article=self))