# Distributed Fuzzy Cognitive Maps for Feature Selection in Big Data Classification
## 3 Materials and Methods
### Classification Model  
For the performance analysis of proposed model, the classification algorithms Naive Bayes, Decision Tree, Random Forest, Multilayer Perceptron, and Logistic Regression were used. The distributed versions of the classification algorithms were used. The datasets were converted into pairs of feature vectors and class labels using the VectorAssembler method in spark. Since all the datasets were numerical datasets, no other preprocessing steps were necessary in order to process the datasets. The datasets were partitioned into different subsets and spread across different nodes. In the distributed Naive Bayes classifier, the class labels and feature vectors are mapped together and distributed across nodes and a hash function is used to determine the conditional probability of the features, which is used to produce a probability table. The probability table is utilized in order to classify the  
Figure 3: DAG depicting the physical execution plan of the distributed FCM.  
dataset. In the distributed Decision Tree classifier, binary partitioning is done recursively to classify the features using a greedy algorithm. In the Random Forest model, each tree is trained using a different subset of the data. The Random Forest trees are actually trained on different parts of the same training set. A Tree Point structure is used to save the memory by storing the replica count of each instance in each subset. The number of mappers created is the same as number of trees in the Random Forest. Parallel training of a variable set of trees is optimized depending on memory constraints. Random Forest models reduce the risk of overfitting. Multilayer perceptron classifier (MLPC) is a feed-forward neural network classifier. MLPC has layered nodes. Network layers are completely linked. Input layer nodes represent input data. All other nodes translate inputs to outputs by linearly combining inputs with weights, bias, and an activation function. The model takes the composition of layers as input. While using the multinomial logistic regression model, a matrix of the number of outcome classes and the features is created and a Softmax function is used to model the outcome class's conditional probabilities.  
The algorithm corresponding to the proposed methodology is given in Algorithm 1. In the proposed algorithm, the accuracy threshold is the accuracy value obtained when the classifier is applied on the dataset without any feature selection performed. Our intention is to obtain better accuracy values. Another assumption is the epsilon threshold value.  
```
1 Initialize global variable FeatureVector to 0
2 procedure FCM()
3{
4 Read the features in the dataset to a features variable
5 Compute the correlation matrix for the features and assign it to weight matrix
6 For all features[i] in features do
7 Initialize the StateVector with 1 for selected features and 0 otherwise
8 While(true)
9 Parallelize the WeightMatrix
10 Broadcast the StateVectorA
11 Update VectorA as weightMatrix * StateVectorA
12 Assign StateVectorA = updatedVectorA
13 Compute the classification Accuracy of updated StateVectorA
14 If(accuracy > accuracyThreshold)
15 Add the features in StateVectorA to FeatureVector
16 weightMatrix = updateWeights(weightMatrix)
17 epsilon = compute Epsilon()
18 if epsilon < threshold
19 break;
20}
```  
**Algorithm 1** Distributed Fuzzy Cognitive Map (FCM) algorithm for feature selection in big data