The goal of this presentation is to describe the my prediction algorithm used in a Shiny app that takes as input a phrase (multiple words) in a text box input and outputs a prediction of the next word.
12/30/2019
The goal of this presentation is to describe the my prediction algorithm used in a Shiny app that takes as input a phrase (multiple words) in a text box input and outputs a prediction of the next word.
I use Stupid Backoff algorithm for the prediction model .
The algorithm use scoring function :
with lambda = 0.4
so the algorithm as follows :
I get last word of 5-grams that start with the input sentence , then store the top 3 words with highest Probability which is the Number of times that 5-grams ended with this last word divided by number of times the first four words of this 5-gram show up in the 4-gram table , then step wise back off to the 2-gram level by repeating the procedure with an adjusted probability (x*0.4) as 0.4 is the recommended lambda value , and dropping the words that are suggested again during the backoff.
App Link : https://gehad95.shinyapps.io/en_US/
code link on github : https://github.com/geehad/Data-science-Capstone-Project-On-Coursera