bsmart.ml package

Submodules

bsmart.ml.ml module

Machine Learning utility routines for BSMArt; aim is these can either be imported by a scan or by external programs to load/create networks used by the scan.

class bsmart.ml.ml.BSMNetwork(*args: Any, **kwargs: Any)[source]

Bases: Module

Template for user-defined networks. The only restriction is that we always pass inputs in the form of a dictionary to have a common interface.

forward(x)[source]
class bsmart.ml.ml.BasicDiscriminator(*args: Any, **kwargs: Any)[source]

Bases: BSMNetwork

forward(x)[source]
class bsmart.ml.ml.BasicRegressor(*args: Any, **kwargs: Any)[source]

Bases: BSMNetwork

Neural network mapping to one output layer

forward(x)[source]
class bsmart.ml.ml.ClassifierDataset(*args: Any, **kwargs: Any)[source]

Bases: Dataset

add_some_points(good_points, bad_points)[source]
add_some_points_balance(good_points, bad_points)[source]
goodratio()[source]
bsmart.ml.ml.choices(dataset, thismany)[source]

bsmart.ml.mls_NN module

Helper functions for the xBit MLS scan

bsmart.ml.mls_NN.LINEAR_DIFF(a, b)[source]
class bsmart.ml.mls_NN.NNMLS(inputs)[source]

Bases: object

do_train(x_val, y_val, name)[source]
get_train_lh()[source]
rescale_data(input)[source]

undoes the effect of the rescaling, to return to the actual observables

scale_data(input)[source]

This is needed to curb excess values ‘input’ is a list of observables

set_classifier()[source]
set_predictor()[source]
splitter(x, y)[source]
bsmart.ml.mls_NN.exp_safe(x)[source]
bsmart.ml.mls_NN.gauss(val, m, s)[source]
bsmart.ml.mls_NN.limit_lh(steps)[source]
bsmart.ml.mls_NN.logL(val, m, s)[source]
bsmart.ml.mls_NN.make_safe_lh(x)[source]

curb extremes of a function, plateau at 100000

bsmart.ml.mls_NN.step(x)[source]

bsmart.ml.seed_points module

An algorithm for choosing a number of initial points to launch a scan, based on an already scored sample.

bsmart.ml.seed_points.select_seeds(coords: numpy.ndarray, nlls: numpy.ndarray, nseeds: int = 10, CUTOFF_MULTIPLIER: float = 100.0, SCALE_METHOD: str = 'minmax', EPSILON: float = 0.1, MIN_SAMPLES: int = 10, ALPHA: float = 0.7) numpy.ndarray[source]

Returns a list of the original ids of the points

If they come from a dataframe they can be read off using df.iloc[] If they come from a numpy array then it’s just coords[] and nlls[] that are wanted.

Module contents