Parikshit Sanyal
16 Nov 18
This prediction model takes a text string as input, a decay factor f (between 0 and 1) and a number top_n as input, and then prints the top n predictions following the string.
Given a string, the function finds
Probable words follwing 'i think' with top_n = 5 and f=1 (left); note that the relative frequencies of the predictions will change with change in f (right, f=0.5)
Following is the results of profiling the function 'predict(“i think”,top_n=1,f=1) on an i3 laptop with no GPU
x <-summaryRprof("~/core/code/R/coursera_R/capstone/profile")
x$by.self
self.time self.pct total.time total.pct
"grepl" 0.14 53.85 0.14 53.85
"ls" 0.06 23.08 0.06 23.08
"tolower" 0.04 15.38 0.04 15.38
"c" 0.02 7.69 0.02 7.69
The program runs with only moderate memory usage (19.7 MB saved environment data), which makes it useful for smartphones. However, predictive accuracy is yet to be tested in real world.