bsmart.scans.MLScanner.MLS_DNNR
! @brief MLScanner DNNR (Deep Neural Network Regressor) method @ingroup scans
This scan implements an active learning strategy using a Deep Neural Network Regressor (DNNR) to efficiently find “good” points in a parameter space. A point is considered “good” if its primary observable (NLL) is below a specified threshold.
The process is as follows: 1. Initialization: The scan begins by evaluating a small set of randomly generated points (Bootstrap_Points).
It can also load an initial dataset from a CSV file (InitCSV).
Initial Training: A Deep Neural Network is trained on this initial dataset to predict the Negative Log Likelihood (NLL) from the input parameters. The network uses PyTorch.
Active Learning Loop: The scan enters a loop to iteratively discover new good points until a Target_Points count is reached. In each iteration: a. A large number of Candidate_Points are randomly generated. b. The trained DNN predicts the NLL for these candidates. c. candidates with the lowest predicted NLL (best quality), plus a small Random_Fraction,
are selected for evaluation by the physics code.
Retraining: The DNN is retrained with the newly discovered points, becoming progressively better at identifying promising regions (low NLL). Training uses MSE Loss, AdamW optimizer, and early stopping.
Data Collection: All discovered good points (NLL < Threshold) are returned.
This method is particularly effective for high-dimensional parameter spaces where exhaustive scanning is computationally prohibitive. !
Information
BSMArt Name: MLS_DNNR
- Requires:
torch
pandas
numpy
sklearn
Settings:
- Networks
Iterations: Number of active learning iterations (default: 10).
Candidate_Points: Number of candidate points to generate and score in each iteration (default: 500).
Bootstrap_Points: Number of initial random points to evaluate (default: 100).
Points_Per_Iteration: Number of candidate points to evaluate in each iteration (default: 300).
Threshold_Value: The threshold for the NLL to consider a point ‘good’ (default: 1).
Random_Fraction: Fraction of points per iteration to be selected randomly (default: 0.2).
Batch Size: Batch size for training the neural network (default: 500).
Neurons: Number of neurons in the hidden layers of the DNN (default: 100).
Epochs: Number of epochs for training the DNN in each cycle (default: 250).
LearningRate: Learning rate for the AdamW optimizer (default: 1e-2).
Verbose: Verbosity level (default: 0).
- Setup
InitCSV: Path to an optional CSV file with initial points to seed the scan.
Points: Number of points to generate in total before stopping (default: 1000)
- class bsmart.scans.MLScanner.MLS_DNNR.NewScan(inputs, log)[source]
Bases:
Scan- get_losses(observables)[source]
Returns a list of losses.
The C-function loss should be zero if the observable is within allowed bounds, and greater than zero outside it. If we include a validity condition, then other observables, evaluated afterwards, will be returned as NaN.
-> We should assign these the maximum loss ~ 710.
This is then compatible with the explicit use of ‘hierarchical observables’, where all other observables are set to the maximum.