# Predicting Software Cohesion Metrics with Machine Learning Techniques
## 3 Materials and Methods
### Dataset  
Finding the dataset and pre-processing the data are very important processes. The datasets obtained publicly may not have the attributes that are exactly suitable for the purpose of the study. Moreover, there may be different features in the dataset, although it is out of the scope of the study. Removing the unnecessary features directly from the dataset may also cause differences in the result obtained from the analysis. This will reduce the power of the established model. In our study, we created two datasets utilizing the open source Freeplane [19] and Eclipse Plug-in Development Environment (PDE) user interface (UI) software systems ([[https://github.com/dspinellis/awesome-msr](https://github.com/dspinellis/awesome-msr)]([https://github.com/dspinellis/awesome-msr](https://github.com/dspinellis/awesome-msr)), accessed on 23 February 2023).  
To create Dataset#1, the open source Freeplane application's classes were used. Freeplane was obtained from [[http://sourceforge.net](http://sourceforge.net)]([http://sourceforge.net](http://sourceforge.net)) (accessed on 1 December 2022) and developed with Java programming language. Freeplane is a popular open-source software that is downloaded by thousands of people every week and updated frequently by the developers. Moreover, according to the hundreds of reviews, it has a high score. These properties make Freeplane a good representative software to be used in our study. There are 1471 classes in the Freeplane application. It is a medium-sized project consisting of 198.486 lines of code. With the cohesion metrics found in the literature, calculations are generally made on a class basis. Not all the 1471 classes were used in the study. A total of 282 classes were excluded because 170 classes only had the interface definition, 24 classes only had enum definitions, and the content of 6 classes were empty or they only had attribute definitions. In addition, 82 classes were also excluded because they had less than 2 methods, and therefore the cohesion was unable to be calculated.  
To create Dataset#2, the open-source Eclipse Plug-in Development Environment (PDE) user interface (UI) classes were used. Eclipse PDE UI was obtained from [[https://github.com/dspinellis/awesome-msr](https://github.com/dspinellis/awesome-msr)]([https://github.com/dspinellis/awesome-msr](https://github.com/dspinellis/awesome-msr)) (accessed on 23 February 2023) and developed with Java like Dataset#1.  
There are 1498 classes in the Eclipse PDE UI. A total of 261 classes were excluded because some of them had less than 2 methods, and for some of them, source code could not be reached.  
The actual values of the LCOM2, TCC, LCC, and LSCC metrics for the remaining 1189 classes of Dataset#1 and 1237 classes of Dataset#2 were calculated using the software developed by Dallal [6]. The elements of the dataset are the number of methods in the class; the number of attributes; and LCOM2, TCC, LCC, and LSCC metric values. The software used was created with the Java programming language. A total of 16 different cohesion metrics can be calculated by using this software. We should note that this software does not have a user interface and also requires high effort to calculate the metrics since the metrics are obtained by applying each class one by one. Considering that this calculation is made for several hundreds of classes, this is a time-consuming process that takes too long.