The following table shows sales of different items (A, B, C,....,G) at a grocery
ID: 3784655 • Letter: T
Question
The following table shows sales of different items (A, B, C,....,G) at a grocery. Write R-codes possibly using "for" loops to calculate the Jaccard distance in order to compute similarities between all shopping basket pairs. Ex:The Jaccard distance for shopping baskets CA and CB is defined by
I have got the following R-codes for the problem but mistakenly programmed for jaccard distance between shopping items instead of shopping baskets. Please help me to fix this small problem cause I am new to programming.
# reading the data from csv
groccery <- read.csv(file="Desktop/Grocery.csv",head=TRUE,sep=",")
#getting all column nameexcpet first one
b<-colnames( groccery )[-1]
#creating a list to store jacard distance for all pair
l<-list()
for(x in b){
for(y in b){
if(x!=y){
num<-interaction(unique(groccery[[x]]),unique(groccery[[y]])) # intersetion of pair like(A,B),(A,C) etc..
deno<-union(unique(groccery[[x]]),unique(groccery[[y]])) #getting union
l[[paste(x,y,sep = "")]]<-length(num)/length(deno) #calculating jacard distace by given formula
}
}
}
#printing jacard distacne for each paire
for(x in names(l)){
print(paste(x,l[[x]],sep = " "),quote=FALSE)
cat(" ")
}
Explanation / Answer
The hazardous development of the internet and the rise of online business has prompted to the improvement
of recommender frameworks—a customized data separating innovation used to recognize
an arrangement of things that will hold any importance with a specific client. Client based collective separating is the most
fruitful innovation for building recommender frameworks to date and is widely utilized as a part of numerous
business recommender frameworks. Sadly, the computational many-sided quality of these techniques
develops straightly with the quantity of clients, which in commonplace business applications can be a few
millions. To address these versatility concerns show based proposal systems have
been created. These systems break down the user–item lattice to find relations between the
distinctive things and utilize these relations to figure the rundown of suggestions.
In this article, we exhibit one such class of model-based proposal calculations that first
decides the likenesses between the different things and after that utilizations them to recognize the arrangement of
things to be prescribed. The key strides in this class of calculations are (i) the technique used to
figure the closeness between the things, and (ii) the technique used to consolidate these similitudes
keeping in mind the end goal to process the closeness between a wicker bin of things and a competitor recommender thing.
Our test assessment on eight genuine datasets demonstrates that these thing based calculations are
up to two requests of greatness quicker than the customary client neighborhood based recommender
frameworks and give suggestions tantamount or better quality
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.