bsmart.scans.DLScanner

DLScanner

DLScanner method DLScanner based on code from

Adapted by Mark Goodsell and Farid Ibrahimov. We have tried to stay as close to the original as possible. However, important differences are: * Instead of comparing directly to a threshold value of an observable, we compare to the negative log likelihood of the model (similarly to the MLScanner methods). This is more general and hopefully more useful, since it allows many observables to be compared at once. In order to directly compare to the value of the observable, you can set “SCALING”: “EXPUSER”. In order to consider the value to be lower than the threshold in that case, you would need to define a function to be -1*observable_value. * We use pytorch instead of keras.

Information

BSMArt Name: DLScanner

Requires:
  • vegas

  • torch

Settings:

Networks
  • Iterations: Number of active learning iterations (default: 100).

  • Method: Method to use: ‘Classifier’ or ‘Regressor’ (default: ‘Classifier’).

  • K: Number of points to generate in each iteration (default: 10).

  • L: Number of candidate points to test with the model in each iteration (default: 500).

  • Threshold: Negative Log Likelihood threshold below which a point is classified as ‘good’ (default: 10).

  • Hidden_Layers: Number of hidden layers in the DNN (default: 3).

  • Neurons: Number of neurons in the hidden layers (default: 100).

  • Epochs: Number of training epochs (default: 250).

  • Batch Size: Batch size for training (default: 32).

  • LearningRate: Learning rate for the optimizer (default: 1e-2).

  • WeightDecay: Weight decay for the optimizer (default: 1e-4).

  • Use_Vegas_Map: Whether to use Vegas map for sampling (default: True).

  • Vegas_Frac: Fraction of points to sample using Vegas map (default: 0.1).

  • Vegas_Ninc: Number of increments for Vegas map (default: 100).

  • Random_Points: Number of random points to add in each iteration (default: K/10).

  • Verbose: Verbosity level (default: True).

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.DLScanner.NewScan(inputs, log)[source]

Bases: Scan

class_equalize()[source]
extract_from_valid_points(valid_points)[source]
genrand(npts)[source]
initialise()[source]

Need to make sure we override certain settings

postprocess(Point, observables, data_point, temp_dir, log, lock=None)[source]

If we are keeping ‘invalid’ points, the NLL is computed separately, so we just return 1.0 for valid points Otherwise the return value is the NLL.

run()[source]
run_batch(thetas)[source]
suggestpts(npts=None, randpts=None, L=None, limits=None, verbose=None, use_vegas_map=None, vegas_frac=None, threshold=None, vegas_ninc=None)[source]
bsmart.scans.DLScanner.torchfit(X, y, model, criterion, optimizer, epochs, batch_size, verbose=True, patience=50, min_delta=1e-05)[source]