Text Prediction App

Sinem Demirci

2023-11-26

Model Development and Data Analysis

This presentation introduces our text prediction model derived from blogs, news and twitter data and our Shiny application that uses this model.

Data reading and preprocessing steps.

We read the data from three distinct sources: blogs, news, and Twitter. Each of these datasets offers a unique perspective on language usage.

What is Data Preprocessing?

Data preprocessing is the process of cleaning and organizing raw data to make it suitable for a machine learning model. In this phase, we convert text to lowercase, remove punctuation, digits, and irrelevant words to simplify the data.

Tokenization Explained

Tokenization is the process of splitting text into individual elements, commonly words. This step is crucial for understanding and analyzing the text data effectively.

N-gram model and calculation of bigram frequencies

An n-gram is a contiguous sequence of n items from a given sample of text. We use n-grams to predict the next word in a sequence, helping us understand the context better.

Prediction Function and Performance of the Model

Prediction function for the next words

We build a predictive model that suggests the next word in a sentence. The model analyzes the frequency of word pairings (bigrams) in our datasets to make predictions.

Sample prediction

Certainly, here’s a brief table-like description in English:

This table shows the word predicted by the model at each step, based on common pairings in the dataset. Each prediction is made solely based on the most recent word, without a broader understanding of language or context. While the overall phrase “the year ago and” may not form a complete or coherent sentence, it’s important to remember that each prediction is based solely on the most recent word.

Performance indicators of the model (computation time, memory usage)

We assess the size and efficiency of our model, ensuring it is both fast and doesn’t consume excessive memory.

Introduction to the Shiny Application

Overview of the Shiny Application:

How to Make Predictions:

  1. Enter the text you want to predict in the text input box.
  2. Click the “Predict Next Words” button.
  3. Prediction results and alternatives are displayed instantly.

User Feedback and Interactive Features:

User Feedback and Prediction Accuracy

Our graph displays the count of predictions and their accuracy levels based on feedback types. The X-axis is labeled as “Feedback Type” and consists of two categories: “Correct” and “Incorrect.” The Y-axis is named “Count” and represents the number of user predictions.

Let’s start by focusing on the “Correct” category. This category represents instances where user predictions were accurate. As we can see, the count of predictions in the “Correct” category peaks at 3. This indicates that users agreed with the model’s predictions three times, and these predictions were indeed correct.

Now, let’s shift our attention to the “Incorrect” category. This category represents cases where user predictions were incorrect. As observed, the “Incorrect” category shows a count of predictions as only 1. This implies that users disagreed with the model’s predictions and found them incorrect on only one occasion.

This graph highlights that users generally have confidence in the accuracy of the model’s predictions, as evidenced by the higher count of predictions in the “Correct” category. However, it also indicates that user feedback on incorrect predictions is minimal. This feedback mechanism can contribute to the model’s improvement, even though the majority of predictions are correct.

In conclusion, this graph serves as a valuable tool to emphasize the model’s performance and the significance of user feedback. Users can see that correct predictions prevail, enhancing the model’s reliability and user satisfaction.

                                        THANK YOU!