ml¶
This module contains the functions needed to train a Machine Learning-based Montecarlo scan, and to assess its performance.
- 
SMEFT19.ml.SHAP_bf(fmodel, bf)[source]¶ Computes the SHAP values of the best fit point
- Arguments
 fmodel: Path to the file where the model was saved.
bf: Best fit point.
- 
SMEFT19.ml.SHAP_param(fmodel, points, param, header=None)[source]¶ Creates an scatter plot displaying how the SHAP values change as functions of each parameter of the fit.
- Arguments
 fmodel: Path to the file where the model was saved.
points: Pandas Dataframe containing the dataset.
param: Fit parameter. 0 = C, 1 = al, 2 = bl, 3 = aq, 4 = bq.
header: If the data file contains headers in the first row, 0.
- 
SMEFT19.ml.SHAP_summary(fmodel, points, fout, header=None)[source]¶ Creates a summary plot of the average SHAP values on a dataset.
- Arguments
 fmodel: Path to the file where the model was saved.
points: Pandas Dataframe containing the dataset.
fout: Path to save the plot (pdf only).
header: If the data file contains headers in the first row, 0.
- 
SMEFT19.ml.hist(ML, vpoints, fout)[source]¶ Plots an histogram for the predicted and actual likelihoods, and compares them to the chi-square distribution
- Arguments
 ML:The Machine Learning scan module.
vpoints: Path to the file containing the points in the validation dataset.
fout: Path to save the histogram.
- 
SMEFT19.ml.load_model(fmodel, vpoints, bf)[source]¶ Loads a XGBoost model previously saved
- Arguments
 fmodel: Path to the file where the model was saved.
bf: Best fit point.
- Returns
 Machine Learning scan.
- 
SMEFT19.ml.regr(ML, vpoints, fout)[source]¶ Plots the predicted likelihod vs the actual likelihood and computes their regression coefficient
- Arguments
 ML:The Machine Learning scan module.
vpoints: Path to the file containing the points in the validation dataset.
fout: Path to the output regression plot (pdf only).
- Returns
 A tuple containing the Perason r coefficient and the p-value of the regression
- 
SMEFT19.ml.train(dataset, fval, fmodel, bf, headers=None)[source]¶ Trains the Machine Learning algorithm with the previously computed Metropolis points
- Arguments
 dataset: Path to the file or list of files containing the Montecarlo pre-computed points.
fval: Path to the file where the validation points will be saved.
fmodel: Path to the file where the XGBoost model will be saved.
bf: Best fit point.
headers: Header lines in the dataset files. None if there is no header, 0 if the first line contains the header. Admits list if using several dataset files.
- Returns
 The Machine Learning scan module, already trained and ready to be used