# Hybrid RFSVM: Hybridization of SVM and Random Forest Models for Detection of Fake News
## 2 Related Work and Motivation
### Proposed Algorithm
Step 3: In this step, extraction of text and target variable columns from the dataset will be carried out, which is further used for the removal of tags and symbols. Further, long sentences are split into words. Also, stop words will be removed from the text. Step 4: This step is used for creating bags of words from the cleaned datasets, and to encode the characters of strings with numerical values, using encoding algorithms. Step 5: This step is used for the feature selection, extraction, and normalization processes. First, the conversion of the bags of words into vectors is carried out using TF-IDF, which can further be normalized using the min-max algorithm. Then follows the division of the dataset into the training and testing datasets which can further calculate the use of each feature using an entropy-based model of feature selection and selecting the best and optimized feature using the algorithm mentioned. Step 6: Building the base models such as RF, SVMs, naive Bayes, and XGBoost individually for the training the datasets. All the parameters are further analyzed individually on different news categories. Further, the hybridization of RF and SVMs is carried out using the mentioned algorithm, in which the analysis of different news categories is carried out along different parameters such as precision, recall, and accuracy. 1. For each tree in the forest, simply sample n data points. Further, for each node in a tree, we will randomly select m attributes by calculating variance. This leads to the new dataset d' from the dataset d using the random replacement method along with the assignments of weights against each attribute. 2. For each subset having a random feature of dataset d', apply SVMs for each feature subset and generate the output of the classification as one class of SVM, which can further be used to update the weights of all the vectors on the basis of the outcomes of classification. The weights of the vectors can further be increased in case of misclassification and decrease in other cases. 3. Repeat step (a) and (b), by generating different random datasets till all input vectors are further classified. 4. The output of the complete dataset is computed using the majority voting process, from the final outputs of each of the random feature subsets Di. Proposed Algorithm is shown in Algorithm 1. ```
Input: Dataset Output: Classification of news as fake/real & evaluation metrics // Phase 1: Data Set Creation // Download the Dataset  For each data belonging to the dataset do  Data pre-processing  return Processed Data // Phase 2: Fake Dataset Text Augmentation //  For each data in the Dataset \(FW\leftarrow\) extract (_Bag of words_) \(MS\leftarrow\) cosine similarity (_FW_, _FW_)  If max (_MS_) \(AFT\leftarrow\) combine fake text // (_Augmented Fake Text_) // Phase 3: Text Classification // // For Machine Learning:  tfidf (t, x, X) \(\leftarrow\)tf (t, x).idf (t, X)  if (t, x) \(\leftarrow\)Log(1+freq (t, x))  if (t, X) \(\leftarrow\) Log (N/count \(d\) belongs to \(D\), \(t\) belongs to \(d\))  TF, IDF \(\leftarrow\) tfidf (Dataset) // Feature Extraction // Accuracy \(\leftarrow\) Random Forest + SVMs
```  
**Algorithm 1**Hybrid RFSVM Fake News Detection Algorithm. Here, FW = fake words, MS = matching score, AFT = augmented fake text, t = term, and D = document.