# Enhancing Imbalanced Sentiment Analysis: A GPT-3-Based Sentence-by-Sentence Generation Approach
## 5 Results  
### Sentence-by-Sentence Generation  
#### 5.1.1 The Generated Data  
In the sentence-by-sentence data generation phase, we commenced with the provisioning of the preprocessed initial dataset. As illustrated in Figure 3(a), a comprehensive preprocessing regimen was undertaken, which included the removal of non-English sentences and duplicate data. This process ensured that the original data used as input for the synthetic data generation process were clean and pertinent. The outcome of this preprocessing yielded a more structured and homogenized dataset, crucial for achieving high-quality synthetic data generation. Subsequently, we determined the requisite quantity of synthetic data needed to achieve a balance within the dataset. In the context of this research, the need for synthetic data was quantified based on the existing class imbalance within the original dataset. Specifically, to match the dominant number of positive sentiment data, we required an additional 12,441 synthetic instances for the negative class and 13,322 for the neutral class. This strategic augmentation was designed to equalize the representation of sentiments across the board, thereby facilitating a more balanced and equitable sentiment analysis. To account for the potential emergence of low-quality synthetic data during the generation process, we produced an excess amount of synthetic data than what was needed. Figure 3(b) depicts the frequency distribution of the generated synthetic data, where it is evident that the volume of synthetic data produced was intentionally made surplus. This approach allowed us the flexibility to selectively curate high-quality synthetic data and eliminate any that did not meet the predetermined standards, ensuring that only the best-quality data would be utilized for balancing in the training dataset. Thus, these steps facilitated the creation of an optimized dataset for sentiment classification under the premise that the inclusion of high-quality synthetic data would lead to more precise models and the better generalization of sentiment on previously underrepresented data. Table 3 exemplifies the process of synthetic data generation using the sentence-by-sentence data generation technique, a process that has been delineated in the \"Experimental Detail\" section, particularly described in conjunction with Figure 3. The table showcases instances of original input data, the corresponding prompts used to guide the GPT-3 model, and the resultant generated output data. For instance, the first entry in Table 3 presents the original review, _\"instructor doesn't seem to be passionate about giving the lecture\"_. The prompt crafted to elicit synthetic data mirrors the sentiment of the original review and instructs GPT-3 to generate a sentence with a similar meaning: _\"Please generate a review sentence about a course that has a similar meaning to this review: 'instructor doesn't seem to be passionate about giving the lecture\"_. _Keep the  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Original Input Data** & **Prompt** & **Generated Output Data** \\ \hline \multirow{4}{*}{instructor doesn’t seem to be passionate about giving the lecture} & Please generate a review sentence about a course that has a similar meaning to this review: “instructor doesn’t seem to be passionate about giving the lecture”. Keep the generated review under the given maximum token. & The instructor appears to lack enthusiasm while delivering the class. \\ \hline \multirow{4}{*}{instructor is not clear and too fast!} & Please generate a review sentence about a course that has a similar meaning to this review: “instructor is not clear and too fast”. Keep the generated review under the given maximum token. & The instructor is confusing and moves too quickly! \\ \hline \multirow{4}{*}{it is very easy and unusefull course.} & Please generate a review sentence about a course that has a similar meaning to this review: “it is very easy and unusefull course.” Keep the generated review under the given maximum token.