Daily I help teams with solution engineering aspect of connected vehicle data projects. (massive datasets & always some new datasets with new car models aka new technologies.) Lately in the spare time, applying some of the ML/Deep learning techniques on datasets (many are create based on observations of real datasets)To Share some thoughts on my work (main half of this blog) and the other half will be about my family and friends.
Friday, May 24, 2013
Sample R code to count number of the terms in end user queries & plot
dups<-function p=""> df<-read .csv="" csv="" input="" nbsp="" p="" query="" read="" strip.white="TRUE)" temr="">
df[[1]] <- any="" cleanup="" df="" fixed="T)" gsub="" nbsp="" of="" p="" redirect="" term=""> ind <- df="" duplicate="" duplicated="" filter="" p="">
new.df <- df="" ind="" p="">
myh<-nchar 1="" gsub="" nbsp="" new.df="" p=""> #buckets
one<- length="" myh="=1])</p"> two<- length="" myh="=2])</p"> three<- length="" myh="=3])</p"> four<- length="" myh="=4])</p"> five<- length="" myh="=5])</p"> six<- length="" myh="=6])</p"> seven<- length="" myh="=7])</p"> eight<- length="" myh="=8])</p"> cvec <- c="" eight="" five="" four="" nbsp="" one="" p="" seven="" six="" three="" two="">
result.frame = as.data.frame(matrix(ncol=2, nrow=10))
names(result.frame) = c("Number", "Total")
# following is OK for now
result.frame = rbind(result.frame, c(1, one))
result.frame = rbind(result.frame, c(2, two))
result.frame = rbind(result.frame, c(3, three))
result.frame = rbind(result.frame, c(4, four))
result.frame = rbind(result.frame, c(5, five))
result.frame = rbind(result.frame, c(6, six))
result.frame = rbind(result.frame, c(7, seven))
result.frame = rbind(result.frame, c(8, eight))
plot(result.frame$Number,result.frame$Total,pch=19,col="blue" , xlab="Number of terms in a query" ,ylab="Total")
lines (result.frame$Number, result.frame$Total,lwd="4",col="red" )
lm1<-lm otal="" p="" result.frame="" umber=""> abline (lm1,lwd="4",col="green" )
}
-lm>->->->->->->->->->-nchar>->->->-read>-function>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment