This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
runApp(list( | |
ui = bootstrapPage( | |
uiOutput("nUI"), | |
plotOutput('plot'), | |
submitButton("PlotIt") | |
), | |
server = function(input, output, session) { | |
output$plot <- renderPlot({ hist(runif(input$obs)) }) | |
output$nUI <- renderUI({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=UTF-8 | |
from __future__ import division | |
import nltk | |
from collections import Counter | |
# This is a simple tool for adding automatic hashtags into an article title | |
# Created by Shlomi Babluki | |
# Sep, 2013 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
recommenderRegistry$get_entries(dataType = "realRatingMatrix") | |
# We have a few options | |
# Let's check some algorithms against each other | |
scheme <- evaluationScheme(MovieLense, method = "split", train = .9, | |
k = 1, given = 10, goodRating = 4) | |
scheme | |
algorithms <- list( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# What is the mean rating of each movie | |
qplot(colMeans(MovieLense), binwidth = .1, | |
main = "Mean rating of Movies", | |
xlab = "Rating", | |
ylab = "# of movies") | |
# The big spike on 1 suggests that this could also be intepreted as binary | |
# In other words, some people don't want to see certain movies at all. | |
# Same on 5 and on 3. | |
# We will give it the binary treatment later |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How many movies did people rate on average | |
qplot(rowCounts(MovieLense), binwidth = 10, | |
main = "Movies Rated on average", | |
xlab = "# of users", | |
ylab = "# of movies rated") | |
# Seems people get tired of rating movies at a logarithmic pace. But most rate some. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How about after normalization? | |
qplot(getRatings(normalize(MovieLense, method = "Z-score")), | |
main = "Histogram of normalized ratings", xlab = "Rating") | |
summary(getRatings(normalize(MovieLense, method = "Z-score"))) # seems better | |
# Min. 1st Qu. Median Mean 3rd Qu. Max. | |
# -4.8520 -0.6466 0.1084 0.0000 0.7506 4.1280 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Visualizing ratings | |
qplot(getRatings(MovieLense), binwidth = 1, | |
main = "Histogram of ratings", xlab = "Rating") | |
summary(getRatings(MovieLense)) # Skewed to the right | |
# Min. 1st Qu. Median Mean 3rd Qu. Max. | |
# 1.00 3.00 4.00 3.53 4.00 5.00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load required library | |
library(recommenderlab) # package being evaluated | |
library(ggplot2) # For plots | |
# Load the data we are going to work with | |
data(MovieLense) | |
MovieLense | |
# 943 x 1664 rating matrix of class ‘realRatingMatrix’ with 99392 ratings. | |
# Visualizing a sample of this |
NewerOlder