LHCb Analysis Facility
as made available in the image landerlini/lhcbaf:v0p8
.¶This notebook is part of a pipeline, in particular it requires data preprocessed in the Preprocessing-GANs notebook and the model trained in the Resolution notebook.
As for other validation notebooks, we are using the GPU to process the data (selections and histogramming) which will make it unusable for evaluating the DNN models in tensorflow. For a discussion on this issue, refer to the acceptance-validation notebook.
The libraries for using the GPU for data analysis are:
cupy
, as a replacement for numpy with operations running on the GPUcudf
, as a replacement for pandas with a DataFrame stored on GPUdask
to implement lazy operations and streaming data from disk to the GPU memory, on demand.We are using a dataset statistically equivalent to the une used for training, but never loaded in the training notebook.
We will use our custom FeatherReader
helper function, converting data to a dask
dataframe while they are read from disk.
Preprocessing steps are obtained from the same directory as the model with the standard naming convention:
tX.pkl
for the preprocessing steptY.pkl
for the postprocessing stepPlease note that tY
encodes the transformation from physics variables to normally-distributed preprocessed features.
In this notebook we are interested in the inverse transformation, mapping the output of the generator (normally distributed features) to the physics quantities.
WARNING:tensorflow:No training configuration found in save file, so the model was *not* compiled. Compile it manually.
We define a lazy pipeline using dask to:
FeatherReader
)WARNING:tensorflow:Compiled the loaded model, but the compiled metrics have yet to be built. `model.compile_metrics` will be empty until you train or evaluate the model. INFO:tensorflow:Assets written to: ram://6719af3a-dcae-43b0-9350-fd8f04f64898/assets
We append to the pipeline the computation of variables that we wish using for binning the dataset but do not enter directly in the training dataset.
The list of the variables computed include:
The following histogram show a comparison of the distribution of the generated and reference output features in kinematic bins. The comparison is split per particle type (electron, muon and hadron) and track class (long, upstream and downstream), resulting into nine comparisons for each output feature.
To assess the overall quality of the dataset we are using the KS distance as computed from the histograms discussed above. For each kinematic bin with a sufficient number of samples (100 or more) and for each output feature, we compute the KS distance. The KS distances are used to fill a histogram that provides a visual summary of the fitting of the model to the reference sample across the kinematic region covered by the training sample.
In general, we aim at the lowest possible values of the KS distance. In practice, values below 0.1 are conventionally considered as very good and values below 0.3 are considered acceptable. These thresholds may change increasing the statistics of the test set.
In the plot below, we report the value of the KS distance as a function the kinematic bin. The purpose of this visualization is to identify regions where the model performs better and regions where it is weaker. In general, it is observed, as expected, that the model performs better in regions where the training dataset is more populated.
In this notebook we discussed the validation procedure of the resolution model, comparing the distributions of the predicted features with the reference test set.
Additional splitting and variables might be included in the future to provide a more comprhensive view on the performance of the model.
To ease the identification of regions where the model is weaker, we draw the KS distance obtained comparing the distribution of each variable, in each kinematic bin.