Guided Selling using R

Posted on Updated on

# Setting current working directory
# Read data from Last.FM frequency matrix
data.germany head(data.germany[,c(1,3:8)])

# Drop the user column and make a new data frame

# Create a helper function to calculate the cosine between two vectors
getCosine {
this.cosine return(this.cosine)

# Create a placeholder dataframe listing item vs. item
holder data.germany.ibs.similarity

# Lets fill in those empty spaces with cosine similarities
for(i in 1:ncol(data.germany.ibs)) {
for(j in 1:ncol(data.germany.ibs)) {
data.germany.ibs.similarity[i,j]= getCosine(data.germany.ibs[i],data.germany.ibs[j])

# Output similarity results to a file

# Get the top 10 neighbours for each

for(i in 1:ncol(data.germany.ibs))
data.germany.neighbours[i,] }

# Output neighbour results to a file

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s