- Training Set: This dataset is used to train the model, composed of multiple texts (e.g., Tiny Shakespeare) that help construct the Markov chain.
- Tokens: Tokens are the first step in processing input data, obtained by extracting words from the text and removing punctuation. For instance, in the example "I went to the market and the store," the tokens are ["I," "went," "to," "the," "market," "and," "the," "store"]. The sequential nature of the task means we keep all tokens in order, even if they repeat.
- K Sequences / Sliding K Window: The Markov chain is simple, as the current state only depends on the last token. A deeper Markov chain predicts the next word using the last K states.
For example, with K = 2:
- ["I", "went"] → "to"
- ["went", "to"] → "the"
- ["to", "the"] → "market"
- ["the", "market"] → "and"
- ["market", "and"] → "the"
A sliding window of size 2 allows for contextual word prediction. The choice of K depends on the training set size; a larger dataset allows for a larger K. In this case, we'll use K = 2 due to a relatively small training set.
- Features & Labels: Before training, we must extract features from the dataset, which serve as a simple and efficient representation of the data. Each feature set is associated with a label that describes its meaning. A simple model representation is a function mapping features to labels: f(X) = y. Here, the features are K-sequences extracted from the tokens, and the labels are the subsequent words.
- Training Set: A dataset where each feature set has an associated label for the model to learn.
- Testing Set: A dataset where we aim to predict the label for each feature set, testing the model's performance.
andreeaa-10/Text-generator
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|