# GAN-Based Generation of Synthetic Data for Vehicle Driving Events
### Theoretical Background
#### 1.1.3 Time-Series GAN (TimeGAN)
The authors of TimeGAN used three metrics as criteria to evaluate the generated data: (1) fidelity, (2) diversity, and (3) usefulness [11]. The _fidelity_ metric indicates that the sample series should be indistinguishable from the real data. The _diversity_ metric refers to the requirement that the distribution of the synthetic data should be similar to that of the real data. Finally, the _usefulness_ metric means that the synthetic data should be as useful as the real data for solving predictive tasks. Figure 3 summarizes these three evaluation criteria. Figure 2: TimeGAN framework. Fidelity evaluation.This evaluation uses a quantitative metric called the _discriminative score_. The discriminative score is obtained through a classification model trained with a discriminative LSTM network; its value expresses the ability of the model to identify whether a data sample corresponds to real or synthetic data. A lower score is better, as it means that the discrimination model does not distinguish synthetic from real data very well. The worst possible result is 0.50 and the best is 0.00. The value of this score is provided by Equation (1):  
\[\textit{discriminative score}=\textit{accuracy}-0.5 \tag{1}\]  
which can also be expressed as shown in Equation (2):  
\[\textit{discriminative score}=\frac{\textit{No. of correct predictions}}{\textit{Total number of predictions}}-0.5. \tag{2}\]  
Diversity evaluation.Although there is no direct visual way to assess the appropriateness of synthetic data, the PCA and T-SNE techniques can be used as qualitative assessment metrics. PCA is an algorithm that finds a set of principal components that are orthogonal to each other, where each component captures the largest variance of the data after accounting for the variance accounted for by the previous components. On the other hand, T-SNE is a nonlinear approach that reduces the dimensionality of the data, seeking to maintain the closeness between the points of the original dimensions in the lower dimensional representation. T-SNE uses a T-distribution to represent the probabilities in the lower-dimensional space. This process is the opposite of that used by PCA, which seeks to obtain the highest variance [13]. Both of these methods follow the expectation that the two-component scatter plots of the synthetically generated and the original points should be as similar as possible. These plots provides a visual representation showing whether the distribution of the generated data maintains similar characteristics to the original data distribution. Usefulness evaluation.The usefulness of synthetic data is measured through a _predictive score_ obtained through a prediction model trained using an LSTM network. Its value expresses the ability of the model to predict the value of one dimension from a multidimensional sequence of data. A value closer to zero reflects better predictive capability on the part of the model. The value of the predictive score is the _Mean Absolute Error_ (MAE), defined by Equation (3)  
\[MAE=\frac{1}{n}\sum_{i=1}^{n}|x_{i}-y_{i}|, \tag{3}\]  
where:  
* \(x_{i}\) represents the actual value for the dimension of the dataset's \(i\)-th sequence. * \(y_{i}\) represents the predicted value for the dimension of the dataset's \(i\)-th sequence. * \(n\) represents the total number of sequences in the dataset. Figure 3: TimeGAN evaluation scheme.