pickling#

This file contains the methods to be used to save predictors and classifiers to files that can be transferred back to Blueback Investigator

Functions

load_classifier(filename)

Loads a function from 'filename'

load_predictor(filename)

Loads a function from 'filename'

save_classifier(filename, func, inputs, output)

Saves a classifier function to 'filename'

save_predictor(filename, func, inputs, output)

Saves a predictor function to 'filename'

cegalprizm.investigator.pickling.load_classifier(filename: str)#

Loads a function from ‘filename’

Parameters

filename (str) – The filename

cegalprizm.investigator.pickling.load_predictor(filename: str)#

Loads a function from ‘filename’

Returns

file

Return type

cloudpickle

cegalprizm.investigator.pickling.save_classifier(filename: str, func: Callable, inputs: Sequence[tuple], output: tuple)#

Saves a classifier function to ‘filename’

Parameters
  • filename (str) – the name of the file to be created

  • func (function) – the function that should be invoked to run the classifier

  • inputs (list) – a list of tuples each containing a continuous dimension name and a unit string (see Investigation.available_units property)

  • output (tuple) – a tuple of discrete dimension name, list of discrete tags (see Investigation.discrete_dimension_tags property)

Output:

json: A JSON file containing all the required information to define the classifier and the pickled classifier function

cegalprizm.investigator.pickling.save_predictor(filename: str, func: Callable, inputs: Sequence[tuple], output: tuple)#

Saves a predictor function to ‘filename’

Parameters
  • filename (str) – the name of the file to be created

  • func (function) – the name of the function that should be invoked to run the predictor

  • inputs (list) – a list of tuples each containing a continuous dimension name and a unit string (see Investigation.available_units property)

  • output (tuple) – a tuple of continuous dimension name, a unit string (see Investigation.available_units property)

Outputs:

json: A JSON file containing all the required information to define the predictor and the pickled predictor function