# A Comprehensive Approach to Bias Mitigation for Sentiment Analysis of Social Media Data
## 3 Proposed Methodology
### Data Preprocessing  
The data preprocessing stage involved transforming the adapted Jigsaw Unexpected Bias data set into a suitable format to develop the bias-aware sentiment analysis model. Using the _spaCy_[51] library, essential preprocessing techniques were applied to ensure consistency and improve the quality of the textual data. Text normalization was performed to standardize the input by removing special characters, extra whitespaces, and digits, and converting all text to lowercase. Tokenization splits the text into individual tokens for structured analysis, allowing the model to process words or phrases effectively. Noise reduction techniques, such as the removal of common stopwords and the lemmatization of tokens to their root forms, were employed to emphasize meaningful content while eliminating redundant or irrelevant information. These preprocessing steps ensured that the data set was clean, concise, and optimized for bias-aware sentiment analysis, without overloading the model with unnecessary information. The preprocessed text was converted into numerical features using the Bidirectional Encoder Representations from Transformers (BERT) model, which served as the feature extraction backbone for our bias-aware sentiment analysis model. BERT is a pre-trained deep learning model designed for a wide range of natural language understanding tasks, including sentiment analysis. It generates contextualized embeddings for input text, capturing rich semantic and syntactic relationships between words. For each preprocessed comment, the feature extraction process was formalized as follows:  
\[\mathbf{x}_{i}=\text{extract\_features\_BERT}(T(\mathbf{c}_{i}^{\prime})) \tag{1}\]  
where \(\mathbf{x}_{i}\) is the feature vector for the \(i\)th comment, extract_features_BERT\((\cdot)\) is the feature extraction function using BERT, and \(T(\mathbf{c}_{i}^{\prime})\) represents the tokenized and preprocessed version of the comment \(\mathbf{c}_{i}^{\prime}\). The BERT model generates a fixed-length feature vector for each comment, obtained by averaging or pooling the final hidden layer embeddings of the tokenized text. Specifically, these embeddings encapsulate the following key features:  
1. Contextual word representations: each token's embedding accounts for its meaning in the context of the surrounding words, which is critical for understanding nuances in sentiment. 2. Global comment representation: By applying techniques such as extraction or pooling of [CLS] token embedding (e.g., mean pooling) on all token embeddings, BERT provides a holistic representation of the entire comment. 3. Subtle semantic features: BERT captures complex relationships, such as sarcasm or indirect sentiment, which are often missed by traditional bag-of-words or TF-IDF approaches. These features were highly expressive and enabled the downstream model to accurately predict sentiment while minimizing bias. After feature extraction, the dataset was split into training, validation, and testing subsets to facilitate model development and performance evaluation. This detailed feature extraction process ensured that the adapted Jigsaw Unexpected Bias dataset was effectively transformed into a robust format suitable for bias-aware sentiment analysis using BERT. The pseudocode of the proposed method is shown in Algorithm 1.