Skip to content

Instantly share code, notes, and snippets.

merveydn

Block or report user

Report or block merveydn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@merveydn
merveydn / cosine_similarity.R
Created Aug 20, 2018 — forked from abelsonlive/cosine_similarity.R
Cosine Distance Recommendation / Collaborative Filtering Example
View cosine_similarity.R
# lets make some dummy data
n_rows <- 1000
n_cols <- 100
mat <- matrix(0, nrow=n_rows, ncol=n_cols)
mat <- apply(mat, 2, function(x) { return(rbinom(n_rows, size=1, prob=0.1))})
colnames(mat) <- paste0("event", 1:n_cols)
rownames(mat) <- paste0("pol", 1:n_rows)
# lets take a look at it before we do some math
head(mat)
You can’t perform that action at this time.