bsmart.scans.CMAES_ND

Optimisation using CMAES with Novelty Detection

Requires pip install cmaes, see: https://github.com/CyberAgentAILab/cmaes

BSMArt scan to be describe in an upcoming publication.

This scan uses cmaes to optimise a log-likelihood constructed from selected observables.

All desired observables must use the scaling CFUNCTION with a range of values for which the observable is in an acceptable range (other observables should have “SCALING”: “OFF” or at least no MEAN/VARIANCE/RANGE set so that they will be ignored.)

It is recommended to use this also with a validity condition, so that no further codes are evaluated when the observables are outside of this range, and the code chain can focus on first obtaining acceptable values for that/those observables.

For example, here we tell BSMArt to run SPheno and check the Higgs mass lies within 3 GeV of its observed value. We also record the lightest neutralino and selectron masses, construct a derived observable based on the difference of their masses, and insist that it is greater than zero:

"Codes": {
        "SPheno": {
            "Command": "< >",
            "InputFile": "< >",
            "OutputFile": "< >",
            "Observables":
            {
                        "mh": {
                        "SLHA": [
                                "MASS",
                                [25]
                        ],
                        "SCALING": "CFUNCTION",
                        "MEAN": 125.09,
                        "VARIANCE": 3,
                        "VALID": [122.09,128.09]
                        },
                        "mchi1": {
                                "SLHA" : [ "MASS", [1000022]], "SCALING": "OFF"]
                        },
                        "mse1": {
                                "SLHA" : [ "MASS", [1000011]], "SCALING": "OFF"]
                        },

                        "dmse1mchi1" : {
                        "FUNCTION": "mse1-mchi1",
                        "SCALING": "CFUNCTION",
                        "RANGE": [0,100000]
                        }
             },
             "Conditions": ["mse1>mchi1"],
             "Run": "True"
        }

Information

BSMArt Name: CMAES_ND

Requires:
  • cmaes

  • pyod

  • sklearn

  • traceback

  • pandas

Settings:

  • CMAESPopulationSize: Number of points to run per batch (optional, auto-calculated if not set)

  • CMAESMean: Initial mean for CMA-ES optimizer (optional, random if not set)

  • CMAESSigma: Initial step size for CMA-ES (optional, default: 1/sqrt(n_variables))

  • CMAESMaxGenerations: Number of batches to run (default: 100)

  • CMAES MaxLoss: Maximum loss value override (optional)

  • CMAESPathSeeds: Path to seed file (.csv or .parquet) for initial mean (optional)

  • CMAESNoveltyDetection: Enable novelty detection using HBOS (default: True)

  • CMAESHBOSNBins: Number of bins for HBOS novelty detection (default: 100)

  • CMAESFocus: Dict with Variables and Observables lists for novelty detection focus (optional)

  • CMAESHierarchy: List of hierarchical observables to focus on first (optional)

  • CMAESNoGoodPointsPatience: Number of generations without good points before stopping (default: 5000)

  • CMAESGoodPointsEarlyStop: Target number of good points for early stopping (default: 5000)

  • CMAESBestLossPatience: Patience for best loss counter (default: 200)

  • CMAESBestNValidConstraintsPatience: Patience for best n valid constraints counter (default: 2000)

  • Initial Sample: Path to initial sample file for warm start (optional)

class bsmart.scans.CMAES_ND.HBOSPenaliser(n_bins=100, *args, **kwargs)[source]

Bases: object

fit(X)[source]
get_penalties(x)[source]
class bsmart.scans.CMAES_ND.NewScan(inputs, log)[source]

Bases: Scan

Scanner class for CMAES-ND Scans

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.

initialise()[source]

method to allow the user scan to overload run settings etc during the initialisation process

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

Default postprocessing method for use with SLHA output, you should overload this for more interesting/sophisticated scans

run()[source]

Algorithm:

Our initial samples are in [0,1] since we use scalers. Subsequent rounds use the normalizing flow to generate samples

class bsmart.scans.CMAES_ND.Optimiser(direction='min', *args, **kwargs)[source]

Bases: object

fit(X)[source]
get_penalties(X)[source]